diff options
author | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2021-05-08 22:12:40 +0700 |
---|---|---|
committer | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2021-05-08 22:12:40 +0700 |
commit | cfe47619942f4416878ce3680eb09d28fcddadc4 (patch) | |
tree | 68fa3665beaa504d9e724637ed588b85cc1edcaf | |
parent | bd920f04cc5c274d9cd76e420b88a567b5c1aec9 (diff) | |
download | blog-cfe47619942f4416878ce3680eb09d28fcddadc4.tar.gz |
Use hugo for generating markdown
-rw-r--r-- | .build.yml | 15 | ||||
-rwxr-xr-x | add-front-matter.sh | 19 |
2 files changed, 28 insertions, 6 deletions
diff --git a/.build.yml b/.build.yml index 9ad24cb..038ff62 100644 --- a/.build.yml +++ b/.build.yml @@ -3,21 +3,24 @@ oauth: pages.sr.ht/PAGES:RW packages: - golang - hugo - - cargo environment: site: huyngo.srht.site tasks: - install: | - cargo install mdbook git clone https://git.sr.ht/~sircmpwn/openring cd openring go build -o openring sudo cp openring /usr/local/bin/ -- package: | +- embed: git clone https://git.disroot.org/huyngo/conlang - cd conlang - /home/build/.cargo/bin/mdbook build - cd .. + cp -r conlang/src $site/content/conlang + cd $site/content/conlang + mv index.md _index.md + sed "s/\//_/g" SUMMARY.md | sed "s/\._/.\//g" | sed "s/.md/\//g" | grep -v "Introduction" >> _index.md + rm SUMMARY.md + for file in $(find -type f); do ../../add-front-matter.sh $file; done + find -type f | grep "sh$" | xargs rm +- package: | cd $site ./create-webring.sh hugo diff --git a/add-front-matter.sh b/add-front-matter.sh new file mode 100755 index 0000000..69e0b7b --- /dev/null +++ b/add-front-matter.sh @@ -0,0 +1,19 @@ +if [[ $1 == "temp" ]]; then + exit +fi + +title=$(grep -m1 '#' $1 | grep -o "[^#]*"); +new_path=$(echo $1 | sed "s/\//_/g" | sed "s/\._/.\//g") + +{ echo -e "---\ntitle: $title"; +echo -e "categories: [ conlang ]"; +echo -e "no_feed: true"; +echo -e "disable_feed: true\n---\n"; +echo "Go to [Table of Contents](/conlang/)" +cat $1; } > temp +mv temp $1 +# flatten +if [[ $1 != "./_index.md" ]]; then + mv $1 $new_path +fi +find -type d | grep "\./[a-z]*$" | rm -rf |