Safe Haskell | None |
---|---|
Language | Haskell2010 |
Reexports
- type TemplateName = Text
- type TemplateInput = Value
- type TemplateBody = Text
- type TemplateBibtex = Text
- type DependencyBody = ByteString
- type BibTexBody = Text
- data TemplateDependency
- data Template = Template {}
- data TemplateDependencyFile
- data TemplateFile = TemplateFile {}
- loadTemplateInMemory :: TemplateFile -> Sh (Either String Template)
- storeTemplateInFiles :: Template -> FilePath -> Sh TemplateFile
- type PDFContent = ByteString
- data PDFRenderException
- displayPDFRenderException :: PDFRenderException -> String
- renderBundleOrTemplateFromFile :: FilePath -> Maybe Value -> Sh PDFContent
- renderFromFileBundleToPDF :: FilePath -> Maybe Value -> Sh PDFContent
- renderFromFileToPDF :: FilePath -> Sh PDFContent
- renderBundleToPDF :: Template -> FilePath -> Sh PDFContent
- renderTemplateToPDF :: TemplateFile -> FilePath -> Sh PDFContent
Template definition
type TemplateName = Text Source #
Template unique name
type TemplateInput = Value Source #
A template takes simple YAML document as input
type TemplateBody = Text Source #
Template body is text with .htex content
type TemplateBibtex = Text Source #
Template can define additional bibtex database
type DependencyBody = ByteString Source #
Dependency can be a binary file
type BibTexBody = Text Source #
Content of bibtex file
data TemplateDependency Source #
Template has different types of dependencies, each type of the dependecy has own affect on rendering pipe.
BibtexDep BibTexBody | Bibtex file for references to other documents. Need call to bibtex |
TemplateDep Template | HTex file that need to be compiled to .tex file |
TemplatePdfDep Template | HTex file that need to be compiled to .pdf file |
OtherDep DependencyBody | Any other file that doesn't need a compilation (listings, images, etc) |
Description of document template
Template | |
|
data TemplateDependencyFile Source #
Same as TemplateDependency
but keeps contents in separate files
BibtexDepFile | Bibtex file for references to other documents. Need call to bibtex. Name of dependency is a filename with contents. |
TemplateDepFile TemplateFile | HTex file that need to be compiled to .tex file Name of dependency defines a subfolder for the template. |
TemplatePdfDepFile TemplateFile | HTex file that need to be compiled to .pdf file Name of dependency deinfes a subfolder for the template. |
OtherDepFile | Any other file that doesn't need a compilation (listings, images, etc) Name of dependency is a filename with contents. |
data TemplateFile Source #
Same as Template
, but holds info about template content and dependencies
in other files.
TemplateFile | |
|
Bundle helpers
loadTemplateInMemory :: TemplateFile -> Sh (Either String Template) Source #
Load all external references of template into memory
storeTemplateInFiles :: Template -> FilePath -> Sh TemplateFile Source #
Extract all external references of template into file system
Template rendering to PDF
type PDFContent = ByteString Source #
Contents of PDF file
data PDFRenderException Source #
Errors that are thrown by rendering functions
TemplateFormatError FilePath ParseException | Failed to parse template YAML |
BundleFormatError FilePath ParseException | Failed to parse template bundle YAML | Failed to parse file in both formats: bundle and template file. |
BundleOrTemplateFormatError FilePath ParseException ParseException | |
InputFileFormatError FilePath String | Failed to parse JSON input |
displayPDFRenderException :: PDFRenderException -> String Source #
Convert PDF rendering exception to user readable format
renderBundleOrTemplateFromFile Source #
:: FilePath | Path to either bundle |
-> Maybe Value | Overwrite of input JSON for bundle |
-> Sh PDFContent |
Helper to render either a bundle or distributed template from file to PDF.
renderFromFileBundleToPDF Source #
:: FilePath | Path to |
-> Maybe Value | Overwrite of input JSON for bundle |
-> Sh PDFContent |
Helper to render from all-in bundle template
:: FilePath | Path to |
-> Sh PDFContent |
Helper to render from template file
:: Template | Input all-in template |
-> FilePath | Base directory |
-> Sh PDFContent |
Unpack bundle, render the template, cleanup and return PDF
:: TemplateFile | Input template |
-> FilePath | Base directory |
-> Sh PDFContent | Output PDF file |
Render template and return content of resulted PDF file