All Projects → pnlng → Crisscross

pnlng / Crisscross

Licence: bsd-3-clause
A Markdown-centric template engine for batch offline document generation.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Crisscross

Pander
An R Pandoc Writer: Convert arbitrary R objects into markdown
Stars: ✭ 267 (+1383.33%)
Mutual labels:  markdown, pandoc, rmarkdown
Rmarkdown
Dynamic Documents for R
Stars: ✭ 2,319 (+12783.33%)
Mutual labels:  markdown, pandoc, rmarkdown
Summarytools
R Package to Quickly and Neatly Summarize Data
Stars: ✭ 390 (+2066.67%)
Mutual labels:  markdown, pandoc, rmarkdown
Markdown Preview Enhanced
One of the 'BEST' markdown preview extensions for Atom editor!
Stars: ✭ 3,478 (+19222.22%)
Mutual labels:  markdown, pandoc
Pandoc Ruby
Ruby wrapper for Pandoc
Stars: ✭ 299 (+1561.11%)
Mutual labels:  markdown, pandoc
Pandoc Latex Template
A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
Stars: ✭ 3,750 (+20733.33%)
Mutual labels:  markdown, pandoc
Manubot
Python utilities for Manubot: Manuscripts, open and automated
Stars: ✭ 260 (+1344.44%)
Mutual labels:  markdown, pandoc
Markup.rocks
Pandoc based document editor and converter in your browser.
Stars: ✭ 348 (+1833.33%)
Mutual labels:  markdown, pandoc
Nb
CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
Stars: ✭ 3,846 (+21266.67%)
Mutual labels:  markdown, pandoc
Letter Boilerplate
Finest letter typesetting from the command line
Stars: ✭ 374 (+1977.78%)
Mutual labels:  markdown, pandoc
Jupytext
Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
Stars: ✭ 4,969 (+27505.56%)
Mutual labels:  markdown, rmarkdown
Markdowntemplates
✅🔻 A collection of alternate R markdown templates
Stars: ✭ 287 (+1494.44%)
Mutual labels:  markdown, rmarkdown
Panflute
An Pythonic alternative to John MacFarlane's pandocfilters, with extra helper functions
Stars: ✭ 286 (+1488.89%)
Mutual labels:  markdown, pandoc
Pandoc Letter
Pandoc template for writing letters in markdown
Stars: ✭ 303 (+1583.33%)
Mutual labels:  markdown, pandoc
Pandoc Starter
📄 My pandoc markdown templates and makefiles
Stars: ✭ 443 (+2361.11%)
Mutual labels:  markdown, pandoc
Zettlr
A Markdown Editor for the 21st century.
Stars: ✭ 6,099 (+33783.33%)
Mutual labels:  markdown, pandoc
Rmarkdown Cookbook
R Markdown Cookbook. A range of tips and tricks to make better use of R Markdown.
Stars: ✭ 324 (+1700%)
Mutual labels:  pandoc, rmarkdown
csasdown
📖 An R package for creating CSAS reports in PDF or Word format with R Markdown and bookdown
Stars: ✭ 40 (+122.22%)
Mutual labels:  pandoc, rmarkdown
ntuthesis
台大碩博士論文模板 (R Package)
Stars: ✭ 14 (-22.22%)
Mutual labels:  pandoc, rmarkdown
Marker
🖊 A gtk3 markdown editor
Stars: ✭ 644 (+3477.78%)
Mutual labels:  markdown, pandoc

CrissCross

CrissCross is a Markdown-centric templating engine for offline documents.

Some of its features:

  • Replace Mustache-style placeholders
  • Include/import subfiles !INCLUDE "subfile.md"
  • Convert to other formats using pandoc or rmarkdown
Table of Contents

Getting Started

Prerequisites

  • Python 3
  • (optional) either pandoc or rmarkdown is required to convert files from one format to another
  • (optional) LaTeX is required for PDF generation

Installation

pip3 install crisscross

Examples

Here are some sample use cases of CrissCross, ordered by increasing complexity.

  • English and Spanish: Generate PDFs of the same file with keywords in different languages.
  • PhD Applications: Generate personal statements customized for different schools.
  • Weekly Quiz: Generate quizzes and their solutions for 2 different sections using the same template.
    • The examples uses crisscross combine to take the "Cartesian product" of different sets of YAML metadata files, and crisscross process to generate PDF files from them.

Here's a sneak peek of the PhD applications example. CrissCross allows you to go from a template that looks like this:

I am applying to **{{school_alt_name}}**’s PhD program because **{{school}}** is awesome. 

!INCLUDE "custom/{{school}}_last.md"

To PDFs like these:

Michigan UChicago

Usage

Commands

There are two commands, process and combine.

Process

process is the command that processes the template files.

Example

Convert TEMPLATE.md into PDF, using key-value pairs specified in VARS.yaml:

crisscross process TEMPLATE.md -y VARS.yaml -o OUTDIR/TEMPLATE.pdf

Options

Usage: crisscross process [OPTIONS] TEMPLATES...

  Preprocess text files, and render with pandoc or rmarkdown.

Options:
  -y, --yaml PATH                 The YAML file(s) to be used. If wildcard
                                  characters are used, then the whole argument
                                  must be quoted, e.g., -y '*.yaml'.
                                  (Default: custom/*.yaml)
  --no-yaml                       Use no YAML files. In this case, key-value
                                  pairs must be supplied with -k --key-value.
                                  (Default: disabled)
  -o, --out PATH                  Schema for the path to an output file.
                                  Variables are accepted. 
                                  (Default:
                                  docs/{{id}}.pdf)
  --open-ren / --no-open-ren      Whether to open the rendered files
                                  automatically. 
                                  (Default: enabled)
  --open-text / --no-open-text    Whether to open the generated text files
                                  automatically. 
                                  (Default: disabled)
  -a, --args TEXT                 A string of arguments to be passed on to
                                  pandoc. Passing arguments to rmarkdown not
                                  supported. If there are spaces, the string
                                  should be quoted.
  -r, --render [pandoc|rmarkdown]
                                  Render using vanilla pandoc or rmarkdown, or
                                  do not render at all. 
                                  (Default: pandoc)
  --no-render                     Do not render the files with pandoc or
                                  rmarkdown. Only do variable substitution or
                                  file inclusion. 
                                  (Default: disabled)
  --include-tag [include|import]  Syntax for file inclusion. Either !INCLUDE
                                  "filename" or @import "filename". 
                                  (Default:
                                  include)
  -V, --variable TEXT             A key-value pair separated by ":". No spaces
                                  allowed. Can be used in conjunction with or
                                  in place of YAML files.
  -f, --force                     Suppress warnings. 
                                  (Default: disabled)
  -q, --quiet / -v, --verbose     Suppress messages. 
                                  (Default: disabled)
  -h, --help                      Show this message and exit.

Combine

combine is a helper command takes the "Cartesian product" of lists of files.

Example

crisscross combine a1,a2 b1,b2 -o out/

would generate under out/

out/
  a1_b1
  a1_b2
  a2_b1
  a2_b2

where a1_b1 is a concatenation of a1 and b1, a1_b2 a concatenation of a1 and b2, and so on.

See the quiz example for a real-world use case of combine.

Options

Usage: crisscross combine [OPTIONS] [FILES]...

  Generate the 'Cartesian product' of multiple files.

Options:
  -o, --out DIRECTORY          Output directory.
  -s, --separator TEXT         Character used to join the names of input
                               files.
  -q, --quiet / -v, --verbose  Suppress messages. 
                               (Default: disabled)
  -h, --help                   Show this message and exit.

File Inclusion

Two inclusion tags are supported:

Adding asis after the inclusion tag will tell CrissCross to include the file as is, and not to further process it: !INCLUDE asis "foo.md"

Key-Value Pairs

Key-value pairs tell CrissCross how to replace placeholder expressions. They can be either placed in YAML files:

lang: English
level: Level

Alternatively, they could be supply using the -V option:

crisscross process -V key1:value1 -V key2:value2 TEMPLATE -o OUTFILE

Roadmap

  • [ ] Add the option to render inline placeholders as is
  • [ ] Add the option to use different patterns for placeholder expressions
  • [ ] Add logic support

Built With

This project uses the following open source libraries.

Acknowledgments

This project is heavily inspired by:

Other related projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].