A4 for stet docx - #332
Conversation
Prior to this commit, ulb was always preferred for any language. We learned that at least one language, fr, should prefer non-ulb usfm text if available. This change makes it possible to specify additional languages besides fr that may need the same treatment.
A test with fr, f10, revealed that its chapter source was not being properly split into verses because of the extra markup formatting that is in f10. This commit switches to using BeautifulSoup to ensure proper matching of nested beginning and ending tags so that chapters are properly split into discrete verses. It may be more robust for other languages that we have not tested yet too which also have similar markup characteristics.
We already have disabled rg from the ui by request of the PO, but here is a place where it was still potentially being used in the consideration of what books to consider available for a particular language.
Only STET uses it
Add gu, ru, and bulgarian. Note that ru does not provide NT books, only OT books, so it has no utility in STET where all references are to NT. Thus ru is filtered out of the list of source languages currently displayed by STET.
Underline and black. Have not added the highlight desired yet as it is quite tricky to achieve and may not be desirable since it will gobble toner.
More iteration to come possibly.
Prefer defaulted function parameters for referential transparency. From this view, stylistically, they function as dependency injection.
- Was able to unify the fr and non-fr cases to one function for DOC. - Deemed it worthwhile to abandon DRY to let STET and Passages have their own version of same to allow for future differentiation as needed and not have to cross reference to DOC as much for API support. This is grey area when it comes to design, but I think it makes sense in this case. - Some cleanup and move to use BeautifulSoup a bit more than regex to ensure tag end matching.
…ous-updates-stet-passages-doc Various updates DOC, STET, Passages
Better setup leading to leaner main logic
Restore a couple search regex patterns from prior version
…ove-usfm-fix-module-organization Refactor usfm fixer module
…Associates#321 By default this is now True rather than including TW word definitions in generated documents.
…S is False Fixed issue raised in code review. Also clean up code a bit to remove magic strings
When a reference count is shown the PO wants it not just bold but also italicized.
…-tw-defs-online-option Provide option to link to TW word definitions online. Closes WycliffeAssociates#321
…-occurrence-instances-in-bold-italics Add italic to STET occurrence reference counting
Per reviewer comments
…er-out-parenthesized-see-phrases Filter out parenthesized see phrases
Choose USFM metadata lookup order and whether to normalize per language and resource type combo. E.g., a majority of languages provide their book name in the \h USFM element, but fr f10 does so in \toc2 and for fr f10 no normalization of the looked up name is preferred whereas other languages often need this step. This commit makes it possible to easily customize per language by using a lookup table for book name lookup and a lookup table for normalization. By request of PO.
…_name_lookup_prefs Book name lookup prefs
By request of PO
…-input-docs-update Update STET input docs and string table
…ocx-document-size Update docx template to be a4 size
…-off-epub-and-pdf-options Turn off epub and pdf options in UI
Requested by PO
…te-bulgarian-strings Update a Bulgarian string
…te-doctests-in-resource-lookup-module Update doctests in resource_lookup module
…te-parsing-unit-tests Add unit tests for parsing function and update doctest
PurpleGuitar
left a comment
There was a problem hiding this comment.
This looks good. Just one comment about page size consistency to prevent Word from thinking the document has multiple page formats.
| translated_header_phrases_table: dict[str, str] = TRANSLATED_HEADER_PHRASES_TABLE, | ||
| margin_width: Length = Inches(0.75), | ||
| a4_width: Length = Inches(8.27), | ||
| a4_height: Length = Inches(11.69), |
There was a problem hiding this comment.
A4 width is defined here in inches, where in docx_utils it's defined in mm. The values are slightly different (8.27in is 210.058mm not 210mm), enough that Word might not recognize it as A4.
I believe Word recognizes the Mm(210) as A4, so I recommend using it in both places.
There was a problem hiding this comment.
Excellent feedback, thanks
| section = doc.add_section(start_type=WD_SECTION.NEW_PAGE) | ||
| # Set A4 paper dimensions | ||
| section.page_width = Mm(210) | ||
| section.page_height = Mm(297) |
There was a problem hiding this comment.
This is the other place that the page_width is set.
There was a problem hiding this comment.
Excellent feedback, thanks.
Save paper. Follow DOC's lead in having a4 now.
Improvement to get more reliable and accurate A4 sizing based on PR review and some additional research.
4e7adac to
cf8dcdc
Compare
|
I've implemented your excellent suggestions, thank you! Please feel free to review again and merge if satisfied. If you see anything else that needs attention please let me know, I really appreciate the reviews. |
e26cd9b
into
WycliffeAssociates:doc.bibleineverylanguage.org
No description provided.