Skip to content

docs: OpenDocument (LibreOffice) support documentation and examples (#138) - #217

Merged
vaceslav merged 1 commit into
mainfrom
docs/138-opendocument-docs
Sep 26, 2026
Merged

vaceslav merged 1 commit into
mainfrom
docs/138-opendocument-docs

Conversation

@vaceslav

Copy link
Copy Markdown
Contributor

Summary

Documentation and examples for OpenDocument Text (.odt/.ott) support: OdtTemplateProcessor (#210–#214) and the format-detecting TemplateProcessor facade (#215).

Changes

  • New docs pages (both in the mkdocs nav):
    • docs/for-template-authors/libreoffice.md ("LibreOffice / OpenDocument"). It covers authoring templates in LibreOffice Writer (saving as .odt/.ott, AutoCorrect quotes, no .fodt) and what is supported, including the list rules. It also covers the differences from Word, taken from the spec's known gaps: whitespace collapsing, row spans not adjusted, bookmarks not renamed, UpdateFieldsOnOpen not applicable, comments not processed, signatures removed, encrypted files rejected, .fodt unsupported.
    • docs/for-developers/opendocument.md ("OpenDocument (.odt)"). It covers the OdtTemplateProcessor API (files, bytes, a write-only output stream, .ott → .odt, options and DocumentProperties → meta.xml, validation) and the TemplateProcessor facade (detection rules, DetectFormat, stream behavior, unsupported formats).
  • Links from docs/index.md, the FAQ ("Can I write templates in LibreOffice?") and Getting Started.
  • READMEs: the root README has the tagline, the key feature and a "LibreOffice / OpenDocument Templates" quick sample. The NuGet readme (TriasDev.Templify/README.md) has the headline, the feature bullet and a sample with both processors and DetectFormat.
  • Package metadata: the Description mentions .odt/.ott and LibreOffice (and drops the outdated "100% test coverage" claim). Tags odt, ott, opendocument and libreoffice are added.
  • CLAUDE.md: an "OpenDocument (.odt / .ott)" architecture section (engine, package, facade, known gaps, tests in TriasDev.Templify.Tests/Odt/), the code organization and test locations, the markdown note, and updated test counts.
  • ARCHITECTURE.md: a short "OpenDocument Text" section with the processing flow and the reused components, plus a source layout row.
  • DocumentGenerator: a new libreoffice-letter example. It writes an .odt package directly (fixed entry order and timestamps, so the output is deterministic) and processes it with the facade. It covers placeholders, a date format, markdown, if/else around paragraphs and a bulleted list, a list-item loop, a table-row loop with a header row, and a footer placeholder. examples/templates/libreoffice-letter-template.odt and examples/outputs/libreoffice-letter-output.odt are committed. I checked the output with LibreOffice 25 headless (txt and pdf): it renders correctly, with the footer, bold/italic markdown, bullets and table. The example READMEs are updated.
  • Demo: the custom mode (--template x --data y.json) now uses TemplateProcessor, so --template x.odt/.ott works. The default output extension follows the detected format, and an unsupported file is rejected with a clear message.

Tests

  • TriasDev.Templify.Tests/Documentation/OpenDocumentSamplesTests.cs has 13 tests that mirror every sample and documented behavior on the new pages and README sections: file to file, .ott → .odt, bytes plus File.OpenWrite, a Word template given to the ODT processor, DocumentProperties in meta.xml, validation, the facade for docx/odt/ott, DetectFormat and position restore, an unsupported .fodt, typographic quotes, list-item loops, and an unmatched marker in a longer list.
  • Tools.Tests ExampleGeneratorSmokeTests: all generators are processed through the facade (the text reader handles ODT). There is a new theory that validates every generator's template with its sample data. It relies on the fix in fix(odt): ValidateTemplate no longer reports the markers of table-row and list-item blocks as unmatched (#138) #216, which this PR found. The PR also adds a content test and a determinism test for libreoffice-letter.
  • Local checks: the Release CI build passed. Core has 2091 tests per TFM (net10/9/8, including the LibreOffice round trips), Tools 52 and Converter 95. dotnet format --verify-no-changes, dotnet pack (package validation) and mkdocs build --strict passed.

Public API impact

None. This PR changes docs, examples, tools and package metadata only.

Refs #138

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 93.57143% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...Generator/Generators/LibreOfficeLetterGenerator.cs 94.89% 4 Missing and 3 partials ⚠️
TriasDev.Templify.DocumentGenerator/Program.cs 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@vaceslav
vaceslav merged commit 0e16e01 into main Sep 26, 2026
12 checks passed
@vaceslav
vaceslav deleted the docs/138-opendocument-docs branch September 26, 2026 13: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.

2 participants