Documentation
¶
Index ¶
- Constants
- Variables
- func BuildXml(node Node, options XmlOptions, indent string) []byte
- func ProcessHtmls(htmls Htmls, documentComponent string, zip *ZipArchive) error
- func ProcessImages(images Images, documentComponent string, zip *ZipArchive) error
- func ProcessLinks(links Links, documentComponent string, zip *ZipArchive) error
- func ZipClone(reader *zip.ReadCloser, writer *zip.Writer, except []string) error
- func ZipGetText(z *zip.ReadCloser, filename string) (string, error)
- func ZipSet(z *zip.Writer, filename string, data []byte) error
- type BaseNode
- type BufferStatus
- type CommandProcessor
- type Context
- type CreateReportOptions
- type Delimiters
- type ErrorHandler
- type Function
- type FunctionNotFoundError
- type Functions
- type Htmls
- type Image
- type ImagePars
- type Images
- type InvalidCommandError
- type KeyNotFoundError
- type Link
- type LinkPars
- type Links
- type LoopStatus
- type Node
- type NonTextNode
- type ParseTemplateResult
- type ReportData
- type ReportOutput
- type TextNode
- type Thumbnail
- type VarValue
- type XmlOptions
- type ZipArchive
Constants ¶
View Source
const ( T_TAG = "w:t" R_TAG = "w:r" P_TAG = "w:p" RPR_TAG = "w:rPr" TBL_TAG = "w:tbl" TR_TAG = "w:tr" TC_TAG = "w:tc" DOCPR_TAG = "wp:docPr" VSHAPE_TAG = "v:shape" ALTCHUNK_TAG = "w:altChunk" )
View Source
const ( TEMPLATE_PATH = "word" CONTENT_TYPES_PATH = "[Content_Types].xml" DEFAULT_LITERAL_XML_DELIMITER = "||" )
Variables ¶
View Source
var ( IncompleteConditionalStatementError = errors.New("IncompleteConditionalStatementError") IgnoreError = errors.New("ignore") BUILT_IN_COMMANDS = []string{ "CMD_NODE", "ALIAS", "FOR", "END-FOR", "IF", "END-IF", "INS", "IMAGE", "LINK", "HTML", } )
View Source
var ImageExtensions []string = []string{
".png",
".gif",
".jpg",
".jpeg",
".svg",
}
Functions ¶
func ProcessHtmls ¶
func ProcessHtmls(htmls Htmls, documentComponent string, zip *ZipArchive) error
func ProcessImages ¶
func ProcessImages(images Images, documentComponent string, zip *ZipArchive) error
func ProcessLinks ¶ added in v1.1.0
func ProcessLinks(links Links, documentComponent string, zip *ZipArchive) error
func ZipGetText ¶
func ZipGetText(z *zip.ReadCloser, filename string) (string, error)
Types ¶
type BaseNode ¶
func (*BaseNode) SetChildren ¶
type BufferStatus ¶
type BufferStatus struct {
// contains filtered or unexported fields
}
type CommandProcessor ¶
type CommandProcessor func(data *ReportData, node Node, ctx *Context) (string, error)
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(options CreateReportOptions, imageAndShapeIdIncrement int) Context
type CreateReportOptions ¶
type CreateReportOptions struct { CmdDelimiter *Delimiters LiteralXmlDelimiter string ProcessLineBreaks bool //noSandbox bool //runJs RunJSFunc //additionalJsContext Object FailFast bool RejectNullish bool ErrorHandler ErrorHandler FixSmartQuotes bool ProcessLineBreaksAsNewText bool MaximumWalkingDepth int Functions Functions }
type Delimiters ¶
type ErrorHandler ¶
type FunctionNotFoundError ¶
type FunctionNotFoundError struct {
FunctionName string
}
func (*FunctionNotFoundError) Error ¶
func (e *FunctionNotFoundError) Error() string
type InvalidCommandError ¶
func NewInvalidCommandError ¶
func NewInvalidCommandError(message, command string) *InvalidCommandError
func (*InvalidCommandError) Error ¶
func (e *InvalidCommandError) Error() string
Implémenter l'interface error pour InvalidCommandError
type KeyNotFoundError ¶
type KeyNotFoundError struct {
Key string
}
func (*KeyNotFoundError) Error ¶
func (e *KeyNotFoundError) Error() string
type LoopStatus ¶
type LoopStatus struct {
// contains filtered or unexported fields
}
type Node ¶
type Node interface { Parent() Node SetParent(Node) Children() []Node SetChildren([]Node) PopChild() AddChild(Node) Name() string SetName(string) }
func CloneNodeWithoutChildren ¶
CloneNodeWithoutChildren crée une copie d'un noeud sans ses enfants
func PreprocessTemplate ¶
func PreprocessTemplate(root Node, delimiter Delimiters) (Node, error)
type NonTextNode ¶
func NewNonTextNode ¶
func NewNonTextNode(tag string, attrs map[string]string, children []Node) *NonTextNode
type ParseTemplateResult ¶
type ParseTemplateResult struct { Root Node MainDocument string Zip *ZipArchive ContentTypes *NonTextNode Extras map[string]Node // [path]Node }
func ParseTemplate ¶
func ParseTemplate(zip *ZipArchive) (*ParseTemplateResult, error)
type ReportData ¶
type ReportOutput ¶
func ProduceReport ¶
func ProduceReport(data *ReportData, template Node, ctx Context) (*ReportOutput, error)
type TextNode ¶
func InsertTextSiblingAfter ¶
InsertTextSiblingAfter crée et insère un nouveau noeud texte après le noeud texte donné Retourne le nouveau noeud texte ou une erreur si les conditions ne sont pas remplies
func NewTextNode ¶
type XmlOptions ¶
type XmlOptions struct {
LiteralXmlDelimiter string
}
type ZipArchive ¶
type ZipArchive struct {
// contains filtered or unexported fields
}
func NewZipArchive ¶
func NewZipArchive(name string, w io.Writer) (*ZipArchive, error)
func (*ZipArchive) Close ¶
func (za *ZipArchive) Close() error
func (*ZipArchive) SetFile ¶
func (za *ZipArchive) SetFile(name string, data []byte)
Click to show internal directories.
Click to hide internal directories.