Skip to content

Commit

Permalink
Man page ok
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Aug 16, 2016
1 parent 731d2e1 commit 0a8f21b
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 63 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project := jqt
prefix ?= /usr/local
bindir ?= $(prefix)/bin
datadir ?= $(prefix)/share
mandir ?= $(prefix)/share/man

########################################################################
# Prerequisites
Expand Down Expand Up @@ -103,11 +104,14 @@ clobber: clean
install:
test -d $(bindir) || $(SUDO) mkdir --verbose --parents $(bindir)
test -d $(datadir)/$(project) || $(SUDO) mkdir --verbose --parents $(datadir)/$(project)
test -d $(mandir)/man1 || $(SUDO) mkdir --verbose --parents $(mandir)/man1
$(SUDO) install --verbose --compare --mode 555 bin/* $(bindir)
$(SUDO) install --verbose --compare --mode 644 share/* $(datadir)/$(project)
$(SUDO) install --verbose --compare --mode 644 jqt.1.gz $(mandir)/man1

uninstall:
$(SUDO) rm --verbose --force -- $(addprefix $(prefix)/,$(wildcard bin/*))
$(SUDO) rm --verbose --force -- $(mandir)/man1/jqt.1.gz
test -d $(datadir)/$(project) \
&& $(SUDO) rm --verbose --force --recursive $(datadir)/$(project) \
|| true
Expand Down
79 changes: 19 additions & 60 deletions bin/jqt
Original file line number Diff line number Diff line change
Expand Up @@ -439,74 +439,31 @@ function help
{
cat <<'EOF'
jqt - jq based web template engine [version 0.1.0]
Usage: jqt [options] < infile > result
jqt [options] infile > result
jqt [options] infile result
Preprocessor options:
-D NAME=VAL
Define the user macro NAME as equal to VAL.
-I DIRECTORY
Append DIRECTORY to the end of the preprocessor list of
directories to be searched for include files.
Template options:
-L DIRECTORY
Append DIRECTORY to the end of the jq list of directories to be
searched for included and imported modules.
-i MODULE
Include the jq MODULE in the render stage.
-j MODULE:NAME
Import the jq MODULE in the render stage.
Document options:
-4, -5
Set output HTML version (HTML4 / HTML5).
-d FILE
Read content document from FILE.
jqt [options] infile > result
jqt [options] infile result
Some of the options include:
Preprocessor options: Debugging options:
-D NAME=VAL -C
-I DIRECTORY -E
Template options: -H
-L DIRECTORY -P
-i MODULE -S
-j MODULE:NAME Information options:
Document options: -h, --help
-4, -5 -p
-d FILE -V, --version
Metadata options:
-M NAME:FILE
Add a FILE in YAML or JSON format to the input metadata at the top
level (NAME is ignored but must be present and unique).
-m NAME:FILE
Add a FILE in YAML or JSON format to the input metadata as a value
of object NAME.
Debugging options:
-C
Stops processing before the render stage (outputs full JSON data
model).
-E
Stops template processing after the preprocessing stage (outputs the
expanded template).
-H
Stops MarkDown processing after generating HTML (outputs several
HTML fragments).
-P
Stops MarkDown processing after preprocessing stage (outputs the
expanded MarkDown).
-S
Stops template processing before the render stage (outputs the jq
script).
Information options:
-h, --help
Display this message.
-p
Print list of Pandoc accepted options.
-V
Display version information.
See the manpage for full documentation and more options.
EOF
exit 0
}

# Not documented:
#
#?Document options:
#? -e
#? -r
#? -t
#?Metadata options:
#? -f NAME
#? -n NAME

function pandoc_options
{
cat <<EOF
Expand Down Expand Up @@ -654,6 +611,8 @@ while getopts :hVD:ESI:L:i:j:PHp45d:ertCf:n:m:M:-: opt; do
# Generic options
help) help
;;
version) echo "$SELF $VERSION"; exit 0
;;
# Pandoc options:
base-header-level=*) PANDOC_OPTS[${#PANDOC_OPTS[@]}]="--$OPTARG";;
bibliography=*) PANDOC_OPTS[${#PANDOC_OPTS[@]}]="--$OPTARG";;
Expand Down
14 changes: 12 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ COMMON := \
# Files to "build"
ASSETS := README.md jqt.css
PAGES := engine document metadata template
TARGETS := $(foreach f,$(ASSETS) $(foreach p,index $(PAGES),$(p).html),$(DESTINATION)/$(f))
MANPAGE := ../jqt.1.gz
TARGETS := \
$(MANPAGE) \
$(foreach f,$(ASSETS),$(DESTINATION)/$(f)) \
$(foreach f,$(foreach p,index $(PAGES),$(p).html),$(DESTINATION)/$(f))

########################################################################
# Rules
Expand Down Expand Up @@ -172,14 +176,20 @@ $(DESTINATION)/jqt.css: $(PRESENTATION)/jqt.css $(PRESENTATION)/github.css
| sed '1,7b;/^$$/d;s/_\([A-Z]\+\)_/\1/g;/^[^A-Z]/s/^/ /' \
> $@

# Man page
$(MANPAGE): $(CONTENT)/jqt.1.md
$(MPMD) -I. -I$(CONTENT) $< \
| pandoc --standalone --from markdown --to man \
| gzip > $@

########################################################################
# Utilities
########################################################################

.PHONY: clean clobber build

clean:
rm -rf $(DESTINATION)/*
rm -rf $(DESTINATION)/* $(MANPAGE)

clobber:
rm -rf $(DESTINATION) $(CACHE)
Expand Down
1 change: 1 addition & 0 deletions docs/content/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ Information options:
<%include "opt/p.md">
<%include "opt/V.md">

See the manpage for full documentation and more options.
75 changes: 75 additions & 0 deletions docs/content/jqt.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
% JQT(1) Version <%include ../VERSION> | jq based web template engine
%
% Aug 2016

# NAME

**jqt** – jq based web template engine

# SYNOPSIS

| **jqt** \[options] < infile > result
| **jqt** \[options] infile > result
| **jqt** \[options] infile result
| **jqt** \[**-h**|**--help**|**-V**|**--version**]

# DESCRIPTION

**jqt** orchestrates several shell utilities to transform MarkDown text and
YAML or JSON data into a final HTML document. The transformation is driven by a template,
where HTML is mixed with **jq** snippets to implement the transformation logic.

# OPTIONS

<%include "opt/4.md">
<%include "opt/C.md">
<%include "opt/D.md">
<%include "opt/E.md">
<%include "opt/H.md">
<%include "opt/I.md">
<%include "opt/L.md">
<%include "opt/M.md">
<%include "opt/P.md">
<%include "opt/S.md">
<%include "opt/V.md">
<%include "opt/d.md">
<%include "opt/e.md">
<%include "opt/f.md">
<%include "opt/h.md">
<%include "opt/i.md">
<%include "opt/j.md">
<%include "opt/m.md">
<%include "opt/n.md">
<%include "opt/p.md">
<%include "opt/r.md">
<%include "opt/t.md">

# FILES

/usr/local/share/jqt/libjqt.m
: Initialization file for `gpp`.

/usr/local/share/jqt/libjqt.jqt
: Initialization files for `jq`.

/usr/local/share/jqt/\*.m
: Macro example files for `gpp`.

# BUGS

See GitHub issues: <https://github.com/fadado/jqt/issues>

# AUTHOR

**jqt** was written by Joan Josep Ordinas Rosa <[email protected]>.

# COPYRIGHT

Copyright © 2015 Joan Josep Ordinas Rosa.
**jqt** is licensed under the MIT license (code) and the CC-BY-3.0 license (documents).

# SEE ALSO

**gpp(1)**, **jq(1)**

**jqt** home page: <https://fadado.github.com/jqt/>
2 changes: 1 addition & 1 deletion docs/content/opt/V.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-V
-V, --version
: Display version information.

<#
Expand Down
Binary file added jqt.1.gz
Binary file not shown.

0 comments on commit 0a8f21b

Please sign in to comment.