🚧
This commit is contained in:
parent
c2bd1636e7
commit
d109fd9ed0
4 changed files with 28 additions and 15 deletions
|
@ -3,10 +3,6 @@
|
|||
version: '3'
|
||||
|
||||
tasks:
|
||||
default:
|
||||
cmds:
|
||||
- echo "{{.GREETING}}"
|
||||
silent: true
|
||||
|
||||
doc:
|
||||
desc: Update module document
|
||||
|
@ -28,3 +24,8 @@ tasks:
|
|||
desc: Format .v files
|
||||
cmds:
|
||||
- v fmt -w *.v
|
||||
|
||||
clean:
|
||||
desc: Clean test files
|
||||
cmds:
|
||||
- rm -rf dist/
|
||||
|
|
5
index.md
Normal file
5
index.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Open Sea
|
||||
|
||||
A static site generator
|
||||
|
||||
- [GitHub](https://github.com/zztkm)
|
9
template/template.v
Normal file
9
template/template.v
Normal file
|
@ -0,0 +1,9 @@
|
|||
module template
|
||||
|
||||
struct Template {
|
||||
template string
|
||||
}
|
||||
|
||||
fn parse() {}
|
||||
|
||||
fn execute() {}
|
20
vss.v
20
vss.v
|
@ -4,13 +4,7 @@ import os
|
|||
import cli
|
||||
import markdown
|
||||
|
||||
const markdown_text = '
|
||||
# Open Sea
|
||||
|
||||
A static site generator
|
||||
|
||||
- [GitHub](https://github.com/zztkm)
|
||||
'
|
||||
const default_index = 'index.md'
|
||||
|
||||
const default_dist = 'dist'
|
||||
|
||||
|
@ -43,15 +37,19 @@ fn generate_index_page() ? {
|
|||
println(path)
|
||||
}
|
||||
|
||||
// index_html := $embed_file("layouts/_index.html")
|
||||
title := 'tsurutatakumi.info'
|
||||
contents := markdown.to_html(markdown_text)
|
||||
index_md := os.read_file(default_index)?
|
||||
|
||||
// for $tmpl value
|
||||
title := 'tsurutatakumi.info'
|
||||
contents := markdown.to_html(index_md)
|
||||
|
||||
// tmpl に変数を割り当てるのは今の所無理
|
||||
// https://github.com/vlang/v/discussions/15068
|
||||
index_html := $tmpl('layouts/_index.html')
|
||||
dist := default_dist
|
||||
|
||||
if !os.exists(dist) {
|
||||
os.mkdir_all(dist, ) // build/_dist/ のようなPATHが渡されても作成できるようにmkdir_allを使う
|
||||
os.mkdir_all(dist)? // build/_dist/ のようなPATHが渡されても作成できるようにmkdir_allを使う
|
||||
}
|
||||
path := os.join_path(dist, 'index.html')
|
||||
os.write_file(path, index_html)?
|
||||
|
|
Loading…
Add table
Reference in a new issue