This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
Reference in New Issue
Block a user