pdf-slave-1.3.2.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 #

Template unique name

type TemplateInput = Value #

A template takes simple YAML document as input

type TemplateBody = Text #

Template body is text with .htex content

type TemplateBibtex = Text #

Template can define additional bibtex database

type DependencyBody = ByteString #

Dependency can be a binary file

type BibTexBody = Text #

Content of bibtex file

data TemplateDependency :: * #

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)

Instances

Show TemplateDependency 
Generic TemplateDependency 
ToJSON TemplateDependency 
FromJSON TemplateDependency 
type Rep TemplateDependency 

data Template :: * #

Description of document template

Constructors

Template 

Fields

data TemplateDependencyFile :: * #

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

Same as Template, but holds info about template content and dependencies in other files.

Constructors

TemplateFile 

Fields

Bundle helpers

loadTemplateInMemory :: TemplateFile -> FilePath -> 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

-> Bool

Nuke temp folder?

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

-> Bool

Nuke temp folder?

-> Sh PDFContent 

Helper to render from all-in bundle template

renderFromFileToPDF Source #

Arguments

:: FilePath

Path to TemplateFile

-> Bool

Nuke temp folder?

-> Sh PDFContent 

Helper to render from template file

renderBundleToPDF Source #

Arguments

:: Template

Input all-in template

-> Bool

Nuke temp folder?

-> Sh PDFContent 

Unpack bundle, render the template, cleanup and return PDF

renderTemplateToPDF Source #

Arguments

:: TemplateFile

Input template

-> FilePath

Base directory

-> Bool

Nuke temp folder?

-> Sh PDFContent

Output PDF file

Render template and return content of resulted PDF file