diff options
Diffstat (limited to 'src/doc_reform/output/xmls.d')
-rw-r--r-- | src/doc_reform/output/xmls.d | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index 164613b..84028df 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -1164,23 +1164,49 @@ template outputXHTMLs() { assert(obj.metainfo.is_of_type == "block"); assert(obj.metainfo.is_a == "code"); string o; + string codelines(string _txt) { + string _codelines; + if (obj.code_block.linenumbers) { + string[] _block_lines = (_txt).split(rgx.br_newlines_linebreaks); + _codelines = " <pre class=\"codeline\">\n"; + foreach (k, _line; _block_lines) { + if (k == 1) { + _codelines ~= format(q"┃ <span class="tr first-row"><span class="th"></span><codeline>%s</codeline></span> + ┃", + _line, + ); + } else { + _codelines ~= format(q"┃ <span class="tr"><span class="th"></span><codeline>%s</codeline></span> + ┃", + _line, + ); + } + } + _codelines ~= " </pre>"; + } else { + _codelines = " <pre class=\"codeline\">\n"; + _codelines ~= _txt; + _codelines ~= " </pre>"; + } + return _codelines; + } if (!(obj.metainfo.identifier.empty)) { o = format(q"┃ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <pre><p class="%s" id="%s">%s</p></pre> + <p class="%s" id="%s">%s</p> </div>┃", obj.metainfo.identifier, (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier), obj.metainfo.is_a, obj.metainfo.identifier, - _txt + codelines(_txt) ); } else { o = format(q"┃ <div class="substance"> - <pre><p class="%s">%s</p></pre> + <p class="%s">%s</p> </div>┃", obj.metainfo.is_a, - _txt + codelines(_txt) ); } return o; |