Merge pull request #57 from vssio/fix#44

Fix#44
main
zztkm 1 year ago committed by GitHub
commit 9805052fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
# https://taskfile.dev # https://taskfile.dev
version: '3' version: "3"
vars: vars:
TARGET: vss TARGET: vss
@ -9,7 +9,6 @@ includes:
build: ./misc/Taskfile_{{OS}}.yml build: ./misc/Taskfile_{{OS}}.yml
tasks: tasks:
echo: echo:
cmds: cmds:
- echo {{.ARCHIVE_DIR}} - echo {{.ARCHIVE_DIR}}
@ -35,15 +34,12 @@ tasks:
vet: vet:
desc: Report suspicious code constructs desc: Report suspicious code constructs
cmds: cmds:
- v vet *.v - v vet .
format: format:
desc: Format .v files desc: Format .v files
cmds: cmds:
- v fmt -w *.v - v fmt -w .
- v fmt -w commands
- v fmt -w internal/template
- v fmt -w internal/config/
clean: clean:
desc: Clean test files desc: Clean test files

@ -72,26 +72,8 @@ fn normalise_paths(paths []string) []string {
return res 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 { fn get_md_content(path string) !string {
md := os.read_file(path)! return os.read_file(path)!
return pre_proc_md_to_html(md)
} }
fn get_content(path string) !string { fn get_content(path string) !string {

@ -6,6 +6,6 @@ A static site generator
## Pages ## Pages
- [about page](./about.md) - [about page](./about)
- post - post
- [first](./post/first.md) - [first](./post/first)

Loading…
Cancel
Save