Commit cd9f1ca
committed
fix(proof): apply stub escaping per context, exactly once (#952)
CI review, and a precise catch: my backslash-doubling commit made _js_string
run on _inline's already-doubled output, so json.dumps escaped those doubles
again. A title of '\d+' reached the .ts source as four backslashes and read
back as '\\d+'. The markdown templates had the same problem in reverse —
they got Python-docstring escaping they have no use for.
Split the escaping: _collapse is the context-neutral half (one line, no
docstring-closing sequence), and each context applies its own escaper to that,
once. Python templates get _inline (backslash-doubled, trailing quote padded),
the E2E literal gets _js_string(raw), markdown gets _collapse.
Tests assert round-trip fidelity rather than absence of a bad character: the
E2E literal must json.loads back to exactly the original title, the Python
docstring must ast.get_docstring back to exactly the original description, and
markdown must contain the original verbatim.1 parent 2292e09 commit cd9f1ca
2 files changed
Lines changed: 87 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
180 | 196 | | |
181 | 197 | | |
182 | 198 | | |
| |||
201 | 217 | | |
202 | 218 | | |
203 | 219 | | |
204 | | - | |
| 220 | + | |
205 | 221 | | |
206 | 222 | | |
207 | 223 | | |
| |||
212 | 228 | | |
213 | 229 | | |
214 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
215 | 237 | | |
216 | | - | |
| 238 | + | |
217 | 239 | | |
218 | 240 | | |
219 | 241 | | |
| |||
226 | 248 | | |
227 | 249 | | |
228 | 250 | | |
229 | | - | |
230 | | - | |
231 | 251 | | |
232 | 252 | | |
233 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
234 | 260 | | |
235 | 261 | | |
236 | | - | |
237 | | - | |
238 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
239 | 265 | | |
240 | | - | |
| 266 | + | |
241 | 267 | | |
242 | | - | |
| 268 | + | |
243 | 269 | | |
244 | 270 | | |
245 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
0 commit comments