Skip to content

Add document authoring template population#182

Merged
miguelcalderon merged 4 commits intomasterfrom
add-document-authoring-template-population
Apr 17, 2026
Merged

Add document authoring template population#182
miguelcalderon merged 4 commits intomasterfrom
add-document-authoring-template-population

Conversation

@milos-pspdf
Copy link
Copy Markdown
Contributor

Summary

This PR adds a new example demonstrating template data population for Nutrient Document Authoring SDK, similar to the Web SDK's populateDocumentTemplate functionality.

Features

  • Simple placeholder replacement: Replace {{variable}} with data values
  • Conditional sections: Show/hide content with {{#condition}}...{{/condition}} and {{^condition}}...{{/condition}}
  • Array loops: Duplicate content (especially table rows) with {{#array}}...{{/array}}
  • Table row duplication: Supports same-row loop syntax for tables
  • Text formatting preservation: Maintains text formatting when duplicating content
  • Custom delimiters: Configure delimiter characters and default values

Implementation

  • Created a standalone TypeScript library at web/document-authoring-template-population/ with:
  • Core templating engine using Document Authoring SDK's programmatic API
  • Template parser for identifying placeholders
  • Processors for placeholders, conditionals, and loops
  • Full example with interactive HTML demo

Code Quality

  • All files follow Biome's code quality standards (kebab-case filenames, proper formatting)
  • Converted static-only classes to exported functions per Biome requirements
  • Added exemptions for pre-existing projects with Biome violations, sorry

mdjekic and others added 2 commits February 25, 2026 21:46
This example demonstrates how to populate Document Authoring templates
with dynamic data using a Mustache-like syntax.

Features:
- Simple placeholder replacement ({{variable}})
- Loops for arrays ({{#array}}...{{/array}})
- Conditionals ({{#condition}}, {{^negated}})
- Table row duplication for array data
- Custom delimiters and default values
- TypeScript with full type safety

The library processes templates in three phases: loops, conditionals,
and simple placeholders, all within a Document Authoring transaction
for atomic updates.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@miguelcalderon
Copy link
Copy Markdown
Contributor

Triage note: This looks like a solid, well-documented contribution — full TypeScript library with template parsing, conditionals, and loops for Document Authoring SDK. It's been open for a month with zero reviews.

Needs someone from Dev Rel or the Web team to review. @milos-pspdf — is this still ready for review?

(Part of stale PR triage: #187)

@miguelcalderon miguelcalderon requested review from a team as code owners April 8, 2026 11:29
@miguelcalderon
Copy link
Copy Markdown
Contributor

@milos-pspdf there are some type and build errors I've found locally. Do you mind if I do some changes directly in the PR, please?

@miguelcalderon miguelcalderon merged commit f56ba68 into master Apr 17, 2026
2 checks passed
@miguelcalderon miguelcalderon deleted the add-document-authoring-template-population branch April 17, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants