From 0f96a12482bef50e603d0c990dda4d56819ae8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20=C3=96stlund?= <ponost@roxen.com> Date: Fri, 25 Nov 2016 17:20:23 +0100 Subject: [PATCH] Fixed quotation of non-highlighted @code blocks --- .../Tools.pmod/Standalone.pmod/autodoc_to_html.pike | 12 +++++++++--- refdoc/structure/modref.css | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike index c08c5c8b1d..bc00141d0a 100644 --- a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike +++ b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike @@ -551,12 +551,11 @@ string parse_code(Node n, void|String.Buffer ret) text = lines*""; } - if (sizeof(text) && text[-1] == '\n'); - text = text[..<1]; - while (text[-1] == '\n') text = text[..<1]; + bool is_quoted = false; + if (has_value(text, "->") || (has_value(text, "{") && has_value(text, "}")) || (has_value(text, "(") && has_value(text, "\"")) || @@ -566,12 +565,19 @@ string parse_code(Node n, void|String.Buffer ret) code_highlighter = Tools.Standalone.pike_to_html(); } + is_quoted = true; + if (catch(text = code_highlighter->convert(text))) { text = text; + is_quoted = false; } } if (ret) { + if (!is_quoted) { + text = quote(text); + } + ret->add(text); } else return quote(text); diff --git a/refdoc/structure/modref.css b/refdoc/structure/modref.css index c683f619ad..0b8efa76d5 100644 --- a/refdoc/structure/modref.css +++ b/refdoc/structure/modref.css @@ -512,6 +512,11 @@ table.box td *:first-child { margin-top: 0; } table.box td *:last-child { margin-bottom: 0; } table.box table.box { width: 100%; } +p + pre { + margin-top: -15px; + padding-top: 0px; +} + pre code .comment { color: #999; } pre code .type { color: #00007B; font-weight: bold; } pre code .string { color: #037F00; } -- GitLab