In a technical breakdown published on October 5, 2026, developer ykidus053create detailed Clausery, a document automation utility designed to run entirely without a backend server. Hosted as static files on GitHub Pages, the tool converts tagged Microsoft Word (.docx) templates into interactive web questionnaires and generates assembled files directly on the user's device.
Automated Tag Inference and XML Cleanup
Clausery relies on the docxtemplater library and its inspect module to extract tags from uploaded Word documents and automatically map them to appropriate questionnaire inputs. The system infers data types from tag structure, identifying short text, long text, dates, currency, conditional boolean toggles using specific prefixes, and repeating group arrays for plural tag names.
To address formatting anomalies introduced by Microsoft Word, the application runs a pre-processing pass on the document XML prior to template parsing. This pass reconciles tags split across multiple formatting runs and trims stray whitespace around section tags to prevent unwanted blank lines in generated outputs.
Custom Expression Parser and Topological Evaluation
Rather than relying on dynamic JavaScript evaluation techniques that violate strict Content Security Policy rules, the project incorporates a custom lexer, recursive-descent parser, and evaluator for form logic and field calculations. The parser supports arithmetic operations, logical comparisons, list handling, and 33 custom functions while limiting abstract syntax tree nesting to 100 levels to mitigate stack overflow risks.
Form field dependencies are organized using a directed dependency graph evaluated in topological order. This ensures visibility rules are resolved first and hidden inputs are cleared before dependent calculation formulas run, preventing stale data from affecting final values or causing calculation loops.
Local Encryption, CSP Enforcement, and Offline Intake
Document drafts and workspace settings are stored client-side in IndexedDB, with optional rest encryption managed through the WebCrypto API using PBKDF2-SHA256 key derivation across 600,000 iterations and AES-256-GCM encryption. The application enforces a strict Content Security Policy restricted to local execution and atomic updates via a service worker cache.
For external data collection, Clausery exports questionnaires as self-contained static HTML files containing an inlined runtime. Users can fill out the form offline and export an answers file to be imported into a local draft, ensuring no form data passes through external cloud infrastructure.
AI-generated editorial illustration; not a documentary photograph.
Source: Document automation with no backend: turning Word templates into questionnaires in the browser

Leave a Reply