-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace tokens by splitting text runs/paragraphs instead of replacing #62
Conversation
CRM/Civioffice/DocumentRendererType/LocalUnoconv/PhpWordTemplateProcessor.php
Outdated
Show resolved
Hide resolved
CRM/Civioffice/DocumentRendererType/LocalUnoconv/PhpWordTemplateProcessor.php
Outdated
Show resolved
Hide resolved
CRM/Civioffice/DocumentRendererType/LocalUnoconv/PhpWordTemplateProcessor.php
Outdated
Show resolved
Hide resolved
CRM/Civioffice/DocumentRendererType/LocalUnoconv/PhpWordTemplateProcessor.php
Show resolved
Hide resolved
CRM/Civioffice/DocumentRendererType/LocalUnoconv/PhpWordTemplateProcessor.php
Outdated
Show resolved
Hide resolved
e2525b6
to
137b892
Compare
I added a |
@pfigel as discussed, happy to receive a review on that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! A lot more scenarios now work out of the box. I found a few that don't fully behave as expected (though the behaviour is still less broken than it was before). I've attached corresponding docx
files for each issue, as well as the template.
<strong>bold</strong>
- text is printed, but it's not bold. (seems to only happen if the token starts with a tag)<p>This is a new paragraph</p>
- produces an invalid docx; LibreOffice saysSAXException: [word/document.xml line 5]: Opening and ending tag mismatch: r line 4 and pPr
normal <strong>bold</strong>
- bold styling is applied, but font-family (only) for the bold text is lost
I'm running unoconv 0.9.0, LibreOffice 7.6.4.1 and Civi master.
@dontub Sorry for the delay! I re-tested the test cases above as well as some more complex templates we use in production. All scenarios work as expected now, so this LGTM. Thanks! |
Fix handling of styles
systopia-reference: 23739
Ad the
1.0
milestone: Let's consider this a bugfix for merging it during the beta phase.This is still missing some things from what @dontub and @jensschuppe planned to implement:
Note
I used a document with Live Snippets (their tokens being pre-/suffixed with text, i.e. in the middle of a paragraph) which got those values:
This is just some text.
- should be a single Text element and get inline-inserted without styles<p>This is a new paragraph</p>
- should be a new paragraph (splitting the paragraph containing the token)This is some text with a <strong>bold</strong> part.
- should be three Text elements with styles (bold font) and get inline-inserted within the same paragraph<p>This is a new paragraph with a <strong>bold</strong> part.</p>
- should be a new TextRun element, creating a new paragraph (splitting the paragraph containing the token)Note: This changes the code style of the entire
TemplateProcessor.php
file to comply with CiviCRM coding standards, so it's best reviewed with whitespace changes hidden.This is also being provided as a PR to PhpWord: PHPOffice/PHPWord/pull/2607.