Package: crisscross
CrissCrossCrissCross is a Markdown-centric templating engine.Some of its features:Replace Mustache-style placeholdersInclude/import subfiles!INCLUDE "subfile.md"Convert to other formats usingpandocorrmarkdownTable of ContentsCrissCrossGetting StartedPrerequisitesInstallationExamplesUsageCommandsProcessExampleOptionsCombineExampleOptionsFile InclusionKey-Value PairsRoadmapBuilt WithAcknowledgmentsOther related projectsGetting StartedPrerequisitesPython 3(optional) eitherpandoc, orrmarkdownis required to convert files from one format to another(optional)LaTeXis required for PDF generationInstallationpip3 install crisscrossExamplesHere 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 usescrisscross combineto take the "Cartesian product" of different sets of YAML metadata files, andcrisscross processto generate PDF files from them.Here's a sneak peek of thePhD applicationsexample. 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:MichiganUChicagoUsageCommandsThere are two commands,processandcombine.Processprocessis the command that processes the template files.ExampleConvertTEMPLATE.mdinto PDF, using key-value pairs specified inVARS.yaml:crisscrossprocessTEMPLATE.md-yVARS.yaml-oOUTDIR/TEMPLATE.pdfOptionsUsage: 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.Combinecombineis a helper command takes the "Cartesian product" of lists of files.Examplecrisscrosscombinea1,a2b1,b2-oout/would generate underout/out/
  a1_b1
  a1_b2
  a2_b1
  a2_b2wherea1_b1is a concatenation ofa1andb1,a1_b2a concatenation ofa1andb2, and so on.See thequizexample for a real-world use case ofcombine.OptionsUsage:crisscrosscombine[OPTIONS][FILES]...Generatethe'Cartesian product'ofmultiplefiles.

Options:-o,--outDIRECTORYOutputdirectory.-s,--separatorTEXTCharacterusedtojointhenamesofinputfiles.-q,--quiet/-v,--verboseSuppressmessages.(Default:disabled)-h,--helpShowthismessageandexit.File InclusionTwo inclusion tags are supported:!INCLUDE "foo.md", in the style ofMarkdown Preprocessor, and@import "foo.md", in the style ofMarkdown Preview EnhancedHowever, unlike MPE, CrissCross does not support<!-- @import "foo.md" -->.Addingasisafter the inclusion tag will tell CrissCross to include the file as is, and not to further process it:!INCLUDE asis "foo.md"Key-Value PairsKey-value pairs tell CrissCross how to replace placeholder expressions. They can be either placed in YAML files:lang:Englishlevel:LevelAlternatively, they could be supply using the-Voption:crisscross process -V key1:value1 -V key2:value2 TEMPLATE -o OUTFILERoadmapAdd the option to render inline placeholders as isAdd the option to use different patterns for placeholder expressionsAdd logic supportBuilt WithThis project uses the following open source libraries.pallets/click: Python composable command line interface toolkithackebrot/poyo: A lightweight YAML Parser for Pythonnoahmorrison/chevron: A Python implementation of mustacheAcknowledgmentsThis project is heavily inspired by:alpianon/include-pandoc: A wrapper for pandoc to pre-process includesmichaelstepner/pandoc-mustache: Pandoc filter for variable substitution using Mustache syntaxOther related projectsjreese/markdown-pp: Preprocessor for Markdown files to generate a table of contents and other documentation needsDCsunset/pandoc-include: Pandoc filter to allow file includesowickstrom/pandoc-include-code: A Pandoc filter for including code from source filesMrToph/pandoc-code-file-filter: A filter for pandoc to include sections of code from a file