The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::Amuse::Compile::Templates - Built-in templates for Text::Amuse::Compile

METHODS

new(ttdir => 'mytemplates')

Costructor. Options:

ttdir

The directory where to search for templates.

Disclaimer: some things are needed for a correct layout/compilation. It's strongly reccomended to use the existing one (known to work as expected) as starting point for a custom template.

TEMPLATES

The following methods return a reference to a scalar with the templates. It should be self-evident which kind of template they return.

html

css

(not actually a template, it's the default CSS).

bare_html

The HTML fragment with the body of the text (no HTML headers, no Muse headers).

minimal_html

Minimal (but valid) XHTML template, with a link to stylesheet.css. Meant to be used in the EPUB generation.

bare_latex

Minimal and uncomplete LaTeX chunck, meant to be used when merging files.

latex

The LaTeX template, with dimension conditional.

The built-in LaTeX template supports the following options, which are picked up from the extra constructor of Text::Amuse::Compile.

The template itself uses two hashrefs with tokens: options and safe_options. The options contains tokens which are interpreted as Text::Amuse strings from the extra constructor. The safe_options ones contains validate copies of the options for places where it make sense, plus some internal things like the languages and additional strings to get the LaTeX code right.

All the values from options and safe_options, because of the markup interpretation, are (hopefully) safely escaped (so you can pass even LaTeX commands, and they will be escaped).

Globals

safe_options.nocoverpage

If the text doesn't require a toc, this options set the class to komascript's article. Ignored if there is a toc.

safe_options.notoc

Do not generate a table of contents, even if the document requires one.

safe_options.papersize

Paper size, like a4, a5 or 210mm:11in. The width and heigth are swapped in some komascript version. Just keep this in mind and do some trial and error if you need custom dimensions.

safe_options.division

The DIV of the typearea package. Defaults to 12. Go and read the doc.

safe_options.opening

On which pages the chapters should open: right, left, any. Default: right. The left one will probably lead to unexpected results (the PDF will start with an empty page), so use it at your own peril.

safe_options.bcor

The BCOR of the typearea package. Defaults to 0mm. Go and read the doc. It expects a TeX dimension like 10mm or 1in or 1.2cm.

Please note that this has no effect on the plain PDF output, as we, opinionately, force BCOR=0mm and oneside=true for this kind of output. But, of course, it does affect the imposed output.

safe_options.fontsize

The font size in point (should be an integer). Defaults to 10.

safe_options.mainfont

The system font name, such as Linux Libertine O or Charis SIL. This implementation uses XeLaTeX, so we can use system fonts. Defaults to Linux Libertine O. This is just a copy of options.mainfont, as we can't know which font is installed.

options.oneside

Set it to a true value to have a oneside document. Default is true.

options.twoside

Set it to a true value to have a twosided document. Default is false.

Please note that this has no effect on the plain PDF output, as we, opinionately, force BCOR=0mm and oneside=true for this kind of output. But, of course, it does affect the imposed output.

safe_options.paging

The merging of options.oneside and options.twoside results in this token. If both or none are true, will default to oneside.

Cover

options.cover

When this option is set to a true value, skip the creation of the title page with \maketitle, and instead build a custome one, with the cover placed in the middle of the page.

safe_options.coverwidth

Option to control the cover width, when is set (ignored otherwise). Defaults to the full text width (i.e., 1). You have to pass a float here with the ratio to the text width, like 0.5, 1.

Colophon

In the last page the built in template supports the following options

options.sitename

At the top of the page

options.siteslogan

At the top, under sitename

At the top, under siteslogan

options.site

At the bottom of the page

INTERNALS

ttref($name)

Return the scalar ref associated to the given template file, if any.

names

Return the list of methods for template generation

EXPORT

None.