aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-03-28 21:08:52 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commite162e70ec5e83bf33fadc59e2375547828b81581 (patch)
treebdcb61244668b872017deea59b0ba347e1a85fe5
parent0.13.8 endnotes for various types of block (diff)
start work on block outputs
-rw-r--r--org/defaults.org1
-rw-r--r--org/output.org276
-rw-r--r--src/sdp/ao_rgx.d1
-rw-r--r--src/sdp/output_epub.d16
-rw-r--r--src/sdp/output_html.d24
-rw-r--r--src/sdp/output_rgx.d1
-rw-r--r--src/sdp/output_xhtmls.d170
7 files changed, 454 insertions, 35 deletions
diff --git a/org/defaults.org b/org/defaults.org
index b666c30..cb4ee80 100644
--- a/org/defaults.org
+++ b/org/defaults.org
@@ -1184,6 +1184,7 @@ template SiSUlanguageCodes() {
#+name: prgmkup_rgx
#+BEGIN_SRC d
static newline = ctRegex!("\n", "mg");
+static strip_br = ctRegex!("^<br>\n|<br>\n*$");
static space = ctRegex!(`[ ]`, "mg");
static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg");
static spaces_multiple = ctRegex!(`(?P<multiple_spaces>[ ]{2,})`, "mg"); // could be issues for endnotes
diff --git a/org/output.org b/org/output.org
index c59b037..e84796d 100644
--- a/org/output.org
+++ b/org/output.org
@@ -776,13 +776,163 @@ auto para_seg(O)(
}
#+END_SRC
-**** nugget
+**** quote
+
+***** quote
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto quote(O)(
+ auto return ref const O obj,
+ string _txt,
+) {
+ _txt = font_face(_txt);
+ 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;
+}
+#+END_SRC
+
+***** scroll
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto quote_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = quote(obj, _txt);
+ return o;
+}
+#+END_SRC
+***** seg
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto quote_seg(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = quote(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+}
+#+END_SRC
+
+**** group
+
+***** group
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto group(O)(
+ auto return ref const O obj,
+ string _txt,
+) {
+ _txt = font_face(_txt);
+ 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;
+}
+#+END_SRC
+
+***** scroll
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto group_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = group(obj, _txt);
+ return o;
+}
+#+END_SRC
+***** seg
#+name: xhtml_format_objects
#+BEGIN_SRC d
-auto nugget(O)(
+auto group_seg(O)(
auto return ref const O obj,
+ string _suffix = ".html",
) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = group(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+}
+#+END_SRC
+
+**** block
+
+***** block
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto block(O)(
+ auto return ref const O obj,
+ string _txt,
+) {
+ _txt = font_face(_txt);
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
@@ -791,7 +941,8 @@ auto nugget(O)(
</p>
</div>¶",
obj.is_a,
- obj.text
+ _txt
+ // obj.text
);
} else {
o = format(q"¶ <div class="substance">
@@ -804,25 +955,63 @@ auto nugget(O)(
obj.obj_cite_number,
obj.is_a,
obj.obj_cite_number,
- obj.text
+ _txt
+ // obj.text
);
}
return o;
}
#+END_SRC
+***** scroll
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto block_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = block(obj, _txt);
+ return o;
+}
+#+END_SRC
+***** seg
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto block_seg(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = block(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+}
+#+END_SRC
+
**** poem verse
+***** verse
#+name: xhtml_format_objects
#+BEGIN_SRC d
auto verse(O)( // using code from code block, review
auto return ref const O obj,
+ string _txt,
) {
- string _txt = obj.text;
+ _txt = font_face(_txt);
_txt = (_txt)
.replaceAll(rgx.newline, "<br>\n")
.replaceAll(rgx.two_spaces, "&nbsp;" ~ "&nbsp;" ~ "&nbsp;" ~ "&nbsp;")
- .replaceAll(rgx.nbsp_and_space, "&nbsp;" ~ "&nbsp;");
+ .replaceAll(rgx.nbsp_and_space, "&nbsp;" ~ "&nbsp;")
+ .replaceAll(rgx.strip_br, "");
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
@@ -851,6 +1040,41 @@ auto verse(O)( // using code from code block, review
}
#+END_SRC
+***** scroll
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto verse_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = verse(obj, _txt);
+ return o;
+}
+#+END_SRC
+
+***** seg
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto verse_seg(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = verse(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+}
+#+END_SRC
+
**** code
#+name: xhtml_format_objects_code
@@ -1070,18 +1294,18 @@ void scroll(D,I)(
case "block":
switch (obj.is_a) {
case "quote":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.quote_scroll(obj);
break;
case "group":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.group_scroll(obj);
break;
case "block":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.block_scroll(obj);
break;
case "poem":
break;
case "verse":
- doc_html ~= xhtml_format.verse(obj);
+ doc_html ~= xhtml_format.verse_scroll(obj, suffix);
break;
case "code":
doc_html ~= xhtml_format.code(obj);
@@ -1304,18 +1528,26 @@ void seg(D,I)(
case "block":
switch (obj.is_a) {
case "quote":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.quote_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1];
break;
case "group":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.group_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1];
break;
case "block":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.block_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1];
break;
case "poem":
break;
case "verse":
- doc_html[segment_filename] ~= xhtml_format.verse(obj);
+ auto t = xhtml_format.verse_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1]; // work on
break;
case "code":
doc_html[segment_filename] ~= xhtml_format.code(obj);
@@ -2588,18 +2820,26 @@ void outputEPub(D,I)(
case "block":
switch (obj.is_a) {
case "quote":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.quote_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "group":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.group_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "block":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.block_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "poem":
break;
case "verse":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.verse_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "code":
doc_epub[segment_filename] ~= xhtml_format.code(obj);
diff --git a/src/sdp/ao_rgx.d b/src/sdp/ao_rgx.d
index 44e1be4..0844a5f 100644
--- a/src/sdp/ao_rgx.d
+++ b/src/sdp/ao_rgx.d
@@ -184,6 +184,7 @@ template SiSUrgxInit() {
auto language_code_and_filename =
ctRegex!("(am|bg|bn|br|ca|cs|cy|da|de|el|en|eo|es|et|eu|fi|fr|ga|gl|he|hi|hr|hy|ia|is|it|ja|ko|la|lo|lt|lv|ml|mr|nl|no|nn|oc|pl|pt|pt_BR|ro|ru|sa|se|sk|sl|sq|sr|sv|ta|te|th|tk|tr|uk|ur|vi|zh)/[A-Za-z0-9._-].+?[.](?:sst|ssm)$");
static newline = ctRegex!("\n", "mg");
+ static strip_br = ctRegex!("^<br>\n|<br>\n*$");
static space = ctRegex!(`[ ]`, "mg");
static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg");
static spaces_multiple = ctRegex!(`(?P<multiple_spaces>[ ]{2,})`, "mg"); // could be issues for endnotes
diff --git a/src/sdp/output_epub.d b/src/sdp/output_epub.d
index 2cbe885..0cc3a31 100644
--- a/src/sdp/output_epub.d
+++ b/src/sdp/output_epub.d
@@ -275,18 +275,26 @@ template outputEPub() {
case "block":
switch (obj.is_a) {
case "quote":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.quote_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "group":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.group_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "block":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.block_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "poem":
break;
case "verse":
- doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.verse_seg(obj, suffix);
+ doc_epub[segment_filename] ~= to!string(t[0]);
+ doc_epub_endnotes[segment_filename] ~= t[1];
break;
case "code":
doc_epub[segment_filename] ~= xhtml_format.code(obj);
diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d
index 9e66311..ba6adc8 100644
--- a/src/sdp/output_html.d
+++ b/src/sdp/output_html.d
@@ -81,18 +81,18 @@ template outputHTML() {
case "block":
switch (obj.is_a) {
case "quote":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.quote_scroll(obj);
break;
case "group":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.group_scroll(obj);
break;
case "block":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.block_scroll(obj);
break;
case "poem":
break;
case "verse":
- doc_html ~= xhtml_format.verse(obj);
+ doc_html ~= xhtml_format.verse_scroll(obj, suffix);
break;
case "code":
doc_html ~= xhtml_format.code(obj);
@@ -302,18 +302,26 @@ template outputHTML() {
case "block":
switch (obj.is_a) {
case "quote":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.quote_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1];
break;
case "group":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.group_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1];
break;
case "block":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ auto t = xhtml_format.block_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1];
break;
case "poem":
break;
case "verse":
- doc_html[segment_filename] ~= xhtml_format.verse(obj);
+ auto t = xhtml_format.verse_seg(obj, suffix);
+ doc_html[segment_filename] ~= to!string(t[0]);
+ doc_html_endnotes[segment_filename] ~= t[1]; // work on
break;
case "code":
doc_html[segment_filename] ~= xhtml_format.code(obj);
diff --git a/src/sdp/output_rgx.d b/src/sdp/output_rgx.d
index 9959590..0a5dcbb 100644
--- a/src/sdp/output_rgx.d
+++ b/src/sdp/output_rgx.d
@@ -5,6 +5,7 @@ template SiSUoutputRgxInit() {
private import defaults;
struct Rgx {
static newline = ctRegex!("\n", "mg");
+ static strip_br = ctRegex!("^<br>\n|<br>\n*$");
static space = ctRegex!(`[ ]`, "mg");
static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg");
static spaces_multiple = ctRegex!(`(?P<multiple_spaces>[ ]{2,})`, "mg"); // could be issues for endnotes
diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d
index f371121..2a86d4c 100644
--- a/src/sdp/output_xhtmls.d
+++ b/src/sdp/output_xhtmls.d
@@ -419,9 +419,65 @@ template outputXHTMLs() {
);
return u;
}
- auto nugget(O)(
+ auto quote(O)(
auto return ref const O obj,
+ string _txt,
+ ) {
+ _txt = font_face(_txt);
+ 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 quote_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = quote(obj, _txt);
+ return o;
+ }
+ auto quote_seg(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = quote(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ auto group(O)(
+ auto return ref const O obj,
+ string _txt,
) {
+ _txt = font_face(_txt);
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
@@ -430,7 +486,7 @@ template outputXHTMLs() {
</p>
</div>¶",
obj.is_a,
- obj.text
+ _txt
);
} else {
o = format(q"¶ <div class="substance">
@@ -443,19 +499,100 @@ template outputXHTMLs() {
obj.obj_cite_number,
obj.is_a,
obj.obj_cite_number,
- obj.text
+ _txt
);
}
return o;
}
+ auto group_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = group(obj, _txt);
+ return o;
+ }
+ auto group_seg(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = group(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ auto block(O)(
+ auto return ref const O obj,
+ string _txt,
+ ) {
+ _txt = font_face(_txt);
+ string o;
+ if (obj.obj_cite_number.empty) {
+ o = format(q"¶ <div class="substance">
+ <p class="%s">
+ %s
+ </p>
+ </div>¶",
+ obj.is_a,
+ _txt
+ // 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,
+ _txt
+ // obj.text
+ );
+ }
+ return o;
+ }
+ auto block_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = block(obj, _txt);
+ return o;
+ }
+ auto block_seg(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = block(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
auto verse(O)( // using code from code block, review
auto return ref const O obj,
+ string _txt,
) {
- string _txt = obj.text;
+ _txt = font_face(_txt);
_txt = (_txt)
.replaceAll(rgx.newline, "<br>\n")
.replaceAll(rgx.two_spaces, "&nbsp;" ~ "&nbsp;" ~ "&nbsp;" ~ "&nbsp;")
- .replaceAll(rgx.nbsp_and_space, "&nbsp;" ~ "&nbsp;");
+ .replaceAll(rgx.nbsp_and_space, "&nbsp;" ~ "&nbsp;")
+ .replaceAll(rgx.strip_br, "");
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
@@ -482,6 +619,29 @@ template outputXHTMLs() {
}
return o;
}
+ auto verse_scroll(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ string _txt = inline_markup_scroll(obj, _suffix); // issue
+ string o = verse(obj, _txt);
+ return o;
+ }
+ auto verse_seg(O)(
+ auto return ref const O obj,
+ string _suffix = ".html",
+ ) {
+ auto t = inline_markup_seg(obj, _suffix);
+ string _txt = to!string(t[0]);
+ string[] _endnotes = t[1];
+ string o = verse(obj, _txt);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
auto tablarize(O)(
auto return ref const O obj,
string _txt,