aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output_xmls.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/output_xmls.d')
-rw-r--r--src/sdp/output_xmls.d99
1 files changed, 53 insertions, 46 deletions
diff --git a/src/sdp/output_xmls.d b/src/sdp/output_xmls.d
index 27b6585..347409e 100644
--- a/src/sdp/output_xmls.d
+++ b/src/sdp/output_xmls.d
@@ -31,12 +31,20 @@ template outputXHTMLs() {
mixin SiSUoutputRgxInit;
struct outputXHTMLs {
auto rgx = Rgx();
- string special_characters(string _txt){
+ string special_characters(O)(
+ auto return ref const O obj,
+ string _txt
+ ){
_txt = (_txt)
- .replaceAll(rgx.xhtml_ampersand, "&")
- .replaceAll(rgx.xhtml_less_than, "<")
- .replaceAll(rgx.xhtml_greater_than, ">")
- .replaceAll(rgx.xhtml_line_break, "<br />");
+ .replaceAll(rgx.xhtml_ampersand, "&#38;")
+ .replaceAll(rgx.xhtml_quotation, "&#34;")
+ .replaceAll(rgx.xhtml_less_than, "&#60;")
+ .replaceAll(rgx.xhtml_greater_than, "&#62;")
+ .replaceAll(rgx.nbsp_char, " ");
+ if (!(obj.is_a == "code")) {
+ _txt = (_txt)
+ .replaceAll(rgx.xhtml_line_break, "<br />");
+ }
return _txt;
}
string font_face(string _txt){
@@ -313,26 +321,25 @@ template outputXHTMLs() {
}
auto inline_markup_scroll(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- string _txt = obj.text;
- _txt = special_characters(_txt);
_txt = inline_links(obj, _txt, _suffix, "scroll");
_txt = inline_notes_scroll(obj, _txt);
return _txt;
}
auto inline_markup_seg(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- string _txt = obj.text;
- _txt = special_characters(_txt);
_txt = inline_links(obj, _txt, _suffix, "seg");
auto t = inline_notes_seg(obj, _txt);
return t;
}
- auto toc(O)(
+ auto toc_seg(O)(
auto return ref const O obj,
+ string _txt,
) {
string o;
o = format(q"¶ <div class="substance">
@@ -343,7 +350,7 @@ template outputXHTMLs() {
obj.is_a,
obj.indent_hang,
obj.indent_base,
- obj.text
+ _txt,
);
return o;
}
@@ -395,19 +402,21 @@ template outputXHTMLs() {
}
auto heading_scroll(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- string _txt = inline_markup_scroll(obj, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
string o = heading(obj, _txt);
return o;
}
auto heading_seg(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- auto t = inline_markup_seg(obj, _suffix);
- string _txt = t[0];
+ auto t = inline_markup_seg(obj, _txt, _suffix);
+ _txt = t[0];
string[] _endnotes = t[1];
string o = heading(obj, _txt);
auto u = tuple(
@@ -457,19 +466,21 @@ template outputXHTMLs() {
}
auto para_scroll(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- string _txt = inline_markup_scroll(obj, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
string o = para(obj, _txt);
return o;
}
auto para_seg(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- auto t = inline_markup_seg(obj, _suffix);
- string _txt = to!string(t[0]);
+ auto t = inline_markup_seg(obj, _txt, _suffix);
+ _txt = to!string(t[0]);
string[] _endnotes = t[1];
string o = para(obj, _txt);
auto u = tuple(
@@ -511,19 +522,21 @@ template outputXHTMLs() {
}
auto quote_scroll(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- string _txt = inline_markup_scroll(obj, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
string o = quote(obj, _txt);
return o;
}
auto quote_seg(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- auto t = inline_markup_seg(obj, _suffix);
- string _txt = to!string(t[0]);
+ auto t = inline_markup_seg(obj, _txt, _suffix);
+ _txt = to!string(t[0]);
string[] _endnotes = t[1];
string o = quote(obj, _txt);
auto u = tuple(
@@ -565,19 +578,21 @@ template outputXHTMLs() {
}
auto group_scroll(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- string _txt = inline_markup_scroll(obj, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
string o = group(obj, _txt);
return o;
}
auto group_seg(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- auto t = inline_markup_seg(obj, _suffix);
- string _txt = to!string(t[0]);
+ auto t = inline_markup_seg(obj, _txt, _suffix);
+ _txt = to!string(t[0]);
string[] _endnotes = t[1];
string o = group(obj, _txt);
auto u = tuple(
@@ -615,19 +630,21 @@ template outputXHTMLs() {
}
auto block_scroll(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- string _txt = inline_markup_scroll(obj, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
string o = block(obj, _txt);
return o;
}
auto block_seg(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- auto t = inline_markup_seg(obj, _suffix);
- string _txt = to!string(t[0]);
+ auto t = inline_markup_seg(obj, _txt, _suffix);
+ _txt = to!string(t[0]);
string[] _endnotes = t[1];
string o = block(obj, _txt);
auto u = tuple(
@@ -641,11 +658,6 @@ template outputXHTMLs() {
string _txt,
) {
_txt = font_face(_txt);
- _txt = (_txt)
- .replaceAll(rgx.newline, "<br />\n")
- .replaceAll(rgx.two_spaces, "&#160;" ~ "&#160;" ~ "&#160;" ~ "&#160;")
- .replaceAll(rgx.nbsp_and_space, "&#160;" ~ "&#160;")
- .replaceAll(rgx.strip_br, "");
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
@@ -670,19 +682,21 @@ template outputXHTMLs() {
}
auto verse_scroll(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- string _txt = inline_markup_scroll(obj, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
string o = verse(obj, _txt);
return o;
}
auto verse_seg(O)(
auto return ref const O obj,
+ string _txt,
string _suffix = ".html",
) {
- auto t = inline_markup_seg(obj, _suffix);
- string _txt = to!string(t[0]);
+ auto t = inline_markup_seg(obj, _txt, _suffix);
+ _txt = to!string(t[0]);
string[] _endnotes = t[1];
string o = verse(obj, _txt);
auto u = tuple(
@@ -726,8 +740,8 @@ template outputXHTMLs() {
}
auto table(O)(
auto return ref const O obj,
+ string _txt,
) {
- string _txt = obj.text;
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
_txt = font_face(_txt);
auto t = tablarize(obj, _txt);
@@ -755,6 +769,7 @@ template outputXHTMLs() {
}
auto endnote(O)(
auto return ref const O obj,
+ string _txt,
) {
string o;
o = format(q"¶ <p class="%s" indent="h%si%s">
@@ -763,20 +778,14 @@ template outputXHTMLs() {
obj.is_a,
obj.indent_hang,
obj.indent_base,
- obj.text
+ _txt
);
return o;
}
auto code(O)(
auto return ref const O obj,
+ string _txt,
) {
- string _txt = obj.text;
- _txt = (_txt)
- .replaceAll(rgx.xhtml_ampersand, "&#38;")
- .replaceAll(rgx.xhtml_quotation, "&#34;")
- .replaceAll(rgx.xhtml_less_than, "&#60;")
- .replaceAll(rgx.xhtml_greater_than, "&#62;")
- .replaceAll(rgx.nbsp_char, " ");
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
@@ -788,9 +797,7 @@ template outputXHTMLs() {
} 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>
+ <p class="%s" id="%s">%s</p>
</div>¶",
obj.obj_cite_number,
obj.obj_cite_number,