aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output_xhtmls.d
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 /src/sdp/output_xhtmls.d
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 'src/sdp/output_xhtmls.d')
-rw-r--r--src/sdp/output_xhtmls.d96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d
index 4ee5a79..971dd95 100644
--- a/src/sdp/output_xhtmls.d
+++ b/src/sdp/output_xhtmls.d
@@ -419,6 +419,40 @@ template outputXHTMLs() {
);
return u;
}
+ 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;
+ }
auto nugget(O)(
auto return ref const O obj,
) {
@@ -462,6 +496,68 @@ template outputXHTMLs() {
);
return o;
}
+ 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;
+ }
+ 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;
+ }
auto code(O)(
auto return ref const O obj,
) {