Repository navigation
fix(docx): honor degHide when rendering radical degrees - #2807
Open
Chen Yufeiyang (feiiiiii5) wants to merge 1 commit into
Open
Chen Yufeiyang (feiiiiii5) wants to merge 1 commit into
Chen Yufeiyang (feiiiiii5) wants to merge 1 commit into
Conversation
do_rad only checked whether the degree text was non-empty, and the Pr helper never parsed the radPr degHide on/off switch, so a hidden degree was still emitted as the radical index. Parse on/off properties in Pr and use the default radical when degHide is on; visible and absent degree properties keep their current output. Fixes microsoft#2806
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.
Fixes #2806.
DOCX math: a radical whose degree is hidden (
m:radPr/m:degHide) is rendered with the degree anyway.do_radonly checked that them:degtext was non-empty, and thePrhelper never parseddegHidebecauseradPrchildren outsidetag2methwere skipped.This adds an on/off property mapping to
Pr(an absentm:valor1/true/onmeans on;0/false/offmeans off) and makesdo_radfall back to the default radical when the degree is hidden. Visible degrees, emptyradPrand absentradPrkeep their current output.Tested with parameterized cases for all seven shapes from the issue (hidden val=1/true/absent and visible val=0/false, empty radPr, no radPr):
Not covered: a real Word document round trip (the DOCX is synthesized with python-docx), the wider
[all]test matrix (optional dependencies are not installed here), and non-DOCX formats.