Render Mustache tags as typed spans#16
Draft
PiotrCzapla wants to merge 1 commit into
Draft
Conversation
PiotrCzapla
commented
Jul 14, 2026
| attrs: Attr::with_class(class), | ||
| children: vec![Inline::Html(src[i..end].to_string())], | ||
| }, | ||
| end, |
Contributor
Author
There was a problem hiding this comment.
We reuse existing span for simplicity instead of exposing a mustache markup in ast.
PiotrCzapla
commented
Jul 14, 2026
| let body = src[i + 2..end - 2].trim_start(); | ||
| let class = match body.chars().next() { | ||
| Some('#' | '^' | '/') => "mustache.section", | ||
| Some('!') => "mustache.comment", |
Contributor
Author
There was a problem hiding this comment.
Mustache.comment is very unlikely class due to the . which minimize hitting existing styles.
PiotrCzapla
commented
Jul 14, 2026
| let class = match body.chars().next() { | ||
| Some('#' | '^' | '/') => "mustache.section", | ||
| Some('!') => "mustache.comment", | ||
| Some('>') => "mustache.partial", |
Contributor
Author
There was a problem hiding this comment.
{{> partial}} is something we could use in fast tract to include other docx or pdf's at rendering time.
PiotrCzapla
marked this pull request as ready for review
July 14, 2026 12:45
jph00
marked this pull request as draft
July 17, 2026 22:15
Contributor
|
FYI @PiotrCzapla helpful to make PRs that aren't ready as drafts. Done now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for Mustache tags. This wraps placeholders, sections, comments, and partials in spans, allowing them to be styled in DOCX and SolveIt. It is enabled by default and can be turned off with mustache=False.
For styling in DOCX, we could add variable filling to the export with the proper colors, but that wouldn't always work; some Mustache markup cannot be changed this way, and we wouldn't get visual feedback in SolveIt:
Note: This is just proposal, If accepted I'll add docs.