CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...
http://cdelord.fr/pp
GNU General Public License v3.0
252 stars 21 forks source link

Please add `-latex` and `-context` as formats #22

Closed bpj closed 7 years ago

bpj commented 7 years ago

Now that Pandoc supports several ways of generating a PDF there are actually four different scenarios involving production of PDF and/or HTML:

  1. PDF via LaTeX
  2. PDF via ConTeXt
  3. PDF via HTML and wkhtmltopdf
  4. HTML for other purposes (usually the web)

I have found that there are situations where the -html and -pdf formats don't suffice, namely when you want to generate HTML and PDF from the same source and haven't yet decided which means of PDF generation to use. HTML for wkhtmltopdf and HTML for the web may require different content, e.g. you may want to include a form in the web version but not in the PDF version. For that reason I wonder if you might consider adding -latex and -context formats so that one can differentiate between the four possibilities in a uniform way? (You of course already can use !ifdef(latex)() if you want!) While it's true that the same person would probably not consider both LaTeX and ConTeXt at the same time, so that a -tex format would suffice it is probably wise to not make any rash assumptions in that area, and what's more important an explicit !latex(...) or !context() makes the source clearer (and FWIW there is a long-standing issue to add a plain TeX writer opened by jgm himself: jgm/pandoc#1541)

CDSoft commented 7 years ago

I have to think about a different way to specify the output format that is more flexible than builtin macros.

I use \ifdef when I have some specific needs (e.g. to generate the github README).

bpj commented 7 years ago

Yes I see. I use !ifdef currently too.