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 ######################################################################>& - + <# 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 @@
  • issues
  • wiki
  • releases
  • -
  • top
  • +
  • top
  • <# vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html diff --git a/docs/blocks/repository/style.css b/docs/blocks/repository/style.css index 3e30fdc..6268a84 100644 --- a/docs/blocks/repository/style.css +++ b/docs/blocks/repository/style.css @@ -13,10 +13,14 @@ font-weight: bold; } -&CHM{repository}{section}{internal} > a:focus { +&BEM{repository}{section} > a:focus { color: &ColorPrimary; } +&BEM{repository}{section} > a:hover { + color: &ColorSecondary; +} + &BEM{repository}{section}:first-child:before { content: "❲ "; color: &ColorSecondary; diff --git a/docs/blocks/toc/style.css b/docs/blocks/toc/style.css index 32ccedb..ad011db 100644 --- a/docs/blocks/toc/style.css +++ b/docs/blocks/toc/style.css @@ -3,7 +3,7 @@ //////////////////////////////////////////////////////////////////////// &BEM{toc} { - max-width: 20em; + max-width: 22em; padding: 0 1em; text-align: center; font-size: 80%; diff --git a/docs/config.yaml b/docs/config.yaml index b354ac4..de7592b 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -25,10 +25,9 @@ Root: /tmp/jqt # Site parameters # -# Site version (same as jqt) -version: 0.5.1 - title: jqt, the jq template engine +title_prefix: jqt +title_delimiter: "·" baseurl: https://fadado.github.com/jqt/ lang: &lang en logo: "❴❴❏❵❵" @@ -48,7 +47,6 @@ menu: defaults: - idprefix: "" # all files properties: - title-prefix: jqt author: *author lang: *lang Layout: page-toc diff --git a/docs/content/404.md b/docs/content/404.md new file mode 100644 index 0000000..f45e9a7 --- /dev/null +++ b/docs/content/404.md @@ -0,0 +1,12 @@ +--- +title: 404 error +Layout: page +--- + +# 404 + +We couldn't find this page. + +<# +vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown +#> diff --git a/docs/content/EXAMPLE.txt b/docs/content/EXAMPLE.txt index 0d3f91a..0d6fec3 100644 --- a/docs/content/EXAMPLE.txt +++ b/docs/content/EXAMPLE.txt @@ -8,7 +8,7 @@ {{page.title | gsub("<[^>]*>"; "")}} {# include files in preprocessing stage: #} <%include "head.html"> - + {# optional line: #} {# implicit loop for all authors: #} @@ -17,7 +17,7 @@

    {{page.title}}

    - {{page._content}} + {{$jqt._content}}
    {# macro calls: #} <%partial analytics 'UA-82432866-1'> diff --git a/docs/content/content.md b/docs/content/content.md index 0807f71..7b996aa 100644 --- a/docs/content/content.md +++ b/docs/content/content.md @@ -100,10 +100,11 @@ and the second does the proper conversion to HTML. ### Preprocessing -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 `<%include "../VERSION">` will expand to the string <%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>