From 2fc8dfda51a15865a206696e5f5cb7ef2b4eaeeb Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Sun, 14 Mar 2021 10:53:40 +0100 Subject: Filter out frontmatter --- gen | 2 +- shell.nix | 1 + ssg5 | 13 ++++++------- wpisy/_header.html | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gen b/gen index b788c0a..0082afa 100755 --- a/gen +++ b/gen @@ -16,4 +16,4 @@ for f in `find wpisy/kronika/20* -name '*.md' | sort -r`; do done echo "" >> wpisy/kronika.html -./ssg5 wpisy dest "19pdh" "https://19.niedzwiedzinski.cyou" +./ssg5 wpisy dest "19 PDH Puszcza" "https://19.niedzwiedzinski.cyou" diff --git a/shell.nix b/shell.nix index 49f5fd9..7a853f4 100644 --- a/shell.nix +++ b/shell.nix @@ -2,5 +2,6 @@ pkgs.mkShell { buildInputs = with pkgs; [ lowdown + httplz ]; } diff --git a/ssg5 b/ssg5 index bd58726..fa5bd4c 100755 --- a/ssg5 +++ b/ssg5 @@ -197,13 +197,12 @@ render_md_files_lowdown() { out="$2/${f%\.md}/index.html" fi - if [ "$(echo $f | cut -d'/' -f 2)" = "kronika" ]; then - echo "
" > $in && \ - lowdown --html-no-skiphtml --html-no-escapehtml "$1/$f" >> $in && \ - echo "
" >> $in - else - lowdown --html-no-skiphtml --html-no-escapehtml "$1/$f" > $in - fi + echo "" > $in + [ "$(echo $f | cut -d'/' -f 2)" = "kronika" ] && echo "
" > $in + # Filter out frontmatter + tail -n +$(($(sed -n '/---/,/---/p' $1/$f | wc -l)+2)) $1/$f | \ + lowdown --html-no-skiphtml --html-no-escapehtml >> $in && \ + [ "$(echo $f | cut -d'/' -f 2)" = "kronika" ] && echo "
" >> $in cat "$in" | render_html_file "$3" \ diff --git a/wpisy/_header.html b/wpisy/_header.html index 075ce32..0bc7f8a 100644 --- a/wpisy/_header.html +++ b/wpisy/_header.html @@ -1,7 +1,7 @@ - 19 PDH Puszcza + -- cgit 1.4.1