Commit bd045fe
authored
Escape unlinked cross-references in HTML snippets (#1833)
## Description
`RDoc::Markup::ToHtmlSnippet` doesn't link cross-references, but its
`handle_regexp_CROSSREF` returned the matched text unchanged.
`apply_regexp_handling` treats a handler's return value as
already-converted HTML, so a CROSSREF match such as `#<` in
`[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>]` was emitted with a raw
`<`. The resulting search snippets (Aliki search results, Darkfish
`search_index.js`) contained `#<Encoding:UTF-8>`, which the browser
parses as a tag.
The handler now escapes the text with `convert_string`, the same way
`ToHtml#handle_regexp_SUPPRESSED_CROSSREF` does. On current master the
regular page output (`ToHtmlCrossref`) already escapes this case, so the
snippet formatter was the remaining path; I checked by generating aliki
and darkfish docs for the example from the issue, before and after.
Closes #17431 parent 5e0ea99 commit bd045fe
2 files changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | | - | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
653 | 660 | | |
654 | 661 | | |
655 | 662 | | |
| |||
0 commit comments