Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler string
Compiler represents the various compilers that are available
var ( CC_PDFLatex Compiler = "pdflatex" CC_Latexmk Compiler = "latexmk" CC_Default Compiler = CC_Latexmk )
type Delimiters ¶
Delimiters holds the left and right delimiters for a template
var BadDefaultDelimiters Delimiters = Delimiters{
Left: "{{",
Right: "}}",
}
var DefaultDelimiters Delimiters = Delimiters{
Left: "#!",
Right: "!#",
}
var EmptyDelimiters Delimiters = Delimiters{
Left: "",
Right: "",
}
type Job ¶
type Job struct { recon.Dir Template *template.Template Details map[string]interface{} Opts Options }
Job represents the request for constructing a tex file from the template and details and then compiling that into a PDF.
func (*Job) AddResource ¶
AddResource adds resource files to the Job that should be available in the root/working directory.
func (*Job) Compile ¶
Compile creates a tex file by filling in the template with the details and then compiles the results and returns the location of the resulting PDF.
func (*Job) GetDetails ¶
GetDetails looks for a details file named id in the SourceChain and stores the results for later.
func (*Job) GetTemplate ¶
GetTemplate looks for a template named id in the SourceChain and parses it, storing the results for later use.
func (*Job) ParseQuery ¶
func (j *Job) ParseQuery(q url.Values, cache *TemplateCache) error
ParseQuery takes url.Values and loads the template and resources referenced in q into the root directory.
type MissingKeyOpt ¶
type MissingKeyOpt string
MissingKeyOpt controls how missing keys are handled when filling in a template
var ( // MK_Error will cause an error if details is missing a key used in the template MK_Error MissingKeyOpt = "error" // MK_Zero will cause values whose keys are missing from details to be replace with a zero value. MK_Zero MissingKeyOpt = "zero" // MK_Nothing will cause missing keys to be ignored. MK_Nothing MissingKeyOpt = "nothing" )
func (MissingKeyOpt) IsValid ¶
func (mko MissingKeyOpt) IsValid() bool
func (MissingKeyOpt) Val ¶
func (mko MissingKeyOpt) Val() string
type Options ¶
type Options struct { // CC is the LaTeX compiler to use CC Compiler // N controls the number of compilations/passes. N uint // OnMissingKey controls how missing keys are handled when filling in the template OnMissingKey MissingKeyOpt // Delims holds the left and right delimiters to use for the template Delims Delimiters }
Options holds the user settable options for a compilation job
var DefaultOptions Options = Options{ CC: CC_Default, N: 1, OnMissingKey: MK_Error, Delims: DefaultDelimiters, }
type Request ¶
type Request struct { Template string `json:"template"` Details map[string]interface{} `json:"details"` Resources map[string]string `json:"resources"` Delimiters Delimiters `json:"delimiters"` OnMissingKey MissingKeyOpt `json:"onMissingKey"` Compiler Compiler `json:"compiler"` Count uint `json:"count"` }
type TemplateCache ¶
func NewTemplateCache ¶
func NewTemplateCache(n int) (*TemplateCache, error)
func (*TemplateCache) Add ¶
func (tc *TemplateCache) Add(key string, val interface{}) bool
func (*TemplateCache) Get ¶
func (tc *TemplateCache) Get(key string) (interface{}, bool)