-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 05cae2b
Showing
125 changed files
with
3,692 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Output of templates expansion | ||
tests/generated/*.jqe | ||
tests/generated/*.jqs | ||
tests/generated/*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Version 0.2.0: | ||
|
||
|
||
Version 0.1.0 | ||
- Added VERSION and CHANGES files, version bump to v0.1.0 | ||
- Version bump to 0.2.0 | ||
- Added VERSION and CHANGES files, version bump to v0.1.0 | ||
- Finished tool | ||
- Home finished | ||
- New syntax colors | ||
- Index renamed | ||
- Blocks implemented | ||
- Added page for engine | ||
- Finished layout | ||
- menu with logo | ||
- Link to website | ||
- Colorized code and simple TOC | ||
- Fixed: tee input cannot be empty | ||
- Merge branch 'FM' | ||
- Removed -F | ||
- Unified -m -M -F | ||
- Using config.json | ||
- Added 6 conversors: csv, yaml, json | ||
- Better API for metadata | ||
- No front-matter in templates | ||
- It works! | ||
- First doc created! | ||
- Renamed extensions for macro files | ||
- New fifo based implementation | ||
- More complete example | ||
- Standalone jqt | ||
- Expand JSON | ||
- Independent expand | ||
- Merge branch 'unify' | ||
- Unified macro syntax | ||
- Merge branch 'master' into unify | ||
- Merge branch 'top' | ||
- Accept empty documents | ||
- Changed @ by % in data | ||
- Compact markup | ||
- New chart | ||
- Merge branch 'MERGE' | ||
- External file to merge script | ||
- Check some error conditions | ||
- Merge branch 'FM' | ||
- New sync hack | ||
- Better sync | ||
- Bug on subshells fixed | ||
- markup extract YAML | ||
- Full merge | ||
- Full merge 2 | ||
- Full merge 1 | ||
- Finished merge! | ||
- Merge front-end and content | ||
- You cannot have and eat your cake | ||
- Start merge | ||
- Front matter management | ||
- Added YAML options | ||
- Help for Pandoc options | ||
- Sorted pandoc options | ||
- Better documentation. | ||
- Going to prepare content | ||
- Created jqt | ||
- Content is now optional | ||
- Better render interface | ||
- Refactoring for unification (1) | ||
- Integrated entities | ||
- Added expand tests | ||
- Makefile defined | ||
- In principio | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
jqt is copyright (c) 2016 Joan Josep Ordinas Rosa | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
||
jqt's documentation (everything found under the docs/ subdirectory in | ||
the source tree) is licensed under the Creative Commons CC BY 3.0 | ||
license, which can be found at: | ||
|
||
https://creativecommons.org/licenses/by/3.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# jqt management | ||
# | ||
|
||
project=jqt | ||
|
||
include make.d/config.make | ||
include make.d/debug.make | ||
|
||
######################################################################## | ||
# Parameters (redefine as you like) | ||
######################################################################## | ||
|
||
prefix ?= /usr/local | ||
bindir ?= $(prefix)/bin | ||
datadir ?= $(prefix)/share | ||
|
||
######################################################################## | ||
# Rules | ||
######################################################################## | ||
|
||
# Configure tools | ||
include make.d/setup.make | ||
|
||
# Default target | ||
all: check | ||
|
||
######################################################################## | ||
# Utilities | ||
######################################################################## | ||
|
||
.PHONY: clean clobber install uninstall | ||
|
||
clean: | ||
rm -f tests/generated/* | ||
|
||
clobber: clean | ||
|
||
install: | ||
test -d $(bindir) || $(SUDO) mkdir --verbose --parents $(bindir) | ||
test -d $(datadir)/$(project) || $(SUDO) mkdir --verbose --parents $(datadir)/$(project) | ||
$(SUDO) install --verbose --compare --mode 555 bin/* $(bindir) | ||
$(SUDO) install --verbose --compare --mode 644 share/* $(datadir)/$(project) | ||
|
||
uninstall: | ||
$(SUDO) rm --verbose --force -- $(addprefix $(prefix)/,$(wildcard bin/*)) | ||
test -d $(datadir)/$(project) \ | ||
&& $(SUDO) rm --verbose --force --recursive $(datadir)/$(project) \ | ||
|| true | ||
|
||
# Show targets | ||
.PHONY: help | ||
help: | ||
echo 'Targets:'; \ | ||
$(MAKE) --print-data-base --just-print 2>&1 \ | ||
| grep -v '^[mM]akefile' \ | ||
| awk '/^[^ \t.%][-A-Za-z0-9_]*:/ { print $$1 }' \ | ||
| sort --unique \ | ||
| sed 's/:\+$$//' \ | ||
| pr --omit-pagination --indent=4 --width=80 --columns=4 | ||
|
||
######################################################################## | ||
# Tests | ||
######################################################################## | ||
|
||
.PHONY: check cond expr loop macros syntax expand | ||
|
||
check: expand jqt | ||
jqt: cond expr loop macros syntax | ||
|
||
define TestJQT | ||
# Run one example | ||
$(1)-%.jqt: | ||
echo "==> $$(basename $$@)" | ||
if [[ -e tests/$$(basename $$@).json ]]; then \ | ||
jqt -ifilters -Ltests/filters -Mtop:tests/$$(basename $$@).json -dtests/md-00.md tests/$$@ tests/generated/$$(basename $$@).txt; \ | ||
else \ | ||
jqt -ifilters -Ltests/filters -dtests/md-00.md tests/$$@ tests/generated/$$(basename $$@).txt; \ | ||
fi | ||
diff tests/expected/$$(basename $$@).txt tests/generated/$$(basename $$@).txt | ||
# Run one example named without file suffix | ||
$(1)-%: $(1)-%.jqt ; | ||
# Run all tests | ||
$(1): $(sort $(subst tests/,,$(wildcard tests/$(1)-[0-9][0-9].jqt))) | ||
endef | ||
|
||
define TestGPP | ||
# Run one example | ||
$(2)-%.$(1): | ||
echo "==> $$(basename $$@)" | ||
jqt -E tests/$$@ > tests/generated/$$@ | ||
diff tests/expected/$$@ tests/generated/$$@ | ||
# Run one example named without file suffix | ||
$(2)-%: $(2)-%.$(1) ; | ||
# Run all tests | ||
$(2): $(sort $(subst tests/,,$(wildcard tests/$(2)-[0-9][0-9].$(1)))) | ||
endef | ||
|
||
$(eval $(call TestGPP,jqt,expand)) | ||
$(eval $(call TestJQT,cond)) | ||
$(eval $(call TestJQT,expr)) | ||
$(eval $(call TestJQT,loop)) | ||
$(eval $(call TestJQT,macros)) | ||
$(eval $(call TestJQT,syntax)) | ||
|
||
# vim:ai:sw=8:ts=8:noet:syntax=make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# _jqt_ · The _jq_ template engine | ||
|
||
_jqt_ is a template engine that uses [_jq_](https://stedolan.github.io/jq/) as expression language. | ||
|
||
If you want to learn to use _jqt_, read the documentation at | ||
<https://fadado.github.io/jqt/>. This documentation is generated using _jqt_ from the `docs/` | ||
folder of this repository. | ||
|
||
The tools used in the implementation of _jqt_ are: | ||
|
||
* [jq](https://stedolan.github.io/jq/), a lightweight and flexible command-line JSON processor. | ||
* [GPP](https://logological.org/gpp), a general-purpose preprocessor. | ||
* [Pandoc](http://pandoc.org/), a universal document converter. | ||
* [GNU Make](https://www.gnu.org/software/make/), the classical tool for managing projects. | ||
* [Bash](https://www.gnu.org/software/bash/), [sed](https://www.gnu.org/software/sed/) and other shell tools. | ||
|
||
You must install all these software before diving into _jqt_. | ||
|
||
_jqt_ is developed under the _Fedora_ Linux distribution, and a lot of | ||
portability issues are expected at this stage of development. Please, use this | ||
GitHub repository features if you want to send any kind of questions. | ||
|
||
|
||
<!-- | ||
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/python | ||
|
||
# Simple CSV to JSON conversor | ||
|
||
import sys | ||
import csv | ||
import json | ||
|
||
def error(e): | ||
sys.stderr.write(type(e).__name__ + ': ' + str(e) + '\n') | ||
sys.exit(1) | ||
|
||
def load_csv(): | ||
if len(sys.argv) > 1: | ||
reader = csv.DictReader(open(sys.argv[1]) ) | ||
else: | ||
reader = csv.DictReader(sys.stdin) | ||
return reader | ||
|
||
def dump_json(seq): | ||
d = None | ||
for d in seq: | ||
json.dump(d, sys.stdout, indent=2, sort_keys=False) | ||
sys.stdout.write('\n') | ||
if d is None: | ||
sys.stdout.write('\n') | ||
|
||
# | ||
# Main | ||
# | ||
|
||
try: | ||
dump_json(load_csv()) | ||
except Exception as e: | ||
error(e) | ||
|
||
sys.exit(0); | ||
|
||
# vim:ai:sw=4:ts=4:et:fileencoding=utf-8:syntax=python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/python | ||
|
||
# Simple CSV to YAML conversor | ||
|
||
import sys | ||
import csv | ||
import yaml | ||
|
||
def error(e): | ||
sys.stderr.write(type(e).__name__ + ': ' + str(e) + '\n') | ||
sys.exit(1) | ||
|
||
def load_csv(): | ||
if len(sys.argv) > 1: | ||
reader = csv.DictReader(open(sys.argv[1]) ) | ||
else: | ||
reader = csv.DictReader(sys.stdin) | ||
return reader | ||
|
||
def dump_yaml(seq): | ||
d = None | ||
for d in seq: | ||
yaml.safe_dump(d, sys.stdout, | ||
default_flow_style=False, | ||
default_style=None, | ||
encoding='utf-8', | ||
explicit_start=True, | ||
explicit_end=False, | ||
indent=2, | ||
) | ||
if d is None: # some dumped? | ||
sys.stdout.write('\n') | ||
else: | ||
sys.stdout.write('...\n') | ||
|
||
# | ||
# Main | ||
# | ||
|
||
try: | ||
dump_yaml(load_csv()) | ||
except Exception as e: | ||
error(e) | ||
|
||
sys.exit(0); | ||
|
||
# vim:ai:sw=4:ts=4:et:fileencoding=utf-8:syntax=python |
Oops, something went wrong.