From 97b317410345d56c274ad58f044d15cb06b8eca3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 13 Jul 2019 20:53:44 -0400 Subject: xmls, css, codeblocks linenumbers --- src/doc_reform/output/xmls.d | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/doc_reform/output/xmls.d') 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 = "
\n";
+          foreach (k, _line; _block_lines) {
+            if (k == 1) {
+              _codelines ~= format(q"┃    %s
+    ┃",
+                _line,
+              );
+            } else {
+              _codelines ~= format(q"┃    %s
+    ┃",
+                _line,
+              );
+            }
+          }
+          _codelines ~= "  
"; + } else { + _codelines = "
\n";
+          _codelines ~= _txt;
+          _codelines ~= "  
"; + } + return _codelines; + } if (!(obj.metainfo.identifier.empty)) { o = format(q"┃
-

%s

+

%s

┃", 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"┃
-

%s

+

%s

┃", obj.metainfo.is_a, - _txt + codelines(_txt) ); } return o; -- cgit v1.2.3