✨ Added: convert md paths to html paths
This commit is contained in:
parent
b1405723cc
commit
dff40184d7
1 changed files with 15 additions and 5 deletions
20
vss.v
20
vss.v
|
@ -3,6 +3,7 @@ module main
|
|||
import os
|
||||
import cli
|
||||
import toml
|
||||
import regex
|
||||
import markdown
|
||||
import template
|
||||
|
||||
|
@ -57,12 +58,21 @@ fn get_html_filename(md_path string) string {
|
|||
// pre_proc_md_to_html convert markdown relative links to html relative links
|
||||
fn pre_proc_md_to_html(contents string) string {
|
||||
lines := contents.split_into_lines()
|
||||
mut parsed_lines := []string{len: lines.len}
|
||||
for i, iine in contents.split_into_lines() {
|
||||
println(line)
|
||||
parsed_lines[i] = line
|
||||
mut parsed_lines := []string{len: lines.len}
|
||||
for i, line in contents.split_into_lines() {
|
||||
mut re := regex.regex_opt(r'\[.+\]\(.+\.md\)') or {
|
||||
eprintln('error: $err')
|
||||
continue
|
||||
}
|
||||
|
||||
start, end := re.find(line)
|
||||
if start >= 0 && end > start {
|
||||
parsed_lines[i] = line.replace('.md', '.html')
|
||||
} else {
|
||||
parsed_lines[i] = line
|
||||
}
|
||||
}
|
||||
return parsed_lines.join("\n")
|
||||
return parsed_lines.join('\n')
|
||||
}
|
||||
|
||||
fn generate_pages() ? {
|
||||
|
|
Loading…
Reference in a new issue