From 45e1b786144b8ef0a70a235f8a1a89e90a752d8f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 12 Jan 2017 20:51:12 -0500 Subject: 0.11.0 improved message passing, using templates --- src/sdp/output_xhtmls.d | 259 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 src/sdp/output_xhtmls.d (limited to 'src/sdp/output_xhtmls.d') diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d new file mode 100644 index 0000000..7838cbe --- /dev/null +++ b/src/sdp/output_xhtmls.d @@ -0,0 +1,259 @@ +template SiSUoutputXHTMLs() { + struct SDPoutputXHTMLs { + string _xhtml_anchor_tags(const(string[]) anchor_tags) { + string tags=""; + if (anchor_tags.length > 0) { + foreach (tag; anchor_tags) { + if (!(tag.empty)) { + tags ~= ""; + } + } + } + return tags; + } + auto scroll_head( + string[string][string] dochead_meta, + ) { + string o; + o = format(q"¶ + + + + + %s%s + + + + + + + + + + + + + + + + + + + + ¶", + dochead_meta["title"]["full"], + (dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"], + ); + return o; + } + auto seg_head( + string[string][string] dochead_meta, + ) { + string o; + o = format(q"¶ + + + + + %s%s + + + + + + + + + + + + + + + + + + + + ¶", + dochead_meta["title"]["full"], + (dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"], + ); + return o; + } + auto tail() { + string o; + o = format(q"¶ + + + + ¶"); + return o; + } + auto toc(O)( + auto ref const O obj, + ) { + string o; + o = format(q"¶
+

+ %s +

+
¶", + obj.is_a, + obj.indent_hang, + obj.indent_base, + obj.text + ); + return o; + } + auto heading(O)( + auto ref const O obj, + ) { + auto tags = _xhtml_anchor_tags(obj.anchor_tags); + string o; + if (obj.obj_cite_number.empty) { + o = format(q"¶


+
+ %s + %s + +
¶", + obj.heading_lev_markup, + obj.is_a, + tags, + obj.text, + obj.heading_lev_markup, + ); + } else { + o = format(q"¶


+
+ + %s + %s + +
¶", + obj.obj_cite_number, + obj.obj_cite_number, + obj.heading_lev_markup, + obj.is_a, + obj.obj_cite_number, + obj.obj_cite_number, + tags, + obj.text, + obj.heading_lev_markup, + ); + } + return o; + } + auto para(O)( + auto ref const O obj, + ) { + auto tags = _xhtml_anchor_tags(obj.anchor_tags); + string o; + if (obj.obj_cite_number.empty) { + o = format(q"¶
+

%s + %s +

+
¶", + obj.is_a, + obj.indent_hang, + obj.indent_base, + tags, + obj.text + ); + } else { + o = format(q"¶
+ +

%s + %s +

+
¶", + obj.obj_cite_number, + obj.obj_cite_number, + obj.is_a, + obj.indent_hang, + obj.indent_base, + obj.obj_cite_number, + tags, + obj.text + ); + } + return o; + } + auto nugget(O)( + auto ref const O obj, + ) { + string o; + if (obj.obj_cite_number.empty) { + o = format(q"¶
+

+ %s +

+
¶", + obj.is_a, + obj.text + ); + } else { + o = format(q"¶
+ +

+ %s +

+
¶", + obj.obj_cite_number, + obj.obj_cite_number, + obj.is_a, + obj.obj_cite_number, + obj.text + ); + } + return o; + } + auto endnote(O)( + auto ref const O obj, + ) { + string o; + o = format(q"¶

+ %s +

¶", + obj.is_a, + obj.indent_hang, + obj.indent_base, + obj.text + ); + return o; + } + auto code(O)( + auto ref const O obj, + ) { + string o; + if (obj.obj_cite_number.empty) { + o = format(q"¶
+

+%s +

+
¶", + obj.is_a, + obj.text + ); + } else { + o = format(q"¶
+ +

+%s +

+
¶", + obj.obj_cite_number, + obj.obj_cite_number, + obj.is_a, + obj.obj_cite_number, + obj.text + ); + } + return o; + } + } +} -- cgit v1.2.3