This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"gitbase.de/apairon/mark2web/context"
|
||||
"gitbase.de/apairon/mark2web"
|
||||
"gitbase.de/apairon/mark2web/helper"
|
||||
"github.com/ddliu/motto"
|
||||
"github.com/flosch/pongo2"
|
||||
@@ -44,8 +44,8 @@ func RegisterFilters(dir string) {
|
||||
fileBase,
|
||||
func(in, param *pongo2.Value) (out *pongo2.Value, erro *pongo2.Error) {
|
||||
thisObj, _ := vm.Object("({})")
|
||||
if context.CurrentContext != nil {
|
||||
thisObj.Set("context", *context.CurrentContext)
|
||||
if mark2web.CurrentContext != nil {
|
||||
thisObj.Set("context", *mark2web.CurrentContext)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -12,17 +12,16 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"gitbase.de/apairon/mark2web/config"
|
||||
"gitbase.de/apairon/mark2web/context"
|
||||
"gitbase.de/apairon/mark2web"
|
||||
"gitbase.de/apairon/mark2web/helper"
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/flosch/pongo2"
|
||||
)
|
||||
|
||||
func parseImageParams(str string) (*config.ImagingConfig, error) {
|
||||
p := config.ImagingConfig{}
|
||||
func parseImageParams(str string) (*mark2web.ImagingConfig, error) {
|
||||
p := mark2web.ImagingConfig{}
|
||||
if str == "" {
|
||||
helper.Merge(&p, context.CurrentPathConfig.Imaging)
|
||||
helper.Merge(&p, mark2web.CurrentPathConfig.Imaging)
|
||||
// Filename and Format are only valid for current image
|
||||
p.Filename = ""
|
||||
p.Format = ""
|
||||
@@ -131,7 +130,7 @@ func ImageProcessFilter(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *
|
||||
}
|
||||
} else {
|
||||
// local file
|
||||
imgSource = context.ResolveInputPath(imgSource)
|
||||
imgSource = mark2web.ResolveInputPath(imgSource)
|
||||
if p.Filename == "" {
|
||||
p.Filename = fmt.Sprintf(
|
||||
"%s_%s",
|
||||
@@ -143,7 +142,7 @@ func ImageProcessFilter(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *
|
||||
|
||||
var imgTarget string
|
||||
if p.TargetDir != "" {
|
||||
imgTarget = context.ResolveOutputPath(
|
||||
imgTarget = mark2web.ResolveOutputPath(
|
||||
path.Clean(p.TargetDir) + "/" +
|
||||
p.Filename,
|
||||
)
|
||||
@@ -159,10 +158,10 @@ func ImageProcessFilter(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *
|
||||
}
|
||||
}
|
||||
|
||||
p.Filename = context.ResolveNavPath(p.TargetDir + "/" + p.Filename)
|
||||
p.Filename = mark2web.ResolveNavPath(p.TargetDir + "/" + p.Filename)
|
||||
|
||||
} else {
|
||||
imgTarget = context.ResolveOutputPath(p.Filename)
|
||||
imgTarget = mark2web.ResolveOutputPath(p.Filename)
|
||||
}
|
||||
|
||||
if f, err := os.Stat(imgTarget); err == nil && !f.IsDir() {
|
||||
@@ -236,5 +235,5 @@ func ImageProcessFilter(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *
|
||||
}
|
||||
}
|
||||
}
|
||||
return pongo2.AsValue(context.ResolveNavPath(p.Filename)), nil
|
||||
return pongo2.AsValue(mark2web.ResolveNavPath(p.Filename)), nil
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package filter
|
||||
|
||||
import (
|
||||
"gitbase.de/apairon/mark2web/context"
|
||||
"gitbase.de/apairon/mark2web"
|
||||
"gitbase.de/apairon/mark2web/helper"
|
||||
"github.com/flosch/pongo2"
|
||||
)
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
func MarkdownFilter(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {
|
||||
chromaRenderer := false
|
||||
chromaStyle := "monokai"
|
||||
if m := context.CurrentPathConfig.Markdown; m != nil {
|
||||
if m := mark2web.CurrentPathConfig.Markdown; m != nil {
|
||||
if m.ChromaRenderer != nil && *m.ChromaRenderer {
|
||||
chromaRenderer = true
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package filter
|
||||
|
||||
import (
|
||||
"gitbase.de/apairon/mark2web/context"
|
||||
"gitbase.de/apairon/mark2web"
|
||||
"github.com/flosch/pongo2"
|
||||
)
|
||||
|
||||
// RelativePathFilter returns the relative path to navpoint based on current nav
|
||||
func RelativePathFilter(in, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {
|
||||
return pongo2.AsValue(
|
||||
context.ResolveNavPath(
|
||||
mark2web.ResolveNavPath(
|
||||
in.String(),
|
||||
),
|
||||
), nil
|
||||
|
||||
Reference in New Issue
Block a user