Repository navigation
Description
Native-editor review of the French edition found a rendering defect that the French typography pass should own (item 3 of QuantEcon/lecture-python-programming.fr#77, merged 2026-09-23).
What happens
With language: fr, docutils smartquotes converts a straight ' that ends a text node into a closing quote, and for French that is ”. So de l'[Exercice 1](factorial_exercise) renders as de l”Exercice 1. The apostrophe is followed by a link, emphasis, code or role node, so smartquotes cannot tell it is an elision. Docutils' own guidance is to write U+2019 in the source.
Scale
- 24 live misrenders on 13 of 27 pages of the French edition: 11 before links, 10 before emphasis or strong, 1 before inline code, 1 before a role, 1 before «. Each matches a
l'[,d'*, … in the source one to one. - The current engine (v0.29.2, claude-sonnet-5) reproduces the pattern in 7 of 9 fresh
initdraws offunctions,oop_introandnames— partly through the guillemet rule's ownd'«. - There is no judgement boundary (a French elision before markup is always an apostrophe), so this belongs in deterministic code, not the prompt.
Proposed change
In src/typography.ts, chain an apostrophe pass after the NBSP pass in the fr rule chain, on the same masked prose (inline code, math, links, HTML and URLs are already \u0000N\u0000 placeholders):
(?<![\p{L}\p{N}'‘’])(c|d|j|l|m|n|s|t|qu|jusqu|lorsqu|puisqu|quoiqu|quelqu|presqu)'(?=\u0000|[\[{*_«“]) flags: giu replacement: $1’
- The closed elision list, anchored at a word start, leaves genuine quotes (
's'*x*,'l'[1]) and non-elided forms (Hawai'[i],O'`Reilly`) alone. - The straight
"is deliberately not in the lookahead: in a real buildd’"objets"renders asd’ » objets ». - In-word apostrophes are left alone: smartquotes already curls them, and converting them would add ~1,900 characters of diff noise for no visible change.
Required in the same PR:
src/heading-map.tsnormalizeHeadingForMatch: fold[‘’]→'. A heading with an elision directly before a role is curled in the body but not in its role-stripped map value; without the fold the gatingheadingMapCorrectcheck fails andtranslate headingmapand sync keep rewriting each other's value. No fr heading is affected today (0 of 416), so this is defensive.scripts/typography/apply.mjs: its safety-netnormalizemust fold the elision’, scoped to the elision list rather than globally. Unpatched, it refuses all 13 affected files as "body changed beyond spacing". Update its "only changes whitespace" comments and report the elision count alongside the NBSP count.- Update the
typography.tsheader anddocs/user/language-config.md, which should say which fr rules are code-enforced.
Tests
A prototype with 22 tests changed exactly the 24 live lines on fr main, with 0 false positives, and is idempotent; en and zh-cn are unchanged. Positive cases include de l'[Exercice 1](x), d'`AxesSubplot`, d'{ref}`appels`, l'*Étape 1*, l'**évaluation**, d'_arguments_, d'$x$, d'« apprendre », jusqu'`n`. Negative cases: plain elisions (l'exécution, aujourd'hui), 's'*gras*, 'l'[1], front matter, code cells, display math, inline code, URLs, and link text (a documented limit). Add a heading-fold test.
Sequencing
Heal the French edition with the patched apply.mjs (23 lines after fr#77) in one fr PR before the release reaches @v0. Otherwise the first sync of each affected file carries apostrophe changes in sections unrelated to its English change. There is no fr harness lane, so validate with a local apply; the E2E gate shows the other lanes unchanged.
Alternative considered: a repo-root docutils.conf with French smartquotes_locales fixes rendering without touching content (verified with jupyter-book 1.0.4.post1; a lectures/docutils.conf is silently ignored because jb build passes noconfig). But it is tied to JB1/docutils, disappears at the mystmd cutover and fixes one edition — a stopgap at most.
Evidence: QuantEcon/project-translation reports/2026-09-23-fr-round2-editor-review-disposition.md, §5 S1.
Activity
dev: STATE.md — v0.29.3 released; page re-verified 2026-09-23 (#330)
dev: log + STATE.md — #419 merged; Copilot's wording note on #425
dev: log + STATE.md — zh-cn triage, the whole-document head, #280's o…
typography: write a French elision before inline markup as U+2019 (#324)
typography: review fixes — tests for every elision prefix; the heal s…
typography: write a French elision before inline markup as U+2019 (#324)
typography: review fixes — tests for every elision prefix; the heal s…
Overnight 4/6, French typography: no non-breaking spaces in CSS, tabl…
Typography: curly elision apostrophes before inline markup; repair th…
dev: v0.34.0 released (#490)
mmcky commentedon Nov 26, 2026
Done in both halves. The engine side, a French elision apostrophe directly before inline markup written as U+2019, is #474, released in v0.34.0 (https://github.com/QuantEcon/action-translation/releases/tag/v0.34.0). The edition side, healing lecture-python-programming.fr's existing text with the patched
scripts/typography/apply.mjs, is QuantEcon/lecture-python-programming.fr#118, merged 2026-11-26 as4c929fabeforev0moved to v0.34.0: 24 elisions in 14 lectures, checked against the dry run's counts, with a second pass changing nothing. So no later sync of an fr lecture carries apostrophe changes in sections its English change did not touch.