Template Engine
Template Engine
v0.3.0 adds a template engine to odf-kit. Create a .odt template in LibreOffice with {placeholders}, fill it with data from JavaScript.
Added
Template engine — fillTemplate() loads an existing .odt, replaces {placeholders} with data, returns a new .odt
Loops — {#items}...{/items} repeats content for each array item
Conditionals — {#showSection}...{/showSection} includes/removes based on truthy/falsy
Dot notation — {user.address.city} for nested data
Placeholder healer — automatically reassembles placeholders fragmented by LibreOffice across text:span elements
Boundary expansion — section markers expand through wrapping XML to prevent orphaned tags
Header/footer templates — placeholders in headers and footers processed alongside body
120 new tests — 222 total
See CHANGELOG.md for full details.