aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output_xhtmls.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-01-12 20:51:12 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit45e1b786144b8ef0a70a235f8a1a89e90a752d8f (patch)
treee4e9d787fe9f0bce330a8db407e949aa9bf5ee8e /src/sdp/output_xhtmls.d
parentdom structure, levels marked up & collapsed (use e.g. in epub toc) (diff)
0.11.0 improved message passing, using templates
Diffstat (limited to 'src/sdp/output_xhtmls.d')
-rw-r--r--src/sdp/output_xhtmls.d259
1 files changed, 259 insertions, 0 deletions
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 ~= "<a name=\"" ~ tag ~ "\"></a>";
+ }
+ }
+ }
+ return tags;
+ }
+ auto scroll_head(
+ string[string][string] dochead_meta,
+ ) {
+ string o;
+ o = format(q"¶<!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ <title>
+ %s%s
+ </title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <meta name="dc.title" content="Title" />
+ <meta name="dc.author" content="Author" />
+ <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" />
+ <meta name="dc.date" content="year" />
+ <meta name="dc.date.created" content="year" />
+ <meta name="dc.date.issued" content="year" />
+ <meta name="dc.date.available" content="year" />
+ <meta name="dc.date.valid" content="year" />
+ <meta name="dc.date.modified" content="year" />
+ <meta name="dc.language" content="US" />
+ <meta name="dc.rights" content="Copyright: Copyright (C) year holder />
+ <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" />
+ <link rel="generator" href="http://www.sisudoc.org/" />
+ <link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
+ <link href="../../_sisu/css/html.css" rel="stylesheet">
+ <link href="../../../_sisu/css/html.css" rel="stylesheet">
+ </head>
+ <body lang="en">
+ <a name="top" id="top"></a>¶",
+ 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"¶<!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ <title>
+ %s%s
+ </title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <meta name="dc.title" content="Title" />
+ <meta name="dc.author" content="Author" />
+ <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" />
+ <meta name="dc.date" content="year" />
+ <meta name="dc.date.created" content="year" />
+ <meta name="dc.date.issued" content="year" />
+ <meta name="dc.date.available" content="year" />
+ <meta name="dc.date.valid" content="year" />
+ <meta name="dc.date.modified" content="year" />
+ <meta name="dc.language" content="US" />
+ <meta name="dc.rights" content="Copyright: Copyright (C) year holder />
+ <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" />
+ <link rel="generator" href="http://www.sisudoc.org/" />
+ <link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
+ <link href="../../_sisu/css/html.css" rel="stylesheet">
+ <link href="../../../_sisu/css/html.css" rel="stylesheet">
+ </head>
+ <body lang="en">
+ <a name="top" id="top"></a>¶",
+ dochead_meta["title"]["full"],
+ (dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"],
+ );
+ return o;
+ }
+ auto tail() {
+ string o;
+ o = format(q"¶ <a name="bottom" id="bottom"></a>
+ <a name="end" id="end"></a>
+ </div>
+ </body>
+ </html>¶");
+ return o;
+ }
+ auto toc(O)(
+ auto ref const O obj,
+ ) {
+ string o;
+ o = format(q"¶ <div class="substance">
+ <p class="%s" indent="h%si%s">
+ %s
+ </p>
+ </div>¶",
+ 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"¶<br><hr /><br>
+ <div class="substance">
+ <h%s class="%s">%s
+ %s
+ </h%s>
+ </div>¶",
+ obj.heading_lev_markup,
+ obj.is_a,
+ tags,
+ obj.text,
+ obj.heading_lev_markup,
+ );
+ } else {
+ o = format(q"¶<br><hr /><br>
+ <div class="substance">
+ <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
+ <h%s class="%s" id="%s"><a name="%s"></a>%s
+ %s
+ </h%s>
+ </div>¶",
+ 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"¶ <div class="substance">
+ <p class="%s" indent="h%si%s">%s
+ %s
+ </p>
+ </div>¶",
+ obj.is_a,
+ obj.indent_hang,
+ obj.indent_base,
+ tags,
+ obj.text
+ );
+ } else {
+ o = format(q"¶ <div class="substance">
+ <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
+ <p class="%s" indent="h%si%s" id="%s">%s
+ %s
+ </p>
+ </div>¶",
+ 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"¶ <div class="substance">
+ <p class="%s">
+ %s
+ </p>
+ </div>¶",
+ obj.is_a,
+ obj.text
+ );
+ } 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,
+ obj.text
+ );
+ }
+ return o;
+ }
+ auto endnote(O)(
+ auto ref const O obj,
+ ) {
+ string o;
+ o = format(q"¶ <p class="%s" indent="h%si%s">
+ %s
+ </p>¶",
+ 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"¶ <div class="substance">
+ <p class="%s">
+%s
+ </p>
+ </div>¶",
+ obj.is_a,
+ obj.text
+ );
+ } 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,
+ obj.text
+ );
+ }
+ return o;
+ }
+ }
+}