How erdos/stencil works
Stencil is a JVM template engine that fills Word and PowerPoint OOXML documents. The main workflow accepts a template and data, prepares the template, evaluates expressions and dynamic content, then writes the rendered document; Java and Clojure APIs and a standalone service/CLI provide entry points. The README documents functions, fragments, HTML, images, links, and table manipulation. Some Clojure processing and service internals were not sampled, so those capability links are shown as unverified rather than asserted calls.
Main entry points: process.clj Document processing · PreparedTemplate.java Prepared template · API.java Java API · Main.java CLI entry
Components 27
Entry Points
- Java API
java-src/io/github/erdos/stencil/API.java - Clojure API
src/stencil/api.clj - CLI entry
java-src/io/github/erdos/stencil/Main.java - CLI arguments
java-src/io/github/erdos/stencil/standalone/ArgsParser.java - Stencil options
java-src/io/github/erdos/stencil/standalone/StencilArgsParser.java - Standalone runner
java-src/io/github/erdos/stencil/standalone/StandaloneApplication.java
Template Preparation
- Native factory
java-src/io/github/erdos/stencil/impl/NativeTemplateFactory.java - Directory watcher
java-src/io/github/erdos/stencil/impl/DirWatcherTemplateFactory.java - File handling
java-src/io/github/erdos/stencil/impl/FileHelper.java - Prepared template
java-src/io/github/erdos/stencil/PreparedTemplate.java - Template data
java-src/io/github/erdos/stencil/TemplateData.java - Template variables
java-src/io/github/erdos/stencil/TemplateVariables.java
Rendering Engine
- Document processing
src/stencil/process.clj - Expression grammar
src/stencil/grammar.clj - Expression evaluation
src/stencil/eval.clj - Template functions
java-src/io/github/erdos/stencil/functions/FunctionEvaluator.java - OOXML model
src/stencil/model.clj - OOXML handling
src/stencil/ooxml.clj
Document Features
- HTML content
src/stencil/postprocess/html.clj - Images
src/stencil/postprocess/images.clj - Links
src/stencil/postprocess/links.clj - Table editing
src/stencil/postprocess/table.clj - Document fragments
src/stencil/postprocess/fragments.clj
Output and Service
- Evaluated document
java-src/io/github/erdos/stencil/EvaluatedDocument.java - Rendering service
service/src/stencil/service.clj - Document output
Other components
- Template author
Connections 27
- Template author → Java API: supplies template
README.md - Template author → CLI entry: runs rendering
README.md - CLI entry → Stencil options: parses options
java-src/io/github/erdos/stencil/Main.java - Stencil options → CLI arguments: configures parser
java-src/io/github/erdos/stencil/standalone/StencilArgsParser.java - CLI entry → Standalone runner: starts runner
java-src/io/github/erdos/stencil/Main.java - Standalone runner → Java API: uses API
java-src/io/github/erdos/stencil/standalone/StandaloneApplication.java - Java API → Native factory: prepares template
java-src/io/github/erdos/stencil/API.java - Native factory → Prepared template: creates prepared
- Directory watcher → Native factory: delegates preparation
java-src/io/github/erdos/stencil/impl/DirWatcherTemplateFactory.java - Java API → Prepared template: renders template
java-src/io/github/erdos/stencil/API.java - Prepared template → Template data: consumes data
java-src/io/github/erdos/stencil/PreparedTemplate.java - Prepared template → Template functions: uses evaluator
java-src/io/github/erdos/stencil/PreparedTemplate.java - Prepared template → Evaluated document: produces document
java-src/io/github/erdos/stencil/PreparedTemplate.java - Prepared template → Template variables: exposes variables
java-src/io/github/erdos/stencil/PreparedTemplate.java - Clojure API → Document processing: invokes processing
- Document processing → Expression grammar: parses expressions
- Document processing → Expression evaluation: evaluates expressions
- Expression evaluation → Template functions: dispatches functions
- Document processing → OOXML model: transforms document
- OOXML model → OOXML handling: handles OOXML
- Document processing → HTML content: supports HTML
README.md - Document processing → Images: replaces images
README.md - Document processing → Links: replaces links
README.md - Document processing → Table editing: edits tables
README.md - Document processing → Document fragments: includes fragments
- Evaluated document → Document output: writes document
java-src/io/github/erdos/stencil/EvaluatedDocument.java - Template author → Rendering service: submits job
README.md