Skip to content

Commit

Permalink
Removed dot for site
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Dec 2, 2018
1 parent e80de34 commit bfb2f29
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 15 deletions.
12 changes: 10 additions & 2 deletions bin/jqt
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ declare -A INCLUDES=()
# < stdin > stdout
function convert
{
local module
local module basename

# script preamble
echo '# vim:tabstop=2:syntax=jq'
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/Sakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/$$/.../'

Expand Down
2 changes: 1 addition & 1 deletion docs/blocks/body/_blog/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Body for blog posts
######################################################################>&
<main class="#body">
{% pages[] | select(.Section=="blog") %}<#TODO: sort?#>
{% pages("blog")[] %}
<div class="post-excerpt">
<a class="post-excerpt__title" href="{{.Base}}{{.URL}}">{{.title}}</a>
<p class="post-excerpt__test">{{.description}}
Expand Down
8 changes: 6 additions & 2 deletions docs/blocks/filters.jq
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
#

import "pages-by-id" as $pages;
#import "phase1_site" as $site;

# Remove XML tags
def striptags:
# warning: algorithm too simplistic
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:
Expand Down
2 changes: 1 addition & 1 deletion docs/blocks/logo/markup.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<#######################################################################
# Logo
######################################################################>&
<span class="logo"><a href="index.html">{{.site.logo}}</a><span class="logo__version">v{{.site.version}}</span></span>
<span class="logo"><a href="index.html">{{site.logo}}</a><span class="logo__version">v{{site.version}}</span></span>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>&
2 changes: 1 addition & 1 deletion docs/blocks/menu-bar/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Menu Bar
######################################################################>&
<ol class="menu-bar">
{% .site.menu[] %}
{% site.menu[] %}
<li class='menu-bar__item {{if .==$M.page.Id then "menu-bar__item_current" else "" end}}'>
{% (. as $id | pages[] | select($id == .Id)) as $page %}
<a href="{{$M.page.Base}}{{$page.URL}}">{{$page.name}}</a>
Expand Down
6 changes: 3 additions & 3 deletions docs/layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<# Top-level page markup #>&
<!DOCTYPE html>
<!-- this document uses polyglot markup (well formed XHTML5) -->
<html id="{{.page.Id}}" xmlns="http://www.w3.org/1999/xhtml" lang="{{.page.lang//.site.lang}}" xml:lang="{{.page.lang//.site.lang}}">
<html id="{{.page.Id}}" xmlns="http://www.w3.org/1999/xhtml" lang="{{.page.lang//site.lang}}" xml:lang="{{.page.lang//site.lang}}">
<head>
<#
# Meta elements
Expand All @@ -11,9 +11,9 @@
<title>jqt · {{.page.title}}</title>
<meta name='description' content='{{.page.description//empty}}' />
<meta name='keywords' content='{{.page.keywords//empty}}' />
<meta name='author' content='{{[(.page.author//.site.author)[].name] | sort[]}}' />
<meta name='author' content='{{[(.page.author//site.author)[].name] | sort[]}}' />
<# More metadata #>
<meta name="generator" content="jqt v{{.site.version}}" />
<meta name="generator" content="jqt v{{site.version}}" />
<meta name='dcterms.date' content='{{.page.updated//empty}}' />
<# Presentation #>
<link rel="shortcut icon" href="{{.page.Base}}favicon.ico"/>
Expand Down
2 changes: 1 addition & 1 deletion share/sake.d/phase3.jq
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def page_rule:
.[] |
"\($Root)/"+.URL+": " + .Source + dependencies,
"\t$(info ==> $@)",
"\t@$(JQT) -d $<" + dataset + flags + page + layout + " | $(DETAILS) > $@"
"\t$(JQT) -d $<" + dataset + flags + page + layout + " | $(DETAILS) > $@"
;

#
Expand Down
8 changes: 4 additions & 4 deletions share/sake.d/phase3.make
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ ifdef __phase_3
#

define JQTFLAGS :=
-msite:$(Meta)/phase1_site.json \
-I./ \
-L$(Meta) \
-L$(Blocks) \
-I./ \
-L$(Meta) \
-L$(Blocks) \
-jsite:phase1_site.json \
-ifilters
endef

Expand Down

0 comments on commit bfb2f29

Please sign in to comment.