aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/output')
-rw-r--r--src/doc_reform/output/defaults.d2
-rw-r--r--src/doc_reform/output/rgx.d19
-rw-r--r--src/doc_reform/output/sqlite.d32
-rw-r--r--src/doc_reform/output/xmls.d5
4 files changed, 49 insertions, 9 deletions
diff --git a/src/doc_reform/output/defaults.d b/src/doc_reform/output/defaults.d
index e54afb9..a038802 100644
--- a/src/doc_reform/output/defaults.d
+++ b/src/doc_reform/output/defaults.d
@@ -33,6 +33,8 @@ template InternalMarkup() {
auto tc_c = "┚";
auto tc_p = "┆";
auto img = "☼";
+ auto on_o = "「"; auto on_c = "」";
+ auto mk_bullet = "● ";
static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") {
_indent_spaces = replicate(_indent_spaces, indent);
return _indent_spaces;
diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d
index 354de00..bf1d766 100644
--- a/src/doc_reform/output/rgx.d
+++ b/src/doc_reform/output/rgx.d
@@ -62,10 +62,13 @@ static template DocReformOutputRgxInit() {
static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)【(?:[*+ ]*)(?P<note>.+?)】`, "mg");
static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
/+ inline markup footnotes endnotes +/
- static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.+?├)`, "mg");
- static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.+?├)`, "mg");
- static inline_link_anchor = ctRegex!(`┋(?P<anchor>\S+?)┋`, "mg");
+ static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_link_anchor = ctRegex!(`┋(?P<anchor>\S+?)┋`, "mg"); // TODO *~text_link_anchor
+ static inline_link_ = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>\S+?)├`, "mg");
+ static inline_link_empty = ctRegex!(`┥(?P<text>.+?)┝┤├`, "mg");
+ static inline_link_number = ctRegex!(`┥(?P<text>.+?)┝┤(?P<num>[0-9]+)├`, "mg"); // not used
static inline_link_number_only = ctRegex!(`(┥.+?┝)┤(?P<num>[0-9]+)├`, "mg");
static inline_link_stow_uri = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>[^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links
static inline_link_hash = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>#(?P<segname>\S+?))├`, "mg");
@@ -116,10 +119,10 @@ static template DocReformOutputRgxInit() {
/+ table delimiters +/
static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg");
static table_delimiter_row = ctRegex!("[ ]*\n", "mg");
- static xhtml_ampersand = ctRegex!(`[&]`); // &amp;
- static xhtml_quotation = ctRegex!(`["]`); // &quot;
- static xhtml_less_than = ctRegex!(`[<]`); // &lt;
- static xhtml_greater_than = ctRegex!(`[>]`); // &gt;
- static xhtml_line_break = ctRegex!(` [\\]{2}`); // <br />
+ static xhtml_ampersand = ctRegex!(`[&]`, "m"); // &amp;
+ static xhtml_quotation = ctRegex!(`["]`, "m"); // &quot;
+ static xhtml_less_than = ctRegex!(`[<]`, "m"); // &lt;
+ static xhtml_greater_than = ctRegex!(`[>]`, "m"); // &gt;
+ static xhtml_line_break = ctRegex!(` [\\]{2}`, "m"); // <br />
}
}
diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d
index 5f4e99d..c57dde9 100644
--- a/src/doc_reform/output/sqlite.d
+++ b/src/doc_reform/output/sqlite.d
@@ -457,6 +457,10 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "heading");
string _txt = munge_html(doc_matters, obj);
_txt = inline_markup(doc_matters, obj, _txt);
string o = format(q"┋<p class="%s"><b>
@@ -471,6 +475,10 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "para" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
string _txt = munge_html(doc_matters, obj);
_txt = (obj.attrib.bullet) ? ("●&#160;&#160;" ~ _txt) : _txt;
_txt = inline_markup(doc_matters, obj, _txt);
@@ -488,6 +496,10 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "quote");
string _txt = munge_html(doc_matters, obj);
string o = format(q"┋<p class="%s">
%s
@@ -501,6 +513,10 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "group");
string _txt = munge_html(doc_matters, obj);
string o = format(q"┋<p class="%s">
%s
@@ -514,6 +530,10 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "block");
string _txt = munge_html(doc_matters, obj);
string o = format(q"┋
<p class="%s">%s</p>┋",
@@ -526,6 +546,10 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "verse");
string _txt = munge_html(doc_matters, obj);
string o = format(q"┋<p class="%s">%s</p>┋",
obj.metainfo.is_a,
@@ -536,6 +560,10 @@ template SQLiteFormatAndLoadObject() {
auto html_code(O)(
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "code");
string _txt = html_special_characters_code(obj.text);
string o = format(q"┋<p class="%s">%s</p>┋",
obj.metainfo.is_a,
@@ -547,6 +575,10 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
auto ref const O obj,
) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "table");
auto _tablarize(O)(
auto ref const O obj,
string _txt,
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d
index 266ad55..244a618 100644
--- a/src/doc_reform/output/xmls.d
+++ b/src/doc_reform/output/xmls.d
@@ -338,7 +338,10 @@ template outputXHTMLs() {
rgx.inline_image,
("$1<img src=\""
~ _img_pth
- ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6"));
+ ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6"))
+ .replaceAll(
+ rgx.inline_link_empty,
+ ("$1"));
}
return _txt;
}