Skip to content

fix: no space before the punctuation after a formula - #2849

Merged
BoboTiG merged 1 commit into
reader-dict:mainfrom
monosans:fix/formula-trailing-newline
Nov 23, 2026
Merged

BoboTiG merged 1 commit into
reader-dict:mainfrom
monosans:fix/formula-trailing-newline

Conversation

@monosans

@monosans monosans commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

This commit was meant to be part of #2847 but reached my branch after the merge.

scour ends the optimized SVG with a newline, and in the HTML that shows as a space between a formula and the punctuation after it: "формулой X , где", "кислота (X ), использующаяся". In RU that's 149 places.

The fix strips the trailing whitespace in svg.optimize(), and test_formula_to_svg now checks that the SVG ends with </svg>.

Testing

  • Host: Windows 11, Docker Desktop 4.100.0, python:3.13-slim, RU dump 2026-11-01
  • Full RU build from main (f0bf952), then compared the StarDict output with a build that has this commit: the only differences are those 149 newlines after a formula, plus 7 places where a formula followed by an em dash gets its non-breaking space back
  • test_formula_to_svg, ruff and mypy pass

scour ends the SVG with a newline, which shows as a space in the HTML:
"formula , text".
@BoboTiG
BoboTiG merged commit a60f1e7 into reader-dict:main Nov 23, 2026
1 check passed
@monosans
monosans deleted the fix/formula-trailing-newline branch November 23, 2026 08:03
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