Package atessera.templ
Class PublicationTemplate
java.lang.Object
atessera.templ.PublicationTemplate
Velocity template for generating LaTeX source of a complete publication.
This class populates the publication.vm template with metadata
(title, authors, date, etc.) and content sections, producing a
compilable LaTeX document. The template is designed to be compiled with
PdfLatex.
Typical usage:
PublicationTemplate t = new PublicationTemplate(factory);
t.setHeader(publicationContent);
t.setAbstract(abstractText);
t.setSections(sections);
t.setBiblio(bibliography);
List<String> latexSource = t.renderToStringList();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a section within a publication. -
Constructor Summary
ConstructorsConstructorDescriptionPublicationTemplate(EngineFactory engineFactory) Constructs a new publication template. -
Method Summary
Modifier and TypeMethodDescriptionvoidMerges the context into the template and writes the result to the given writer.Renders the template and returns the result split into lines.setAbstract(String abs) Sets the abstract text of the publication.Sets the bibliography entries.voidsetHeader(PublicationContent publ) Sets the publication metadata from aPublicationContentobject.setSections(List<PublicationTemplate.Section> sections) Sets the content sections of the publication.
-
Constructor Details
-
PublicationTemplate
Constructs a new publication template.- Parameters:
engineFactory- the factory for obtaining a Velocity engine; must not benull- Throws:
org.apache.velocity.exception.ResourceNotFoundException- ifpublication.vmcannot be loaded
-
-
Method Details
-
setHeader
Sets the publication metadata from aPublicationContentobject.Populates template variables:
TITLE,TITLE_CAP,SUBTITLE,AUTHORS,BOOK_TYPE,TITLE_PAGE_TOP_NOTE,TITLE_PAGE_BOTTOM_NOTE,DATE,LOCATION,TOC_BEGIN, andTOC_END.- Parameters:
publ- the publication metadata; must not benull
-
setSections
Sets the content sections of the publication.- Parameters:
sections- the list of sections; must not benull- Returns:
- this template (for fluent chaining)
-
setAbstract
Sets the abstract text of the publication.- Parameters:
abs- the abstract text (may benull)- Returns:
- this template (for fluent chaining)
-
setBiblio
Sets the bibliography entries.- Parameters:
biblio- a list of key-value pairs where keys are citation keys and values are the formatted bibliography text; must not benull- Returns:
- this template (for fluent chaining)
-
render
Merges the context into the template and writes the result to the given writer.- Parameters:
wr- the writer to receive the rendered output; must not benull
-
renderToStringList
Renders the template and returns the result split into lines.- Returns:
- the rendered output as a list of lines (trailing empty lines are preserved)
-