aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output_html.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-12-29 20:36:41 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit249e8d2d61f3650d934582b65200ca8fa0b47495 (patch)
tree0d03750aa9a4897c0277d85f49a9505f03b1d1c3 /src/sdp/output_html.d
parentnaming (diff)
dom structure, levels marked up & collapsed (use e.g. in epub toc)doc-reform_v0.0.10
Diffstat (limited to 'src/sdp/output_html.d')
-rw-r--r--src/sdp/output_html.d134
1 files changed, 96 insertions, 38 deletions
diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d
index 5cd1b26..0390799 100644
--- a/src/sdp/output_html.d
+++ b/src/sdp/output_html.d
@@ -16,23 +16,38 @@ template SiSUoutputHTML() {
) {
auto tags = _html_anchor_tags(obj.anchor_tags);
string o;
- o = format(q"¶<br><hr /><br>
+ 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,
- );
+ 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 html_para(O)(
@@ -42,13 +57,10 @@ template SiSUoutputHTML() {
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
- <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
<p class="%s" indent="h%si%s">%s
%s
</p>
</div>¶",
- obj.obj_cite_number,
- obj.obj_cite_number,
obj.is_a,
obj.indent_hang,
obj.indent_base,
@@ -78,18 +90,29 @@ template SiSUoutputHTML() {
auto ref const O obj,
) {
string o;
- o = format(q"¶ <div class="substance">
+ 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
- );
+ obj.obj_cite_number,
+ obj.obj_cite_number,
+ obj.is_a,
+ obj.obj_cite_number,
+ obj.text
+ );
+ }
return o;
}
auto scroll_head_html() {
@@ -99,7 +122,7 @@ template SiSUoutputHTML() {
<head>
<meta charset="utf-8">
<title>
- Title
+ %s%s
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="dc.title" content="Title" />
@@ -120,7 +143,10 @@ template SiSUoutputHTML() {
<link href="../../../_sisu/css/html.css" rel="stylesheet">
</head>
<body lang="en">
- <a name="top" id="top"></a>¶");
+ <a name="top" id="top"></a>¶",
+ dochead_meta["title"]["full"],
+ (dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"],
+ );
return o;
}
auto html_toc(O)(
@@ -175,7 +201,7 @@ template SiSUoutputHTML() {
string[] doc;
foreach (part; document_section_keys_sequenced["scroll"]) {
foreach (obj; contents[part]) {
- if (obj.use == "content") {
+ if (obj.use == "frontmatter") {
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -185,22 +211,23 @@ template SiSUoutputHTML() {
case "toc":
body_html ~= html_toc(obj);
break;
- case "para":
- body_html ~= html_para(obj);
- break;
- case "endnote":
- body_html ~= html_endnote(obj);
- break;
- case "glossary":
- body_html ~= html_para(obj);
- break;
- case "bibliography":
- body_html ~= html_para(obj);
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
break;
- case "bookindex":
- body_html ~= html_para(obj);
+ }
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ } else if (obj.use == "body") {
+ switch (obj.is_of) {
+ case "para":
+ switch (obj.is_a) {
+ case "heading":
+ body_html ~= html_heading(obj);
break;
- case "blurb":
+ case "para":
body_html ~= html_para(obj);
break;
default:
@@ -239,6 +266,37 @@ template SiSUoutputHTML() {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_of);
break;
}
+ } else if (obj.use == "backmatter") {
+ switch (obj.is_of) {
+ case "para":
+ switch (obj.is_a) {
+ case "heading":
+ body_html ~= html_heading(obj);
+ break;
+ case "endnote":
+ body_html ~= html_endnote(obj);
+ break;
+ case "glossary":
+ body_html ~= html_para(obj);
+ break;
+ case "bibliography":
+ body_html ~= html_para(obj);
+ break;
+ case "bookindex":
+ body_html ~= html_para(obj);
+ break;
+ case "blurb":
+ body_html ~= html_para(obj);
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
}
}
}