Commit 3c7630c
committed
odoc-parser: strip stray CR from deindented code block lines
Splitting a code block on '\n' leaves a trailing '\r' on every line of
CRLF input. count_leading_whitespace already discounts that '\r' when
computing the indent, but drop didn't strip it from the line it returned,
so the joined result still contained CRs.
This made fmt_code on Windows fail with Lexer.Error (Illegal_character
'\r') for any {@ocaml[...]} block, since the OCaml lexer's newline regex
is '\r*\n' and rejects a bare CR.
Strip the trailing '\r' in drop so the output uses LF only, matching
what the rest of the pipeline expects.1 parent 2d5d8c1 commit 3c7630c
2 files changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
| |||
0 commit comments