diff --git a/bin/jqt b/bin/jqt index 65aa710..e1dec33 100755 --- a/bin/jqt +++ b/bin/jqt @@ -445,6 +445,7 @@ declare -A JSON_DATA_DOT=() YAML_DATA_DOT=() # ._source # ._toc # ._front_matter +# ._version # < stdin > stdout function merge @@ -463,7 +464,7 @@ function merge else echo '(. / "") as [$body, $toc, $css] | { _front_matter: (' yaml2json < $front_matter - echo ")} + { _source: \"${DOCUMENT}\", "'_content: $body, _toc: $toc, _highlight: $css }' + echo ")} + { _version: \"${VERSION}\", _source: \"${DOCUMENT}\", "'_content: $body, _toc: $toc, _highlight: $css }' fi # additional data diff --git a/bin/sake b/bin/sake index 2cf74a0..524acd8 100755 --- a/bin/sake +++ b/bin/sake @@ -26,21 +26,25 @@ declare -xr JQTLIB='/usr/local/share/jqt' # Check project on current directory ######################################################################## -# Sakefile must exist -if test ! -e Sakefile; then - echo 1>&2 "sake: no \`Sakefile\` found." - exit 1 -fi - -# Configuration file must exist -if test -e config.yaml; then - CONFIGURATION_FILE=config.yaml -elif test -e config.json; then - CONFIGURATION_FILE=config.json -else - echo 1>&2 "sake: no \`config.yaml\` or \`config.json\` file found." - exit 1 -fi +declare CONFIGURATION_FILE + +check() { + # Sakefile must exist + if test ! -e Sakefile; then + echo 1>&2 "sake: no \`Sakefile\` found." + exit 1 + fi + + # Configuration file must exist + if test -e config.yaml; then + CONFIGURATION_FILE=config.yaml + elif test -e config.json; then + CONFIGURATION_FILE=config.json + else + echo 1>&2 "sake: no \`config.yaml\` or \`config.json\` file found." + exit 1 + fi +} ######################################################################## # Commands @@ -71,7 +75,25 @@ dag() { } new() { - local name=$1 kind=$2 + local name=$1 skel=$2 + + [[ -d "$name" ]] && { + echo 1>&2 "sake: pathname \`$name\` exists!" + exit 1 + } + case $skel in + basic|blog) + ;; + *) + echo 1>&2 "sake: unknown skeleton \`$skel\`!" + exit 1 + ;; + esac + + #mkdir -p "$name" + #cd "$name" + #cp -r $JQTLIB/skel-$skel/* . + echo 1>&2 "sake: Target \`new\` not implemented." } @@ -92,6 +114,9 @@ alias _sake='exec make "${makeflags[@]}"' # Default command: `build` [[ $# == 0 ]] && set -- build +# Check if != new +[[ $1 == new ]] || check + # Run _sake case $1 in help) help; exit 0 @@ -102,15 +127,15 @@ case $1 in ;; new) shift - name=site kind=simple + name=site skel=basic while (( $# > 0 )); do case "$1" in - name=?*) eval "$1"; shift ;; - kind=?*) eval "$1"; shift ;; + name=?*) name=${1#name=}; shift ;; + skel=?*) skel=${1#skel=}; shift ;; *) break 2 ;; # error? esac done - new $name $kind + new $name $skel exit 0 ;; touch) diff --git a/docs/blocks/logo/markup.html b/docs/blocks/logo/markup.html index 5714735..2cd51fb 100644 --- a/docs/blocks/logo/markup.html +++ b/docs/blocks/logo/markup.html @@ -1,7 +1,7 @@ <####################################################################### # Logo ######################################################################>& - {{site.logo}}v{{site.version}} + {{site.logo}}v<%version> <# vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html #>& diff --git a/docs/blocks/repository/markup.html b/docs/blocks/repository/markup.html index 5bb74db..277a984 100644 --- a/docs/blocks/repository/markup.html +++ b/docs/blocks/repository/markup.html @@ -6,7 +6,7 @@
<%include ../VERSION>
-as you can see in this paragraph and on the top of these pages.
+The MarkDown input content is preprocessed using [GPP][GPP]. All the expected
+options in a preprocessor are available, like defining new macros, include
+other files, etc. For example, a macro call
+like `<%version>` will expand to the <%cite jqt> version (<%version>
)
+as you can see in this paragraph.
#### Macro calls
diff --git a/docs/content/data.md b/docs/content/data.md
index 32cf44c..1cb3b92 100644
--- a/docs/content/data.md
+++ b/docs/content/data.md
@@ -62,6 +62,7 @@ are provided:
* `._highlight`: CSS styles for highlighted code.
* `._source`: the input document pathname as provided to `jqt`.
* `._toc`: the rendered input document table of contents.
+* `._version`: <%cite jqt> installed version.
Additional JSON files can be provided and are merged with front matter metadata
to be the `jq` input in the render stage.
diff --git a/docs/content/index.md b/docs/content/index.md
index 32d55d1..60598f6 100644
--- a/docs/content/index.md
+++ b/docs/content/index.md
@@ -10,7 +10,7 @@ Dependencies: [content/EXAMPLE.txt]
<%include content/macros.m>&
<%include content/LINKS.txt>&
-# Welcome
+# Welcome to <%cite jqt>