Run function

This commit is contained in:
Sebastian Frank 2019-03-19 11:34:35 +01:00
parent 70d7497eda
commit 0dfe0f8142
Signed by: apairon
GPG Key ID: 7270D06DDA7FE8C3
3 changed files with 15 additions and 13 deletions

View File

@ -22,8 +22,6 @@ var (
var log = helper.Log
var tree = new(mark2web.TreeNode)
func main() {
inDir := flag.String("in", "./", "input directory")
outDir := flag.String("out", "html", "output directory")
@ -127,19 +125,11 @@ func main() {
Quality: 75,
}
tree.ReadContentDir(*inDir+"/content", *outDir, "", defaultPathConfig)
//spew.Dump(contentConfig)
//spew.Dump(navMap)
templatesDir := *inDir + "/templates"
mark2web.SetTemplateDir(templatesDir)
filtersDir := templatesDir + "/filters"
filtersDir := *inDir + "/templates/filters"
if _, err := os.Stat(filtersDir); !os.IsNotExist(err) {
filter.RegisterFilters(filtersDir)
}
tree.ProcessContent()
mark2web.ProcessAssets()
mark2web.Run(*inDir, *outDir, defaultPathConfig)
}

11
pkg/mark2web/run.go Normal file
View File

@ -0,0 +1,11 @@
package mark2web
func Run(inDir, outDir string, defaultPathConfig *PathConfig) {
SetTemplateDir(inDir + "/templates")
tree := new(TreeNode)
tree.ReadContentDir(inDir+"/content", outDir, "", defaultPathConfig)
tree.ProcessContent()
ProcessAssets()
}

View File

@ -16,5 +16,6 @@ type TreeNode struct {
Config *PathConfig
Sub []*TreeNode
root *TreeNode // shows always to root of tree
root *TreeNode // shows always to root of tree
parent *TreeNode
}