Something went wrong on our end
-
Volker Schukai authoredVolker Schukai authored
html.go 16.95 KiB
// Copyright 2023 schukai GmbH
// SPDX-License-Identifier: AGPL-3.0
package document
import (
"bytes"
"crypto/md5"
"encoding/base64"
"fmt"
embed "github.com/13rac1/goldmark-embed"
"github.com/PuerkitoBio/goquery"
"github.com/andybalholm/cascadia"
"github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/ast"
markdownHTML "github.com/gomarkdown/markdown/html"
"github.com/gomarkdown/markdown/parser"
"github.com/gosimple/slug"
"github.com/mattn/go-shellwords"
"github.com/tdewolff/minify/v2"
minHTML "github.com/tdewolff/minify/v2/html"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
goldmarkParser "github.com/yuin/goldmark/parser"
goldmarkHTML "github.com/yuin/goldmark/renderer/html"
"gitlab.schukai.com/oss/utilities/documentation-manager/environment"
"gitlab.schukai.com/oss/utilities/documentation-manager/translations"
"gitlab.schukai.com/oss/utilities/documentation-manager/utils"
"golang.org/x/net/html"
"golang.org/x/net/html/atom"
"io"
"io/ioutil"
"log"
"math/rand"
"os"
"path"
"path/filepath"
"regexp"
"strconv"
"strings"
"text/template"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
const defaultSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
type BuildHtmlEnvironment struct {
SourcePath string
DateFormat string
OutputPath string
Verbose bool
SinglePage bool
Templates struct {
HTML string
Components map[string]string
}
}
func (t *BuildHtmlEnvironment) GetComponentsTemplates() map[string]string {
return t.Templates.Components
}
type HtmlDocument struct {
ID string
Content string
*SourceFile