Template Engine #2
GitHubNewbie0
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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.
This discussion was created from the release Template Engine.
Beta Was this translation helpful? Give feedback.
All reactions