Skip to content

Commit

Permalink
Removed dot for snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Dec 3, 2018
1 parent 5c51d01 commit ab85325
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 52 deletions.
2 changes: 1 addition & 1 deletion bin/jqt
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ Usage: jqt [-h | -p | -V ]
Some of the options include:
Preprocessor options Data options
-D NAME=VAL -M NAME:FILE
-D NAME=STRING -M NAME:FILE
-I DIRECTORY -m NAME:FILE
-P LANGUAGE Debugging options
Template options -C
Expand Down
97 changes: 62 additions & 35 deletions bin/sake
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,50 @@ if test ! -e Sakefile; then
fi

# Configuration file must exist
if test ! -e config.yaml && test ! -e config.json; then
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
########################################################################

list() {
make -f Sakefile -np 2>&1 |
grep -v '^[SmM]akefile' |
awk '/^[^ \t.%][-A-Za-z0-9_.]*:/ { print $1 }' |
sort --unique |
sed 's/:\+$//' |
pr --omit-pagination --width=50 --columns=4 --across
}

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.'
}

dag()
{
make -f Sakefile -Bdn \
| sed -n \
-e "s/'//g" \
-e 's/\.$//' \
-e 's/Considering target file //p'
}

new()
{
local name=$1 kind=$2
echo 1>&2 "sake: Target \`new\` not implemented."
}

########################################################################
# Run
########################################################################
Expand All @@ -57,47 +96,35 @@ alias _sake='exec make "${makeflags[@]}"'

# Run _sake
case $1 in
help)
echo 'Usage: sake [command] [[options] [variable=definition] ...]'
echo -e '\nCommands, builtin and user defined:\n'
;& # fall through
list)
make -f Sakefile -np 2>&1 |
grep -v '^[SmM]akefile' |
awk '/^[^ \t.%][-A-Za-z0-9_.]*:/ { print $1 }' |
sort --unique |
sed 's/:\+$//' |
pr --omit-pagination --width=50 --columns=4 --across
[[ $1 == help ]] && {
echo -e '\nSee the manpage for full documentation.'
}
help) help
;;
clober)
shift
_sake clobber "$@"
list) list
;;
config)
shift
_sake configure "$@"
;;
dag)
make -f Sakefile -Bdn \
| sed -n \
-e "s/'//g" \
-e 's/\.$//' \
-e 's/Considering target file //p'
dag) dag
;;
new)
echo 1>&2 "sake: Target \`new\` not implemented."
exit 1
shift
name=site kind=simple
while (( $# > 0 )); do
case "$1" in
name=?*) eval "$1"; shift ;;
kind=?*) eval "$1"; shift ;;
*) break 2 ;; # error?
esac
done
new $name $kind
;;
touch)
if test -e config.yaml; then touch config.yaml; else touch config.json; fi
shift
_sake build "$@"
touch $CONFIGURATION_FILE
shift; _sake build "$@"
;;
clober)
shift; _sake clobber "$@"
;;
config)
shift; _sake configure "$@"
;;
*)
_sake "$@"
*) _sake "$@"
;;
esac

Expand Down
4 changes: 4 additions & 0 deletions docs/blocks/content/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
font-family: "Liberation Mono", "Nimbus Mono L", monospace;
}

&SEL{$content} cite {
font-style: italic;
}

&SEL{$content} .footnotes ol {
list-style-type: decimal;
list-style-position: outside;
Expand Down
2 changes: 1 addition & 1 deletion docs/blocks/license/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License
######################################################################>&
<section class="license">
{{.snippets.footer}}
{{snippets.footer}}
</section>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
Expand Down
2 changes: 1 addition & 1 deletion docs/blocks/repository/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<li class="repository__section"><a href="https://github.com/fadado/jqt/issues">issues</a></li>
<li class="repository__section"><a href="https://github.com/fadado/jqt/wiki">wiki</a></li>
<li class="repository__section"><a href="https://github.com/fadado/jqt/releases">releases</a></li>
<li class="repository__section"><a href="#">top</a></li>
<li class="repository__section -internal"><a href="#">top</a></li>
</ol>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
Expand Down
4 changes: 4 additions & 0 deletions docs/blocks/repository/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
font-weight: bold;
}

&CHM{repository}{section}{internal} > a:focus {
color: &ColorPrimary;
}

&BEM{repository}{section}:first-child:before {
content: "❲ ";
color: &ColorSecondary;
Expand Down
2 changes: 1 addition & 1 deletion docs/blocks/toc/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Toc
######################################################################>&
<nav class="#panel -side-right toc">
<p class="toc__title">{{.snippets."toc-title"}}</p>
<p class="toc__title">{{snippets."toc-title"}}</p>
{{$jqt._toc}}
</nav>
<#
Expand Down
4 changes: 2 additions & 2 deletions docs/content/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ jqt -T -- text.yaml | yaml2json > snippets.json
Then this converted file can be loaded by `jqt` in succesive calls:

```zsh
jqt -m snippets:snippets.json ...
jqt -j snippets:snippets.json ...
```

Template files (only!) can expand the snippets without never containing raw content:

```HTML
<h1>{{.snippets.title}}</h1>
<h1>{{snippets.title}}</h1>
```

This allows the absolute separation of structure and content, as it should be.
Expand Down
4 changes: 2 additions & 2 deletions docs/content/opt/D.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-D NAME=VAL
: Defines the user macro *NAME* as equal to *VAL*.
-D NAME=STRING
: Defines the user macro *NAME* as equal to *STRING*.
<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
2 changes: 1 addition & 1 deletion docs/content/opt/L.txt
Original file line number Diff line number Diff line change
@@ -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 _jq_ list of directories to be searched
for included and imported modules.
<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
Expand Down
2 changes: 1 addition & 1 deletion docs/content/opt/S.txt
Original file line number Diff line number Diff line change
@@ -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 _jq_ script).
<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
2 changes: 1 addition & 1 deletion docs/content/opt/i.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-i MODULE
: Includes the jq *MODULE* in the render stage.
: Includes the _jq_ *MODULE* in the render stage.
<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
4 changes: 2 additions & 2 deletions docs/content/opt/j.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-j NAME:MODULE
: Imports the jq *MODULE* in the render stage and define helper function
named *NAME* if *MODULE* has the suffix `.json`.
: Imports the _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
#>
2 changes: 1 addition & 1 deletion docs/content/opt/p.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-p
: Prints list of Pandoc accepted options.
: Prints information about Pandoc options.
<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
6 changes: 3 additions & 3 deletions share/sake.d/phase3.jq
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def dependencies:

def dataset:
if .Datasets
then " " + ([.Datasets[] | basename | "-m\(.):\($Meta)/\(.).json"] | join(" "))
then " " + ([.Datasets[] | basename | "-j\(.):\(.).json"] | join(" "))
else "" end
;

Expand Down Expand Up @@ -52,11 +52,11 @@ def layout:

# _site/jqt/index.html: content/index.md layouts/page.html content/macros.m content/LINKS.txt content/EXAMPLE.txt
# $(info ==> $@)
# @$(JQT) -d $< -mpage:.meta/pages/index.json layouts/page.html | $(DETAILS) > $@
# @$(JQT) -d $< -jpage:pages/index.json layouts/page.html | $(DETAILS) > $@
# ...
# _site/jqt/blog/2017-04-13-hello.html: content/blog/2017-04-13-hello.md layouts/page.html
# $(info ==> $@)
# @$(JQT) -d $< -mpage:.meta/pages/blog/2017-04-13-hello.json layouts/page.html | $(DETAILS) > $@
# @$(JQT) -d $< -jpage:pages/blog/2017-04-13-hello.json layouts/page.html | $(DETAILS) > $@
def page_rule:
.[] |
"\($Root)/"+.URL+": " + .Source + dependencies,
Expand Down

0 comments on commit ab85325

Please sign in to comment.