pdf-slave-1.0.1.0: Tool to generate PDF from haskintex templates and YAML input

Safe HaskellNone
LanguageHaskell2010

Text.PDF.Slave

Contents

Description

Reexports

Synopsis

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.

Constructors

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)

data Template Source #

Description of document template

Constructors

Template 

Fields

data TemplateDependencyFile Source #

Same as TemplateDependency but keeps contents in separate files

Constructors

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.

Constructors

TemplateFile 

Fields

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

Constructors

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

Instances

Show PDFRenderException Source # 
Generic PDFRenderException Source # 
Exception PDFRenderException Source # 
type Rep PDFRenderException Source # 

displayPDFRenderException :: PDFRenderException -> String Source #

Convert PDF rendering exception to user readable format

renderBundleOrTemplateFromFile Source #

Arguments

:: FilePath

Path to either bundle Template or template TemplateFile

-> 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 #

Arguments

:: FilePath

Path to Template all-in bundle

-> Maybe Value

Overwrite of input JSON for bundle

-> Sh PDFContent 

Helper to render from all-in bundle template

renderFromFileToPDF Source #

Arguments

:: FilePath

Path to TemplateFile

-> Sh PDFContent 

Helper to render from template file

renderBundleToPDF Source #

Arguments

:: Template

Input all-in template

-> FilePath

Base directory

-> Sh PDFContent 

Unpack bundle, render the template, cleanup and return PDF

renderTemplateToPDF Source #

Arguments

:: TemplateFile

Input template

-> FilePath

Base directory

-> Sh PDFContent

Output PDF file

Render template and return content of resulted PDF file