mirror of
https://github.com/arnaucube/konstrui.git
synced 2026-02-06 19:16:41 +01:00
starting to implement multilanguage directories
This commit is contained in:
10
main.go
10
main.go
@@ -6,7 +6,6 @@ import (
|
||||
)
|
||||
|
||||
const rawFolderPath = "./webInput"
|
||||
const newFolderPath = "./webOutput"
|
||||
const konstruiConfigFile = "konstruiConfig.json"
|
||||
|
||||
func main() {
|
||||
@@ -14,15 +13,18 @@ func main() {
|
||||
c.Green("getting conifg from file konstruiConfig.json")
|
||||
|
||||
//READ CONFIG: konstruiConfig.json
|
||||
readKonstruiConfig(rawFolderPath + "/" + konstruiConfigFile)
|
||||
konstruiConfigs := readKonstruiConfig(rawFolderPath + "/" + konstruiConfigFile)
|
||||
c.Green("configuration:")
|
||||
fmt.Println(konstruiConfig)
|
||||
fmt.Println(konstruiConfigs)
|
||||
c.Green("templating")
|
||||
|
||||
//create directory webOutput
|
||||
_ = os.Mkdir("webOutput", os.ModePerm)
|
||||
|
||||
//DO TEMPLATING
|
||||
startTemplating(rawFolderPath, newFolderPath)
|
||||
for _, konstruiConfig := range konstruiConfigs {
|
||||
_ = os.Mkdir(konstruiConfig.OutputDir, os.ModePerm)
|
||||
startTemplating(rawFolderPath, konstruiConfig.OutputDir, konstruiConfig)
|
||||
}
|
||||
c.Green("webpage finished, files at /webOutput")
|
||||
}
|
||||
|
||||
@@ -18,18 +18,22 @@ type KonstruiConfig struct {
|
||||
Author string `json:"author"`
|
||||
Github string `json:"github"`
|
||||
Website string `json:"website"`
|
||||
OutputDir string `json:"outputDir"`
|
||||
LangPrefix string `json:"langPrefix"`
|
||||
Files []string `json:"files"`
|
||||
RepeatPages []RepeatPages
|
||||
CopyRaw []string `json:"copyRaw"`
|
||||
}
|
||||
|
||||
var konstruiConfig KonstruiConfig
|
||||
func readKonstruiConfig(path string) []KonstruiConfig {
|
||||
var konstruiConfigs []KonstruiConfig
|
||||
|
||||
func readKonstruiConfig(path string) {
|
||||
file, e := ioutil.ReadFile(path)
|
||||
if e != nil {
|
||||
fmt.Println("error:", e)
|
||||
}
|
||||
content := string(file)
|
||||
json.Unmarshal([]byte(content), &konstruiConfig)
|
||||
json.Unmarshal([]byte(content), &konstruiConfigs)
|
||||
|
||||
return konstruiConfigs
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ func getTagParameters(line string, tagname string, param1 string, param2 string)
|
||||
return param1content, param2content
|
||||
}
|
||||
|
||||
func startTemplating(folderPath string, newDir string) {
|
||||
func startTemplating(folderPath string, newDir string, konstruiConfig KonstruiConfig) {
|
||||
//FILES
|
||||
//do templating for each file in konstruiConfig.Files
|
||||
//konstrui-template
|
||||
|
||||
Reference in New Issue
Block a user