From dffbad640f8983cfb0e9e7d06361f840464e7e19 Mon Sep 17 00:00:00 2001 From: milovann Date: Thu, 5 Dec 2024 12:13:39 +0100 Subject: [PATCH] up --- .forgejo/workflows/default.yml | 6 ------ .forgejo/workflows/publish.yml | 2 +- dist/.gitignore | 2 +- pages/doc.md | 4 +++- scripts/links-to-html.lua | 7 +++++++ scripts/web.sh | 27 ++++++++++++++++++--------- 6 files changed, 30 insertions(+), 18 deletions(-) delete mode 100644 .forgejo/workflows/default.yml create mode 100644 scripts/links-to-html.lua diff --git a/.forgejo/workflows/default.yml b/.forgejo/workflows/default.yml deleted file mode 100644 index 899022c..0000000 --- a/.forgejo/workflows/default.yml +++ /dev/null @@ -1,6 +0,0 @@ -on: [push] -jobs: - test: - runs-on: docker - steps: - - run: echo Hello, Runner ! \ No newline at end of file diff --git a/.forgejo/workflows/publish.yml b/.forgejo/workflows/publish.yml index d646d1a..b4eceb3 100644 --- a/.forgejo/workflows/publish.yml +++ b/.forgejo/workflows/publish.yml @@ -35,7 +35,7 @@ jobs: echo "Script" for file in ${ALL_CHANGED_FILES}; do echo "Script" - ./web.sh "$file" + ./web.sh convert "$file" done cd .. diff --git a/dist/.gitignore b/dist/.gitignore index 139597f..3432c3f 100644 --- a/dist/.gitignore +++ b/dist/.gitignore @@ -1,2 +1,2 @@ - +*.html diff --git a/pages/doc.md b/pages/doc.md index 14eb029..65eefb1 100644 --- a/pages/doc.md +++ b/pages/doc.md @@ -1,2 +1,4 @@ -# Doc +# Documentation + +* [Accueil](index.md) diff --git a/scripts/links-to-html.lua b/scripts/links-to-html.lua new file mode 100644 index 0000000..08c20b6 --- /dev/null +++ b/scripts/links-to-html.lua @@ -0,0 +1,7 @@ +-- https://stackoverflow.com/questions/40993488/convert-markdown-links-to-html-with-pandoc +-- +-- links-to-html.lua +function Link(el) + el.target = string.gsub(el.target, "%.md", ".html") + return el +end diff --git a/scripts/web.sh b/scripts/web.sh index 5e51885..697d538 100755 --- a/scripts/web.sh +++ b/scripts/web.sh @@ -1,13 +1,22 @@ #!/bin/bash -file=$1 -filename=$(basename -- "$file") -extension="${filename##*.}" -filename="${filename%.*}" +convert() +{ + file=$1 + filename=$(basename -- "$file") + extension="${filename##*.}" + filename="${filename%.*}" + + if [[ -f ../pages/$filename.md ]] + then + echo "making $filename.html" + pandoc -s ../pages/$filename.md -t html > ../dist/$filename.html --lua-filter=links-to-html.lua + fi +} + +case $1 in + convert) shift 1; convert "$@";; + *) echo "?" ;; +esac -if [[ -f ../pages/$filename.md ]] -then - echo "making $filename.html" - pandoc -s ../pages/$filename.md -t html > ../dist/$filename.html -fi