diff --git a/Makefile b/Makefile index 24e11b6..fbcd370 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,9 @@ SHELL := /bin/bash # exits with a nonzero exit status. .DELETE_ON_ERROR: +# Debug utility +print-%: ; @echo $* = $($*) + ######################################################################## # Targets and variables ######################################################################## @@ -145,40 +148,28 @@ list: echo ' datadir = $(datadir)'; \ echo ' mandir = $(mandir)' -######################################################################## -# Generate help text -######################################################################## - -# Independent target: helps generating text for `jqt -h` -# Needs explicit call: `make /tmp/help` -/tmp/help: $(CONTENT)/help.text - $(info ==> $@) - jqt -P MarkDown -I$(DOCS) < $< \ - | pandoc --from markdown --to plain - \ - | sed '1,7b;/^$$/d;s/_\([A-Z]\+\)_/\1/g;/^[^A-Z]/s/^/ /' \ - > $@ - -clean:: ; @rm -f /tmp/help - ######################################################################## # Generate man page for jqt ######################################################################## -# gpp for the man page (to be build without calling jqt!) +# gpp for the man page (to be built without calling jqt!) GPP_MD := gpp \ -U '<%' '>' '\B' '\B' '\W>' '<' '>' '$$' '' \ -M '<%' '>' '\B' '\B' '\W>' '<' '>' \ +sccc '&\n' '' '' \ - +sccc '\\n' '' '' \ - +sccc '<\#' '\#>\n' '' \ + +sccc '<\#' '\#>' '' \ +siqi "'" "'" '\' \ +siQi '"' '"' '\' \ +ssss '' '' \ +ssss '`' '`' '' \ +ssss '\n```' '\n```' '' \ +ssss '\n~~~' '\n~~~' '' \ + -I${datadir}/jqt \ + --nostdinc \ + --include lib.md.m # Man page: jqt(1) sake(1) +jqt.1.gz: $(CONTENT)/opt/*.txt $(ManPages): %.1.gz : $(CONTENT)/%.1.text $(info ==> $@) @$(GPP_MD) -I$(DOCS) < $< \ diff --git a/bin/sake b/bin/sake index 82f957e..2cf74a0 100755 --- a/bin/sake +++ b/bin/sake @@ -53,17 +53,16 @@ list() { sort --unique | sed 's/:\+$//' | pr --omit-pagination --width=50 --columns=4 --across -} +} 1>&2 help() { echo 'Usage: sake [command] [[options] [variable=definition] ...]' echo -e '\nCommands, builtin and user defined:\n' list echo -e '\nSee the manpage for full documentation.' -} +} 1>&2 -dag() -{ +dag() { make -f Sakefile -Bdn \ | sed -n \ -e "s/'//g" \ @@ -71,8 +70,7 @@ dag() -e 's/Considering target file //p' } -new() -{ +new() { local name=$1 kind=$2 echo 1>&2 "sake: Target \`new\` not implemented." } @@ -96,11 +94,11 @@ alias _sake='exec make "${makeflags[@]}"' # Run _sake case $1 in - help) help + help) help; exit 0 ;; - list) list + list) list; exit 0 ;; - dag) dag + dag) dag; exit 0 ;; new) shift @@ -113,6 +111,7 @@ case $1 in esac done new $name $kind + exit 0 ;; touch) touch $CONFIGURATION_FILE diff --git a/docs/content/content.md b/docs/content/content.md index 08d84d9..0807f71 100644 --- a/docs/content/content.md +++ b/docs/content/content.md @@ -201,7 +201,7 @@ is, the ampersand and the newline are removed and effectively ignored). variant, with the title block extension disabled, and produces by default transitional HTML. When running `jqt` all long options specified in the command line will be forwarded -untouched to `pandoc`, but some are reserved or have no meaning. +untouched to `pandoc` (as for example with `--help`), but some are reserved or have no meaning. <%cite Pandoc> options used internally by <%cite jqt> (do not play with them): diff --git a/docs/content/engine.md b/docs/content/engine.md index 542a103..961c1d6 100644 --- a/docs/content/engine.md +++ b/docs/content/engine.md @@ -52,27 +52,41 @@ arguments. The usage possibilities are: ### Options -<%include content/opt/4.txt> -<%include content/opt/C.txt> +#### Preprocessor options + <%include content/opt/D.txt> -<%include content/opt/d.txt> -<%include content/opt/e.txt> -<%include content/opt/H.txt> -<%include content/opt/h.txt> <%include content/opt/I.txt> +<%include content/opt/P.txt> + +#### Template options + +<%include content/opt/L.txt> <%include content/opt/i.txt> <%include content/opt/j.txt> -<%include content/opt/L.txt> + +#### Document options + +<%include content/opt/4.txt> +<%include content/opt/d.txt> +<%include content/opt/w.txt> + +#### Data options + <%include content/opt/M.txt> <%include content/opt/m.txt> -<%include content/opt/P.txt> -<%include content/opt/p.txt> -<%include content/opt/r.txt> -<%include content/opt/S.txt> <%include content/opt/T.txt> -<%include content/opt/t.txt> + +#### Debugging options + +<%include content/opt/C.txt> +<%include content/opt/H.txt> +<%include content/opt/S.txt> + +#### Information options + +<%include content/opt/h.txt> +<%include content/opt/p.txt> <%include content/opt/V.txt> -<%include content/opt/w.txt> ## Preprocessing diff --git a/docs/content/help.text b/docs/content/help.text deleted file mode 100644 index b3f1933..0000000 --- a/docs/content/help.text +++ /dev/null @@ -1,48 +0,0 @@ -jqt - jq based web template engine [version <%include ../VERSION>] - -Usage: jqt [-h | --help | -p | -V | --version] - jqt [options] < infile > result\ - jqt [options] infile > result\ - jqt [options] infile result - -Preprocessor options: - -<%include content/opt/D.txt> -<%include content/opt/I.txt> -<%include content/opt/P.txt> - -Template options: - -<%include content/opt/L.txt> -<%include content/opt/i.txt> -<%include content/opt/j.txt> - -Document options: - -<%include content/opt/4.txt> -<%include content/opt/d.txt> -<%include content/opt/w.txt> - -Data options: - -<%include content/opt/M.txt> -<%include content/opt/m.txt> -<%include content/opt/T.txt> - -Debugging options: - -<%include content/opt/C.txt> -<%include content/opt/H.txt> -<%include content/opt/S.txt> - -Information options: - -<%include content/opt/h.txt> -<%include content/opt/p.txt> -<%include content/opt/V.txt> - -See the manpage for full documentation and more options. - -<# -vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown -#> diff --git a/docs/content/jqt.1.text b/docs/content/jqt.1.text index 149182e..69430f2 100644 --- a/docs/content/jqt.1.text +++ b/docs/content/jqt.1.text @@ -8,7 +8,7 @@ # SYNOPSIS -| **jqt** [**-h** | **--help** | **-p** | **-V** | **--version**] +| **jqt** [**-h** | **-p** | **-V** ] | **jqt** [options] < infile > result | **jqt** [options] infile > result | **jqt** [options] infile result @@ -21,6 +21,7 @@ where HTML is mixed with **jq** snippets to implement the transformation logic. # OPTIONS +<%include content/macros.m>& <%include content/opt/4.txt> <%include content/opt/C.txt> <%include content/opt/D.txt> diff --git a/docs/content/opt/L.txt b/docs/content/opt/L.txt index f973ae9..62f8568 100644 --- a/docs/content/opt/L.txt +++ b/docs/content/opt/L.txt @@ -1,5 +1,5 @@ -L DIRECTORY -: Appends *DIRECTORY* to the end of the _jq_ list of directories to be searched +: Appends *DIRECTORY* to the end of the <%cite jq> list of directories to be searched for included and imported modules. <# vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown diff --git a/docs/content/opt/S.txt b/docs/content/opt/S.txt index 73b4e21..ac6b000 100644 --- a/docs/content/opt/S.txt +++ b/docs/content/opt/S.txt @@ -1,5 +1,5 @@ -S -: Stops template processing before the render stage (outputs the _jq_ script). +: Stops template processing before the render stage (outputs the <%cite jq> script). <# vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown #> diff --git a/docs/content/opt/i.txt b/docs/content/opt/i.txt index 2ed64c0..0acecb5 100644 --- a/docs/content/opt/i.txt +++ b/docs/content/opt/i.txt @@ -1,5 +1,5 @@ -i MODULE -: Includes the _jq_ *MODULE* in the render stage. +: Includes the <%cite jq> *MODULE* in the render stage. <# vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown #> diff --git a/docs/content/opt/j.txt b/docs/content/opt/j.txt index 80f31a1..e0143a5 100644 --- a/docs/content/opt/j.txt +++ b/docs/content/opt/j.txt @@ -1,5 +1,5 @@ -j NAME:MODULE -: Imports the _jq_ *MODULE* in the render stage and define helper function +: Imports the <%cite jq> *MODULE* in the render stage and define helper function named *NAME* if *MODULE* is a data module and has the suffix `.json`. <# vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown