Skip to content

Commit

Permalink
Removed dot for page
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Dec 2, 2018
1 parent 31f7695 commit 40da1b4
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 44 deletions.
13 changes: 7 additions & 6 deletions bin/jqt
Original file line number Diff line number Diff line change
Expand Up @@ -269,24 +269,25 @@ function convert
echo '# vim:tabstop=2:syntax=jq'

# jq modules
for module in ${!INCLUDES[@]}; do
echo "include \"${INCLUDES[$module]}\";"
done
for module in ${!IMPORTS[@]}; do
# remove .json suffix if present
local basename="${IMPORTS[$module]}"
basename=${basename%.json}
echo "import \"${basename}\" as \$${module};"
done

# $jqt as a global reference to '.'
echo '. as $jqt |'
for module in ${!INCLUDES[@]}; do
echo "include \"${INCLUDES[$module]}\";"
done

# define helper functions for JSON modules
for module in ${!IMPORTS[@]}; do
[[ ${IMPORTS[$module]} == *.json ]] || continue
echo "def ${module}: \$${module}::${module}[0];"
done

# $jqt as a global reference to '.'
echo '. as $jqt |'

# convert template to script
sed -e '
:RAW
Expand Down
2 changes: 1 addition & 1 deletion docs/Sakefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ifdef __build
#JQTFLAGS += ...

# Add some Pandoc options
JQTFLAGS += -5 --toc-depth=4
JQTFLAGS += -5 --toc-depth=4 #-S

########################################################################
# experimental
Expand Down
2 changes: 1 addition & 1 deletion docs/blocks/content/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Content
######################################################################>&
<article class="$content">
{{._content}}
{{$jqt._content}}
</article>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
Expand Down
12 changes: 1 addition & 11 deletions docs/blocks/filters.jq
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,13 @@
# Extra filters for this site
#

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

# Remove XML tags
def striptags:
# warning: algorithm too simplistic
gsub("<[^>]*>"; "")
;

#def site: $site::site[0];
#def pages: $pages::pages[0];

#def pages($section):
# [$pages::pages[0][] | select(.Section=="blog")]
#;

def sections($pages):
def sections:
# . as $pages
map(.section)
| unique
Expand Down
6 changes: 3 additions & 3 deletions docs/blocks/menu-bar/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
######################################################################>&
<ol class="menu-bar">
{% site.menu[] %}
<li class='menu-bar__item {{if .==$jqt.page.Id then "menu-bar__item_current" else "" end}}'>
{% (. as $id | pages[] | select($id == .Id)) as $page %}
<a href="{{$jqt.page.Base}}{{$page.URL}}">{{$page.name}}</a>
<li class='menu-bar__item {{if .==page.Id then "menu-bar__item_current" else "" end}}'>
{% (. as $id | pages[] | select($id == .Id)) as $p %}
<a href="{{page.Base}}{{$p.URL}}">{{$p.name}}</a>
{% end %}
</li>
{% end %}
Expand Down
1 change: 1 addition & 0 deletions docs/blocks/repository/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +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>
</ol>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
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 @@ -3,7 +3,7 @@
######################################################################>&
<nav class="#panel -side-right toc">
<p class="toc__title">{{.snippets."toc-title"}}</p>
{{._toc}}
{{$jqt._toc}}
</nav>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
Expand Down
14 changes: 7 additions & 7 deletions docs/content/EXAMPLE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
#>&

```
<html lang='{{.page.lang//.site.lang}}'>
<html lang='{{page.lang//site.lang}}'>
<head>
<title>{{.page.title | gsub("<[^>]*>"; "")}}</title>
<title>{{page.title | gsub("<[^>]*>"; "")}}</title>
{# include files in preprocessing stage: #}
<%include "head.html">
<meta name="generator" content="jqt v{{.site.version}}"/>
<meta name="generator" content="jqt v{{site.version}}"/>
{# optional line: #}
<meta name='dcterms.modified' content='{{.page.updated//empty}}' />
<meta name='dcterms.modified' content='{{page.updated//empty}}' />
{# implicit loop for all authors: #}
{% .page.author | sort[] %}<meta name='author' content='{{.}}' />
{% page.author | sort[] %}<meta name='author' content='{{.}}' />
</head>
<body>
<h1>{{.page.title}}</h1>
<h1>{{page.title}}</h1>
<div id="CONTENT">
{{.page._content}}
{{page._content}}
</div>
{# macro calls: #}
<%partial analytics 'UA-82432866-1'>
Expand Down
5 changes: 3 additions & 2 deletions docs/content/opt/j.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-j MODULE:NAME
: Imports the jq *MODULE* in the render stage.
-j NAME:MODULE
: Imports the jq *MODULE* in the render stage and define helper function
named *NAME* if *MODULE* has the suffix `.json`.
<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
4 changes: 2 additions & 2 deletions docs/content/structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ you can put this conditional macro call to define a default title block:

```
<%ifndef HEAD_TITLE>
<title>{{.page.title}}</title> {# default block #}
<title>{{page.title}}</title> {# default block #}
<%else><%call HEAD_TITLE><%endif>
```

Expand All @@ -118,7 +118,7 @@ before include the base template:

```
<%define HEAD_TITLE
<title>{{.page.title}} – {{.site.title}}</title>
<title>{{page.title}} – {{site.title}}</title>
>
<%include default.html>
```
Expand Down
18 changes: 9 additions & 9 deletions docs/layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<# 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
#>
<meta charset="utf-8" />
<# Document title and related metadata #>
<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[]}}' />
<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[]}}' />
<# More metadata #>
<meta name="generator" content="jqt v{{site.version}}" />
<meta name='dcterms.date' content='{{.page.updated//empty}}' />
<meta name='dcterms.date' content='{{page.updated//empty}}' />
<# Presentation #>
<link rel="shortcut icon" href="{{.page.Base}}favicon.ico"/>
<link rel="shortcut icon" href="{{page.Base}}favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<link rel="stylesheet" type="text/css" href="{{.page.Base}}styles.css"/>
{{._highlight}}
<link rel="stylesheet" type="text/css" href="{{page.Base}}styles.css"/>
{{$jqt._highlight}}
</head>
<#
# Document body
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 @@ -35,7 +35,7 @@ def flags:
;

def page:
" -mpage:\($Meta)/pages/\(.Id).json"
" -jpage:pages/\(.Id).json"
;

# %.html: _site/%.html ;
Expand Down

0 comments on commit 40da1b4

Please sign in to comment.