diff --git a/Taskfile.yml b/Taskfile.yml index 38fa096..1f19d1f 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,6 +1,6 @@ # https://taskfile.dev -version: '3' +version: "3" vars: TARGET: vss @@ -9,13 +9,12 @@ includes: build: ./misc/Taskfile_{{OS}}.yml tasks: - echo: cmds: - echo {{.ARCHIVE_DIR}} vars: ARCHIVE_DIR: "{{.TARGET}}_{{OS}}_{{ARCH}}" - + setup: desc: Setup vss project cmds: @@ -35,21 +34,18 @@ tasks: vet: desc: Report suspicious code constructs cmds: - - v vet *.v + - v vet . format: desc: Format .v files cmds: - - v fmt -w *.v - - v fmt -w commands - - v fmt -w internal/template - - v fmt -w internal/config/ - + - v fmt -w . + clean: desc: Clean test files cmds: - rm -rf dist/ - + dist: desc: Mkdir dist cmds: @@ -61,7 +57,7 @@ tasks: desc: Build vss cmds: - v . -o {{.TARGET}} - + prod-build: desc: Build vss for production cmds: @@ -78,4 +74,4 @@ tasks: example-run: dir: example cmds: - - ./vss build \ No newline at end of file + - ./vss build diff --git a/commands/build.v b/commands/build.v index e8b40cd..02de135 100644 --- a/commands/build.v +++ b/commands/build.v @@ -72,26 +72,8 @@ fn normalise_paths(paths []string) []string { return res } -// 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} - mut re := regex.regex_opt(r'\[.+\]\(.+\.md\)') or { return err } - - for i, line in contents.split_into_lines() { - 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') -} - fn get_md_content(path string) !string { - md := os.read_file(path)! - return pre_proc_md_to_html(md) + return os.read_file(path)! } fn get_content(path string) !string { diff --git a/example/index.md b/example/index.md index aff41c3..f224842 100644 --- a/example/index.md +++ b/example/index.md @@ -6,6 +6,6 @@ A static site generator ## Pages -- [about page](./about.md) +- [about page](./about) - post - - [first](./post/first.md) + - [first](./post/first)