Skip to content

Commit

Permalink
General edition
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Mar 30, 2017
1 parent 07fd553 commit 979c380
Show file tree
Hide file tree
Showing 21 changed files with 114 additions and 105 deletions.
5 changes: 2 additions & 3 deletions docs/blocks/body/markup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#######################################################################
# Body
######################################################################>
######################################################################>&
<main class="#body">
<%ifndef BODY_BLOCK>&
<%include blocks/content/markup.html>&
Expand All @@ -10,5 +10,4 @@
</main>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>

#>&
5 changes: 2 additions & 3 deletions docs/blocks/content/markup.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<#######################################################################
# Content
######################################################################>
######################################################################>&
<article class="$content">
{{.page._content}}
</article>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>

#>&
5 changes: 2 additions & 3 deletions docs/blocks/footer/markup.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<#######################################################################
# Footer
######################################################################>
######################################################################>&
<footer class="#footer">
<%include blocks/license/markup.html>&
<%include blocks/repository/markup.html>&
</footer>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>

#>&
5 changes: 2 additions & 3 deletions docs/blocks/header/markup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#######################################################################
# Header
######################################################################>
######################################################################>&
<header class="#header">
<nav>
<%include blocks/logo/markup.html>&
Expand All @@ -9,5 +9,4 @@
</header>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>

#>&
4 changes: 2 additions & 2 deletions docs/blocks/license/markup.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<#######################################################################
# License
######################################################################>
######################################################################>&
<section class="license">
{{.snippets.footer}}
</section>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>
#>&
5 changes: 2 additions & 3 deletions docs/blocks/logo/markup.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<#######################################################################
# Logo
######################################################################>
######################################################################>&
<span class="logo"><a href="index.html">{{.site.logo}}</a><span class="logo__version">v<%include ../VERSION></span></span>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>

#>&
6 changes: 3 additions & 3 deletions docs/blocks/menu-bar/markup.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<#######################################################################
# Menu Bar
######################################################################>
######################################################################>&
<ol class="menu-bar">
{% .site.menu[] %}
<li class='menu-bar__item {{if .path==$M.page._path then "menu-bar__item--current" else "" end}}'>
<li class='menu-bar__item {{if .path==$M.page._path then "menu-bar__item_current" else "" end}}'>
<a href="{{.URL}}">{{.name}}</a>
</li>
{% end %}
</ol>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>
#>&
5 changes: 2 additions & 3 deletions docs/blocks/repository/markup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#######################################################################
# Repository
######################################################################>
######################################################################>&
<ol class="repository">
<li class="repository__section"><a href="https://github.com/fadado/jqt">code</a></li>
<li class="repository__section"><a href="https://github.com/fadado/jqt/issues">issues</a></li>
Expand All @@ -9,5 +9,4 @@
</ol>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>

#>&
5 changes: 2 additions & 3 deletions docs/blocks/toc/markup.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<#######################################################################
# Toc
######################################################################>
######################################################################>&
<nav class="#panel -side-right toc">
<p class="toc__title">{{.snippets."toc-title"}}</p>
{{.page._toc}}
</nav>
<#
vim:ts=2:sw=2:ai:et:fileencoding=utf8:syntax=html
#>

#>&
13 changes: 7 additions & 6 deletions docs/content/EXAMPLE.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
<#
# Template example
#>
#>&

```html
```
<html lang='{{.page.lang//.site.lang}}'>
<head>
<title>{{.page.title | gsub("<[^>]*>"; "")}}</title>
{# include files in preprocessing stage #}
{# include files in preprocessing stage: #}
<%include "head.html">
<meta name="generator" content="jqt v<%include "../VERSION">"/>
{# optional line #}
{# optional line: #}
<meta name='dcterms.modified' content='{{.page.updated//empty}}' />
{# implicit loop for all authors #}
{# implicit loop for all authors: #}
{% .page.author | sort[] %}<meta name='author' content='{{.}}' />
</head>
<body>
<h1>{{.page.title}}</h1>
<div id="CONTENT">
{{.page._content}}
</div>
{# macro calls: #}
<%partial analytics 'UA-82432866-1'>
</body>
</html>
```

<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
#>&
10 changes: 5 additions & 5 deletions docs/content/FLOW.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#
# Flow diagram
#>
#>&

<figure style="margin:0; padding:0;clear:both;">
<figcaption style="text-align:center; font-weight: bold;">jqt workflow</figcaption>
Expand All @@ -17,14 +17,14 @@ Document +----------->|expand|-->|markup|--+ |merge|-------->|render|--
metadata | |
JSON +------+ | |
+----------->|expand|-------------------------+ |
Data YAML +------+ |
+-------------------------------------------------+
YAML snippets +------+ |
Data YAML +------+ | CSS +------+
+-------------------------------------------------+ +---->|expand|------> Style
YAML snippets +------+ | +------+
+---------------------->|markup|------------------+
+------+
```
</figure>

<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
#>&
4 changes: 2 additions & 2 deletions docs/content/LINKS.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#
# Global links
#>
#>&

[JQT]: https://fadado.github.io/jqt/
[JQ]: https://stedolan.github.io/jq/
Expand All @@ -17,4 +17,4 @@

<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
#>&
25 changes: 13 additions & 12 deletions docs/content/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ _MarkDown_ promises and delivers exactly this.
## General operation

_jqt_ transforms [MarkDown][MARKDOWN] documents to HTML using Pandoc,
but before that [GPP][GPP] is used to preprocess them. Pandoc's output
but before that [`gpp`][GPP] is used to preprocess them. Pandoc's output
is then merged with the [YAML][YAML] front matter metadata and other input data before be sended
to the render stage. This is described on the middle of this diagram:

Expand Down Expand Up @@ -60,7 +60,8 @@ file in the scalar `.page._path`.
<details>

<summary>
`jqt` `-T` option allows the use of YAML files for collections of MarkDown snippets:
_jqt_ offers also a transformation that can also be considered a kind of preprocessing.
The option `-T` allows the use of YAML files for collections of MarkDown snippets:
</summary>

<%include content/opt/T.txt>
Expand Down Expand Up @@ -96,21 +97,21 @@ 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,
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 he string <code><%include "../VERSION"></code>
as you can see in this paragraph and on the top of these pages.

#### Macro calls

All the power of GPP is available to help you when
All the power of [GPP][GPP] is available to help you when
[transcluding](https://en.wikipedia.org/wiki/Wikipedia:Transclusion)
the input MarkDown document. The macro syntax used by _jqt_ in templates and input documents
precedes macro names with the characters `<%` and finishes the macro calls with
the character `>`.
Here are some of the predefined macros:

```HTML
```
<%defeval x y>
<%define x y>
<%elif expr>
Expand All @@ -126,18 +127,18 @@ Here are some of the predefined macros:
<%undef x>
```

Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.),
but named arguments are also possible:
Inside macro definitions parameters are prefixed by a dollar (`$1`, `$2`, etc.),
but named parameters are also possible:

```HTML
```
<%define sc
<span style="font-variant:small-caps;">$1</span>
>
```

Predefined macros and user define macros have the same call sequence:

```HTML
```
<%include content/LINKS.txt>
<%sc 'A title in small caps'>
```
Expand All @@ -149,7 +150,7 @@ Warning: you must see the [GPP manual][GPPMAN] if you want to know all the gory
Some fragments of text are skipped during macro expansion, like comments,
continuation lines and arbitrary but delimited strings of characters:

```HTML
```
<# Block comments, removed, must end in newline (also removed) #>
Continuation lines using an ampersand &
just before the newline character
Expand All @@ -159,7 +160,7 @@ _Strings_ are copied to the output, but evaluation of macros inside strings can
be enabled or disabled depending on the type of string. Also, string delimiters can
be copied, or not, to the output:

~~~HTML
~~~
<!-- XML comments -->
<%sc 'Single quoted strings, only available in user defined macro calls'>
<%sc "Double quoted strings, only available in user defined macro calls">
Expand Down Expand Up @@ -193,7 +194,7 @@ is, the ampersand and the newline are removed and effectively ignored).

### Pandoc’s Markdown

_jqt_ accept as input format the [Pandoc's MarkDown](http://pandoc.org/MANUAL.html#pandocs-markdown)
_jqt_ accept as input format for documents the [Pandoc's MarkDown](http://pandoc.org/MANUAL.html#pandocs-markdown)
variant, with the <a href="http://pandoc.org/MANUAL.html#extension-pandoc_title_block">title block extension</a>
disabled, and produces by default transitional HTML. When running `jqt` the following
Pandoc long options can be specified in
Expand Down
14 changes: 8 additions & 6 deletions docs/content/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ data and influence JSON preprocessing:

## Data formats

_jqt_ accepts metadata in [YAML][YAML] and [JSON][JSON] formats.

### YAML and JSON

Documents front matter metadata and additional input YAML files are converted to
Expand All @@ -64,14 +66,14 @@ to be the `jq` input in the render stage.

### Preprocessing

JSON files are preprocessed using [GPP][GPP], and all the expected options in a
JSON files are preprocessed using [`gpp`][GPP], and all the expected options in a
preprocessor are available, like defining new macros, include other files, etc.
CSS files are also preprocessed with the same macros syntax used in JSON files.

#### Macro calls

The macro syntax used by _jqt_ in JSON and CSS files is very similar to the syntax used by the traditional
TeX language macro processor, but changing the prefix character `\\` by `&`.
TeX language macro processor, but changing the prefix character `\` by `&`.
Here are some of the predefined macros:

```
Expand All @@ -90,19 +92,19 @@ Here are some of the predefined macros:
&undef{x}
```

Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.),
but named arguments are also possible.
Inside macro definitions numeric parameters are prefixed by a dollar (`$1`, `$2`, etc.),
but named parameters, prefixed with the `&` character, are also possible.
The more used features are the inclusion on external files and the definition of simple constants:

```JSON
```
// JSON example
&define{eur}{\u20AC}
&define{price}{$1 &euro}
{ "price": "&price{100}" }
```

```CSS
```
// CSS example
&include{theme.css}
&define{Blue}{#0000FF}
Expand Down
Loading

0 comments on commit 979c380

Please sign in to comment.