diff options
| author | pfg <pfg@pfg.pw> | 2021-10-03 16:32:30 -0400 |
|---|---|---|
| committer | pfg <pfg@pfg.pw> | 2021-10-03 16:32:30 -0400 |
| commit | 5d8f8cdca51c3fdcfe6657adcd5b7d2872571940 (patch) | |
| tree | 24a2766d84e93de5cd6d6f50e5acae9c9c503d43 /doc | |
| parent | a92b14426027a893a6e03e42383693a637e2c1c0 (diff) | |
| download | zig-5d8f8cdca51c3fdcfe6657adcd5b7d2872571940.tar.gz zig-5d8f8cdca51c3fdcfe6657adcd5b7d2872571940.zip | |
fix assuming multiline string tokens end with '\n'
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/docgen.zig | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/docgen.zig b/doc/docgen.zig index 0f6aacb465..139a58565e 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -990,9 +990,15 @@ fn tokenizeAndPrintRaw( }, .multiline_string_literal_line => { - try out.writeAll("<span class=\"tok-str\">"); - try writeEscaped(out, src[token.loc.start .. token.loc.end - 1]); - try out.writeAll("</span>" ++ end_line ++ "\n" ++ start_line); + if (src[token.loc.end - 1] == '\n') { + try out.writeAll("<span class=\"tok-str\">"); + try writeEscaped(out, src[token.loc.start .. token.loc.end - 1]); + try out.writeAll("</span>" ++ end_line ++ "\n" ++ start_line); + } else { + try out.writeAll("<span class=\"tok-str\">"); + try writeEscaped(out, src[token.loc.start..token.loc.end]); + try out.writeAll("</span>"); + } }, .builtin => { |
