From b1405723cc6ef0b052a0ec34fb574252b46a1959 Mon Sep 17 00:00:00 2001 From: zztkm Date: Wed, 3 Aug 2022 02:29:03 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vss.v | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vss.v b/vss.v index b8fdc16..a2778af 100644 --- a/vss.v +++ b/vss.v @@ -54,12 +54,15 @@ fn get_html_filename(md_path string) string { return file_name + '.html' } -// parse_link convert markdown relative links to html relative links -fn parse_link(contents 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() - for line in lines { + mut parsed_lines := []string{len: lines.len} + for i, iine in contents.split_into_lines() { println(line) + parsed_lines[i] = line } + return parsed_lines.join("\n") } fn generate_pages() ? { @@ -73,7 +76,8 @@ fn generate_pages() ? { md_paths := get_paths('.') for path in md_paths { - md := os.read_file(path)? + mut md := os.read_file(path)? + md = pre_proc_md_to_html(md) contents := markdown.to_html(md) config_map['contents'] = contents html := template.parse(template_content, config_map)