From e8059cca2b37c55e69eba337bd7530a5c80e9be5 Mon Sep 17 00:00:00 2001 From: zztkm Date: Tue, 26 Jul 2022 13:15:17 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20markdown=20=E3=81=A7=E6=9B=B8?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=82=B3=E3=83=B3=E3=83=86=E3=83=B3=E3=83=84?= =?UTF-8?q?=E3=82=92html=E3=81=AB=E5=9F=8B=E3=82=81=E8=BE=BC=E3=82=80?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vss.v | 23 +++++++++++++++++------ vss_test.v | 11 +++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/vss.v b/vss.v index 3e1dc8e..7572e00 100644 --- a/vss.v +++ b/vss.v @@ -4,28 +4,39 @@ import os import cli import markdown +const markdown_text = " +# Open Sea + +A static site generator + +- [GitHub](https://github.com/zztkm) +" + fn main() { mut app := cli.Command{ name: 'vss' version: '0.0.0' description: 'static site generator' execute: fn (cmd cli.Command) ? { - paths := get_paths("testfiles") + paths := get_paths('testfiles') if paths.len == 0 { - println("Cloud not retrieve path") + println('Cloud not retrieve path') return } for path in paths { println(path) } + + // index_html := $embed_file("layouts/_index.html") + title := 'tsurutatakumi.info' + contents := markdown.to_html(markdown_text) + + index_html := $tmpl('layouts/_index.html') + os.write_file('index.html', index_html) ? return } } - text := '# Markdown Rocks!' - output := markdown.to_html(text) - println(output) //

Markdown Rocks!

- app.setup() app.parse(os.args) } diff --git a/vss_test.v b/vss_test.v index df09a86..973b287 100644 --- a/vss_test.v +++ b/vss_test.v @@ -2,7 +2,6 @@ module main import os - fn normalise_paths(paths []string) []string { mut res := paths.map(it.replace(os.path_separator, '/')) res.sort() @@ -10,11 +9,11 @@ fn normalise_paths(paths []string) []string { } fn test_get_paths() { - testpath := "testfiles" + testpath := 'testfiles' mds := normalise_paths(get_paths(testpath)) assert mds.len == 2 assert mds == [ - "testfiles/aaa.md", - "testfiles/bbb.md", - ] -} \ No newline at end of file + 'testfiles/aaa.md', + 'testfiles/bbb.md', + ] +}