allow references to other MD files
just replace the suffix
This commit is contained in:
parent
49ccde2afe
commit
38fe6ae08d
1 changed files with 16 additions and 0 deletions
16
kew.go
16
kew.go
|
|
@ -88,6 +88,21 @@ func copy_file(src string, dst string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func fix_md_references(s string) string {
|
||||
r := strings.NewReplacer(
|
||||
/* common cases */
|
||||
".md)", ".html)",
|
||||
".md\"", ".html\"",
|
||||
".md'", ".html'",
|
||||
".md)", ".html)",
|
||||
".md#", ".html#",
|
||||
".md>", ".html>",
|
||||
".md ", ".html ",
|
||||
".md,", ".html,",
|
||||
)
|
||||
return r.Replace(s)
|
||||
}
|
||||
|
||||
func markdown_to_html(path string) (string, error) {
|
||||
cmd := exec.Command("lowdown", "-Thtml")
|
||||
|
||||
|
|
@ -192,6 +207,7 @@ func main() {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
html = fix_md_references(html)
|
||||
|
||||
relhtml := strings.TrimSuffix(rel, ".md") + ".html"
|
||||
cur := relhtml
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue