From bfb2f29feb7cc32f475ff2f1e7221ec912ca8d4d Mon Sep 17 00:00:00 2001 From: Joan Josep Ordinas Rosa Date: Sun, 2 Dec 2018 10:17:08 +0100 Subject: [PATCH] Removed dot for site --- bin/jqt | 12 ++++++++++-- docs/Sakefile | 2 ++ docs/blocks/body/_blog/markup.html | 2 +- docs/blocks/filters.jq | 8 ++++++-- docs/blocks/logo/markup.html | 2 +- docs/blocks/menu-bar/markup.html | 2 +- docs/layouts/default.html | 6 +++--- share/sake.d/phase3.jq | 2 +- share/sake.d/phase3.make | 8 ++++---- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/bin/jqt b/bin/jqt index 93a6f80..ef40be9 100755 --- a/bin/jqt +++ b/bin/jqt @@ -263,7 +263,7 @@ declare -A INCLUDES=() # < stdin > stdout function convert { - local module + local module basename # script preamble echo '# vim:tabstop=2:syntax=jq' @@ -273,12 +273,20 @@ function convert echo "include \"${INCLUDES[$module]}\";" done for module in ${!IMPORTS[@]}; do - echo "import \"${IMPORTS[$module]}\" as $module;" + # remove .json suffix if present + local basename="${IMPORTS[$module]}" + basename=${basename%.json} + echo "import \"${basename}\" as \$${module};" done # $M as a global reference to '.' echo '. as $M |' + # define helper functions for JSON modules + for module in ${!IMPORTS[@]}; do + [[ ${IMPORTS[$module]} == *.json ]] || continue + echo "def ${module}: \$${module}::${module}[0];" + done # convert template to script sed -e ' :RAW diff --git a/docs/Sakefile b/docs/Sakefile index 016ebfb..7fe368e 100644 --- a/docs/Sakefile +++ b/docs/Sakefile @@ -42,6 +42,8 @@ JQTFLAGS += -5 --toc-depth=4 # experimental ######################################################################## +$(PagesHTML): $(Blocks)/filters.jq + depend: $(Meta)/phase3d.make cat $< | egrep -v '^#|^$$' | cut -c -72 - | sed 's/$$/.../' diff --git a/docs/blocks/body/_blog/markup.html b/docs/blocks/body/_blog/markup.html index 76d778f..b6eeb02 100644 --- a/docs/blocks/body/_blog/markup.html +++ b/docs/blocks/body/_blog/markup.html @@ -2,7 +2,7 @@ # Body for blog posts ######################################################################>&
- {% pages[] | select(.Section=="blog") %}<#TODO: sort?#> + {% pages("blog")[] %}
{{.title}}

{{.description}} diff --git a/docs/blocks/filters.jq b/docs/blocks/filters.jq index d0e26b6..1619b10 100644 --- a/docs/blocks/filters.jq +++ b/docs/blocks/filters.jq @@ -3,6 +3,7 @@ # import "pages-by-id" as $pages; +#import "phase1_site" as $site; # Remove XML tags def striptags: @@ -10,8 +11,11 @@ def striptags: gsub("<[^>]*>"; "") ; -def pages: - $pages::pages[0] +#def site: $site::site[0]; +def pages: $pages::pages[0]; + +def pages($section): + [$pages::pages[0][] | select(.Section=="blog")] ; def sections: diff --git a/docs/blocks/logo/markup.html b/docs/blocks/logo/markup.html index d0ecf5a..5714735 100644 --- a/docs/blocks/logo/markup.html +++ b/docs/blocks/logo/markup.html @@ -1,7 +1,7 @@ <####################################################################### # Logo ######################################################################>& - + <# vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html #>& diff --git a/docs/blocks/menu-bar/markup.html b/docs/blocks/menu-bar/markup.html index 2f82321..f1ad3b1 100644 --- a/docs/blocks/menu-bar/markup.html +++ b/docs/blocks/menu-bar/markup.html @@ -2,7 +2,7 @@ # Menu Bar ######################################################################>&