brotli without cgo
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-02-28 10:44:20 +01:00
parent a781485c0a
commit 5cdc4203b7
136 changed files with 256664 additions and 27607 deletions

View File

@@ -1,5 +1,3 @@
// +build cgo
package mark2web
import (
@@ -7,7 +5,7 @@ import (
"os"
"gitbase.de/apairon/mark2web/pkg/logger"
"github.com/itchio/go-brotli/enc"
"github.com/andybalholm/brotli"
)
var brotliSupported = true
@@ -22,7 +20,7 @@ func handleBrotliCompression(filename string, content []byte) {
defer f.Close()
bw := enc.NewBrotliWriter(f, nil)
bw := brotli.NewWriterLevel(f, brotli.BestCompression)
defer bw.Close()
if content != nil {

View File

@@ -42,7 +42,6 @@ func (node *TreeNode) ReadContentDir(inBase string, outBase string, dir string,
node.InputFiles = make([]string, 0)
}
node.InputFiles = append(node.InputFiles, f.Name())
break
default:
logger.D("FIL %s", p)
if node.OtherFiles == nil {
@@ -73,7 +72,7 @@ func (node *TreeNode) processMarkdownWithHeader(md []byte, errorRef string) (*Pa
newConfig := new(PathConfig)
headerRegex := regexp.MustCompile("(?s)^---(.*?)\\r?\\n\\r?---\\r?\\n\\r?")
headerRegex := regexp.MustCompile(`(?s)^---(.*?)\r?\n\r?---\r?\\n\r?`)
yamlData := headerRegex.Find(md)
if string(yamlData) != "" {
// replace tabs
@@ -96,7 +95,7 @@ func (node *TreeNode) processMarkdownWithHeader(md []byte, errorRef string) (*Pa
}
// use --- for splitting document in markdown parts
regex := regexp.MustCompile("\\r?\\n\\r?---\\r?\\n\\r?")
regex := regexp.MustCompile(`\r?\n\r?---\r?\n\r?`)
inputParts := regex.Split(string(md), -1)
htmlParts := make([]*pongo2.Value, 0)

View File

@@ -1,14 +0,0 @@
// +build !cgo
package mark2web
import "gitbase.de/apairon/mark2web/pkg/helper"
var brotliSupported = false
func init() {
helper.Log.Warning("cgo is disabled, so brotli compression is not supported")
}
func handleBrotliCompression(filename string, content []byte) {
}