diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-07-13 20:53:44 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-17 19:07:20 -0400 |
commit | 97b317410345d56c274ad58f044d15cb06b8eca3 (patch) | |
tree | 4b4b89c122c4bcb17ad6c724da25d2b1c1660377 /src/doc_reform/output/xmls.d | |
parent | xmls, css, user-select on object-numbers & seg minitoc (diff) |
xmls, css, codeblocks linenumbers
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; |