diff options
Diffstat (limited to 'org/output_xmls.org')
-rw-r--r-- | org/output_xmls.org | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/org/output_xmls.org b/org/output_xmls.org index 942897e..0a57127 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -1374,23 +1374,49 @@ string code(O,M)( 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; |