aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/output.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-03-22 14:54:07 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitcdaba1c73f0555e1128a7a35addddcfaf715dbde (patch)
treebae4b5cbacd1db42d993b5043ff9c66c8478f08c /org/output.org
parent0.13.6 dlang function calls, syntax (ufcs related), logic should be retained (diff)
0.13.7 tables ao and html output, poem html output
Diffstat (limited to 'org/output.org')
-rw-r--r--org/output.org135
1 files changed, 129 insertions, 6 deletions
diff --git a/org/output.org b/org/output.org
index 657b32f..1b2ee5f 100644
--- a/org/output.org
+++ b/org/output.org
@@ -776,6 +776,46 @@ auto para_seg(O)(
}
#+END_SRC
+**** poem verse
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto verse(O)( // using code from code block, review
+ auto return ref const O obj,
+) {
+ string _txt = obj.text;
+ _txt = (_txt)
+ .replaceAll(rgx.newline, "<br>\n")
+ .replaceAll(rgx.two_spaces, "&nbsp;" ~ "&nbsp;" ~ "&nbsp;" ~ "&nbsp;")
+ .replaceAll(rgx.nbsp_and_space, "&nbsp;" ~ "&nbsp;");
+ string o;
+ if (obj.obj_cite_number.empty) {
+ o = format(q"¶ <div class="substance">
+ <p class="%s">
+%s
+ </p>
+ </div>¶",
+ obj.is_a,
+ _txt
+ );
+ } else {
+ o = format(q"¶ <div class="substance">
+ <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
+ <p class="%s" id="%s">
+%s
+ </p>
+ </div>¶",
+ obj.obj_cite_number,
+ obj.obj_cite_number,
+ obj.is_a,
+ obj.obj_cite_number,
+ _txt
+ );
+ }
+ return o;
+}
+#+END_SRC
+
**** nugget
#+name: xhtml_format_objects
@@ -831,6 +871,90 @@ auto endnote(O)(
}
#+END_SRC
+**** table
+
+***** TODO tablarize
+
+align="left|right|center"
+<td align="right">$100</td>
+
+"style=\"text-align:right\""
+"style=\"text-align:left\""
+
+"style=\"text-align:" ~ "right\""
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto tablarize(O)(
+ auto return ref const O obj,
+ string _txt,
+) {
+ string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
+ string[] _table_cols;
+ string _table;
+ string _tablenote;
+ foreach(row_idx, row; _table_rows) {
+ _table_cols = row.split(rgx.table_delimiter_col);
+ _table ~= "<tr>";
+ foreach(col_idx, cell; _table_cols) {
+ if ((_table_cols.length == 1)
+ && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx)
+ _tablenote ~= cell;
+ } else {
+ string _col_is = (row_idx == 0 && obj.table_heading) ? "th" : "td";
+ string _align = ("style=\"text-align:"
+ ~ ((obj.table_column_aligns[col_idx] == "l")
+ ? "left\"" : "right\""));
+ _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table_column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">";
+ _table ~= cell;
+ _table ~= "</" ~ _col_is ~ ">";
+ }
+ }
+ _table ~= "</tr>";
+ }
+ auto t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+}
+#+END_SRC
+
+***** table
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto table(O)(
+ auto return ref const O obj,
+) {
+ string _txt = obj.text;
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ _txt = font_face(_txt);
+ auto t = tablarize(obj, _txt);
+ _txt = t[0];
+ string _note = t[1];
+ string o;
+ o = format(q"¶ <div class="substance">
+ <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
+ <p class="%s" id="%s">%s
+ <table summary="normal text css" width="95%%" border="0" bgcolor="white" cellpadding="2" align="center">
+ %s
+ </table>
+ %s
+ </p>
+</div>¶",
+ obj.obj_cite_number,
+ obj.obj_cite_number,
+ obj.is_a,
+ obj.obj_cite_number,
+ tags,
+ _txt,
+ _note
+ );
+ return o;
+}
+#+END_SRC
+
**** code
#+name: xhtml_format_objects_code
@@ -948,7 +1072,7 @@ void scroll(D,I)(
case "poem":
break;
case "verse":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.verse(obj);
break;
case "group":
doc_html ~= xhtml_format.nugget(obj);
@@ -960,7 +1084,7 @@ void scroll(D,I)(
doc_html ~= xhtml_format.nugget(obj);
break;
case "table":
- doc_html ~= xhtml_format.para_scroll(obj, suffix);
+ doc_html ~= xhtml_format.table(obj);
break;
case "code":
doc_html ~= xhtml_format.code(obj);
@@ -1182,7 +1306,7 @@ void seg(D,I)(
case "poem":
break;
case "verse":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ doc_html[segment_filename] ~= xhtml_format.verse(obj);
break;
case "group":
doc_html[segment_filename] ~= xhtml_format.nugget(obj);
@@ -1194,9 +1318,8 @@ void seg(D,I)(
doc_html[segment_filename] ~= xhtml_format.nugget(obj);
break;
case "table":
- auto t = xhtml_format.para_seg(obj, suffix);
- doc_html[segment_filename] ~= t[0];
- doc_html_endnotes[segment_filename] ~= t[1];
+ doc_html[segment_filename] ~= xhtml_format.table(obj);
+ doc_html_endnotes[segment_filename] ~= "";
break;
case "code":
doc_html[segment_filename] ~= xhtml_format.code(obj);