--- ssg5 2020-11-25 09:16:39.180192761 +0100 +++ ssg5-pandoc 2020-11-25 09:14:49.703521567 +0100 @@ -63,20 +63,26 @@ then echo "$fs" | tee "$dst/.files" - if echo "$fs" | grep -q '\.md$' - then - if test -x "$(which lowdown 2> /dev/null)" + if test -x "$(which pandoc 2> /dev/null)" + then + echo "$fs" | grep '\.md$' | + render_md_files_pandoc "$src" "$dst" "$title" + else + if echo "$fs" | grep -q '\.md$' then - echo "$fs" | grep '\.md$' | - render_md_files_lowdown "$src" "$dst" "$title" - else - if test -x "$(which Markdown.pl 2> /dev/null)" + if test -x "$(which lowdown 2> /dev/null)" then echo "$fs" | grep '\.md$' | - render_md_files_Markdown_pl "$src" "$dst" "$title" + render_md_files_lowdown "$src" "$dst" "$title" else - echo "couldn't find lowdown nor Markdown.pl" - exit 3 + if test -x "$(which Markdown.pl 2> /dev/null)" + then + echo "$fs" | grep '\.md$' | + render_md_files_Markdown_pl "$src" "$dst" "$title" + else + echo "couldn't find pandoc nor lowdown nor Markdown.pl" + exit 3 + fi fi fi fi @@ -207,6 +213,16 @@ done } +render_md_files_pandoc(){ + while read -r f + do + pandoc < "$1/$f" | + render_html_file "$3" \ + > "$2/${f%\.md}.html" + sed -i 's/disabled=""//g' "$2/${f%\.md}.html" + done +} + render_html_file() { # h/t Devin Teske