demydd / pandoc

Automatically exported from code.google.com/p/pandoc
0 stars 0 forks source link

Custom Headers allow Title, Author, and Date variable substitution. #59

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using the custom header option produces an output file with three
parts;

  - custom header file content
  - hardcoded block of title, author, \maketitle command, etc
  - translated file content

This can be limiting if, for example, you are using a LaTeX template
which does not require a \maketitle, if if you ned the title and
author to appear half-way thrugh the document preamble, or it must
appear multiple times (for example, the document title in the titke
page and in the page header)

A possible solution involving variable substitution within custom
templates is discussed here;

http://groups.google.com/group/pandoc-discuss/browse_thread/thread/793dd0198f21a
37e

Original issue reported on code.google.com by mindfire...@gmail.com on 24 Feb 2008 at 9:26

GoogleCodeExporter commented 8 years ago
One could use HStringTemplate for this.

This could also be used to make addToHeader more flexible. Instead of adding raw
LaTeX/HTML/whatever to the document header, addToHeader could just set a flag, 
which
the template could conditionalize on.

Jonas Smedegaard suggests we might also have a command-line option, say
--var-options, that allows you to set variables used in the template from the 
command
line. (e.g. pdfkeywords for hyperref)

Original comment by fiddloso...@gmail.com on 12 Dec 2009 at 4:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
It would be good if the templates contained slots for everything, including 
"body",
"before", "after", etc.

Original comment by fiddloso...@gmail.com on 12 Dec 2009 at 5:01

GoogleCodeExporter commented 8 years ago
For backwards compatibility, we might:
- call these 'templates' rather than 'headers'
- use a separate option to set them
- keep the old headers options, but deprecate them

This might be implemented by making all the templates conditional:
$if(legacy-header)$
$legacy-header$
$else$
...
$endif$

Also, it would be nice, if possible, to switch to using data files rather than
template Haskell. Some issues about how to package with these. On Windows, 
could use
relative addressing (see Cabal user's guide).

Original comment by fiddloso...@gmail.com on 15 Dec 2009 at 5:10

GoogleCodeExporter commented 8 years ago
This has been implemented as of r1741.

Original comment by fiddloso...@gmail.com on 31 Dec 2009 at 1:31