aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--org/output_xmls.org50
-rw-r--r--src/sdp/output/epub3.d17
-rw-r--r--src/sdp/output/html.d33
3 files changed, 58 insertions, 42 deletions
diff --git a/org/output_xmls.org b/org/output_xmls.org
index 18a0315..2e9e72c 100644
--- a/org/output_xmls.org
+++ b/org/output_xmls.org
@@ -1110,7 +1110,7 @@ void scroll(D,I)(
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
switch (obj.use) {
- case "frontmatter":
+ case "frontmatter": assert(part == "head" || "toc_scroll");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -1134,7 +1134,8 @@ void scroll(D,I)(
break;
}
break;
- case "body":
+ case "body": // assert(part == "body");
+ assert(part == "body" || "head"); // surprise
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -1188,25 +1189,26 @@ void scroll(D,I)(
}
break;
case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_scroll" || "blurb" || "tail");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
case "heading":
doc_html ~= xhtml_format.heading_scroll(obj, _txt, suffix);
break;
- case "endnote":
+ case "endnote": assert(part == "endnotes");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "glossary":
+ case "glossary": assert(part == "glossary");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "bibliography":
+ case "bibliography": assert(part == "bibliography");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "bookindex":
+ case "bookindex": assert(part == "bookindex_scroll");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "blurb":
+ case "blurb": assert(part == "blurb");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
default:
@@ -1293,6 +1295,7 @@ void seg(D,I)(
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.is_a == "heading") {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.heading_lev_markup) {
case 0: .. case 3:
/+ fill buffer, and replace with new levels from 1 to 3 +/
@@ -1350,8 +1353,9 @@ void seg(D,I)(
break;
}
} else {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.use) {
- case "frontmatter":
+ case "frontmatter": assert(part == "head" || "toc_seg");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -1373,7 +1377,7 @@ void seg(D,I)(
break;
}
break;
- case "body":
+ case "body": assert(part == "body");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -1435,29 +1439,30 @@ void seg(D,I)(
}
break;
case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
- case "endnote":
+ case "endnote": assert(part == "endnotes");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
break;
- case "glossary":
+ case "glossary": assert(part == "glossary");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case "bibliography":
+ case "bibliography": assert(part == "bibliography");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case "bookindex":
+ case "bookindex": assert(part == "bookindex_seg");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case "blurb":
+ case "blurb": assert(part == "blurb");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
@@ -1912,6 +1917,7 @@ void outputEPub3(D,I)(
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.is_a == "heading") {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.heading_lev_markup) {
case 0: .. case 3:
/+ fill buffer, and replace with new levels from 1 to 3 +/
@@ -1968,8 +1974,9 @@ void outputEPub3(D,I)(
break;
}
} else {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.use) {
- case "frontmatter":
+ case "frontmatter": assert(part == "head" || "toc_seg");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -1992,7 +1999,7 @@ void outputEPub3(D,I)(
break;
}
break;
- case "body":
+ case "body": assert(part == "body");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -2055,29 +2062,30 @@ void outputEPub3(D,I)(
}
break;
case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
- case "endnote":
+ case "endnote": assert(part == "endnotes");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
break;
- case "glossary":
+ case "glossary": assert(part == "glossary");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "bibliography":
+ case "bibliography": assert(part == "bibliography");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "bookindex":
+ case "bookindex": assert(part == "bookindex_seg");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "blurb":
+ case "blurb": assert(part == "blurb");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d
index b05cf20..2c014b5 100644
--- a/src/sdp/output/epub3.d
+++ b/src/sdp/output/epub3.d
@@ -287,6 +287,7 @@ template outputEPub3() {
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.is_a == "heading") {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.heading_lev_markup) {
case 0: .. case 3:
/+ fill buffer, and replace with new levels from 1 to 3 +/
@@ -343,8 +344,9 @@ template outputEPub3() {
break;
}
} else {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.use) {
- case "frontmatter":
+ case "frontmatter": assert(part == "head" || "toc_seg");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -367,7 +369,7 @@ template outputEPub3() {
break;
}
break;
- case "body":
+ case "body": assert(part == "body");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -430,29 +432,30 @@ template outputEPub3() {
}
break;
case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
- case "endnote":
+ case "endnote": assert(part == "endnotes");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
break;
- case "glossary":
+ case "glossary": assert(part == "glossary");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "bibliography":
+ case "bibliography": assert(part == "bibliography");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "bookindex":
+ case "bookindex": assert(part == "bookindex_seg");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "blurb":
+ case "blurb": assert(part == "blurb");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d
index 6712469..1b984fe 100644
--- a/src/sdp/output/html.d
+++ b/src/sdp/output/html.d
@@ -27,7 +27,7 @@ template outputHTML() {
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
switch (obj.use) {
- case "frontmatter":
+ case "frontmatter": assert(part == "head" || "toc_scroll");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -51,7 +51,8 @@ template outputHTML() {
break;
}
break;
- case "body":
+ case "body": // assert(part == "body");
+ assert(part == "body" || "head"); // surprise
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -105,25 +106,26 @@ template outputHTML() {
}
break;
case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_scroll" || "blurb" || "tail");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
case "heading":
doc_html ~= xhtml_format.heading_scroll(obj, _txt, suffix);
break;
- case "endnote":
+ case "endnote": assert(part == "endnotes");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "glossary":
+ case "glossary": assert(part == "glossary");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "bibliography":
+ case "bibliography": assert(part == "bibliography");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "bookindex":
+ case "bookindex": assert(part == "bookindex_scroll");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
- case "blurb":
+ case "blurb": assert(part == "blurb");
doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix);
break;
default:
@@ -197,6 +199,7 @@ template outputHTML() {
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.is_a == "heading") {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.heading_lev_markup) {
case 0: .. case 3:
/+ fill buffer, and replace with new levels from 1 to 3 +/
@@ -254,8 +257,9 @@ template outputHTML() {
break;
}
} else {
+ assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.use) {
- case "frontmatter":
+ case "frontmatter": assert(part == "head" || "toc_seg");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -277,7 +281,7 @@ template outputHTML() {
break;
}
break;
- case "body":
+ case "body": assert(part == "body");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
@@ -339,29 +343,30 @@ template outputHTML() {
}
break;
case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
- case "endnote":
+ case "endnote": assert(part == "endnotes");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
break;
- case "glossary":
+ case "glossary": assert(part == "glossary");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case "bibliography":
+ case "bibliography": assert(part == "bibliography");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case "bookindex":
+ case "bookindex": assert(part == "bookindex_seg");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case "blurb":
+ case "blurb": assert(part == "blurb");
auto t = xhtml_format.para_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];