Skip to content

Commit

Permalink
Remove MathML / describedMath accessibilityFeatures for compatible bu…
Browse files Browse the repository at this point in the history
…ilds

We’re converting away from MathML there so it’s no longer accurate.
  • Loading branch information
robinwhittleton committed Mar 10, 2024
1 parent 890863d commit e5b9227
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion se/se_epub_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,11 +850,15 @@ def build(self, run_epubcheck: bool, check_only: bool, build_kobo: bool, build_k
file.write(processed_css)
file.truncate()

# Sort out MathML compatibility
# Replace MathML with either plain characters or an image of the equation
if metadata_dom.xpath("/package/manifest/*[contains(@properties, 'mathml')]"):
# We import this late because we don't want to load selenium if we're not going to use it!
from se import browser # pylint: disable=import-outside-toplevel

# Remove MathML / describedMath accessibilityFeatures as we’re not going to use MathML
for node in metadata_dom.xpath("/package/metadata/meta[@property='schema:accessibilityFeature' and (text() = 'describedMath' or text() = 'MathML')]"):
node.remove()

# We wrap this whole thing in a try block, because we need to call
# driver.quit() if execution is interrupted (like by ctrl + c, or by an unhandled exception). If we don't call driver.quit(),
# Firefox will stay around as a zombie process even if the Python script is dead.
Expand Down

0 comments on commit e5b9227

Please sign in to comment.