mirror of
https://git.mills.io/prologic/zs
synced 2024-11-22 05:16:11 +03:00
Code cleanup
This commit is contained in:
parent
40012efba4
commit
2ab171a0d4
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
*~
|
*~
|
||||||
*.bak
|
*.bak
|
||||||
|
**.pub
|
||||||
|
|
||||||
/zs
|
/zs
|
||||||
/.pub
|
|
||||||
/dist
|
/dist
|
||||||
|
/test.md
|
||||||
|
5
main.go
5
main.go
@ -33,9 +33,8 @@ func renameExt(path, oldext, newext string) string {
|
|||||||
}
|
}
|
||||||
if oldext == "" || strings.HasSuffix(path, oldext) {
|
if oldext == "" || strings.HasSuffix(path, oldext) {
|
||||||
return strings.TrimSuffix(path, oldext) + newext
|
return strings.TrimSuffix(path, oldext) + newext
|
||||||
} else {
|
|
||||||
return path
|
|
||||||
}
|
}
|
||||||
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
// globals returns list of global OS environment variables that start
|
// globals returns list of global OS environment variables that start
|
||||||
@ -169,7 +168,7 @@ func render(s string, vars Vars) (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renders markdown with the given layout into html expanding all the macros
|
// Renders markdown with the given layout into html expanding all the macros
|
||||||
|
@ -55,7 +55,7 @@ foo: bar
|
|||||||
title: Hello, world!
|
title: Hello, world!
|
||||||
---
|
---
|
||||||
Some content in markdown
|
Some content in markdown
|
||||||
`: Vars{
|
`: {
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
"title": "Hello, world!",
|
"title": "Hello, world!",
|
||||||
"url": "test.html",
|
"url": "test.html",
|
||||||
@ -67,7 +67,7 @@ Some content in markdown
|
|||||||
url: "example.com/foo.html"
|
url: "example.com/foo.html"
|
||||||
---
|
---
|
||||||
Hello
|
Hello
|
||||||
`: Vars{
|
`: {
|
||||||
"url": "example.com/foo.html",
|
"url": "example.com/foo.html",
|
||||||
"__content": "Hello\n",
|
"__content": "Hello\n",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user