Skip to content

Keep the control space at the end of a formula - #2844

Merged
BoboTiG merged 1 commit into
reader-dict:mainfrom
monosans:fix/formula-control-space
Nov 16, 2026
Merged

BoboTiG merged 1 commit into
reader-dict:mainfrom
monosans:fix/formula-control-space

Conversation

@monosans

Copy link
Copy Markdown
Contributor

convert_math() and convert_chem() strip the formula, and that breaks one ending with a control space (\ ). On RU "фундаментальная последовательность", <math>d(x_{n}, x_{m}) < \varepsilon\ </math> is sent as ...\varepsilon\. The math API rejects it, so the raw TeX ends up in the definition.

The spaces around a formula are still stripped, but a trailing space right after a backslash is kept now.

Testing

  • Python 3.13 (python:3.13-slim in Docker) on Windows 11.
  • convert_math() on that formula: main logs the <math> ERROR and returns the TeX, this branch returns the SVG. \frac{1}{2} with spaces around it renders as before.
  • New doctest, the convert_* doctests, mypy and ruff pass.

@BoboTiG
BoboTiG merged commit c1763ae into reader-dict:main Nov 16, 2026
1 check passed
@monosans
monosans deleted the fix/formula-control-space branch November 16, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants