aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-01-20 15:20:01 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-01-21 09:20:00 -0500
commit845f6440b8d2a672769f553a45aa1406c17d4c4f (patch)
tree4c0c0360922170f8b3c01c6a3199b9cdece92716 /src/doc_reform
parentorg files naming, minor (diff)
xmls, html group text output (bullets & indents)
Diffstat (limited to 'src/doc_reform')
-rw-r--r--src/doc_reform/io_out/epub3.d2
-rw-r--r--src/doc_reform/io_out/html.d4
-rw-r--r--src/doc_reform/io_out/rgx.d23
-rw-r--r--src/doc_reform/io_out/sqlite.d56
-rw-r--r--src/doc_reform/io_out/xmls.d43
-rw-r--r--src/doc_reform/meta/rgx.d3
6 files changed, 126 insertions, 5 deletions
diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d
index 2881b69..029a2c2 100644
--- a/src/doc_reform/io_out/epub3.d
+++ b/src/doc_reform/io_out/epub3.d
@@ -415,7 +415,7 @@ template outputEPub3() {
auto epubWrite = writeOut();
foreach (part; doc_matters.has.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
- string _txt = xhtml_format.special_characters(obj);
+ string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);
if (obj.metainfo.is_a == "heading") {
assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.heading_lev_markup) {
diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d
index dd77ab8..136229b 100644
--- a/src/doc_reform/io_out/html.d
+++ b/src/doc_reform/io_out/html.d
@@ -76,7 +76,7 @@ template outputHTML() {
foreach (part; doc_matters.has.keys_seq.scroll) {
foreach (obj; doc_abstraction[part]) {
delimit = xhtml_format.div_delimit(part, previous_part);
- string _txt = xhtml_format.special_characters(obj);
+ string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);
switch (obj.metainfo.is_of_part) {
case "frontmatter": assert(part == "head" || "toc");
switch (obj.metainfo.is_of_type) {
@@ -279,7 +279,7 @@ template outputHTML() {
foreach (part; doc_matters.has.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
delimit = xhtml_format.div_delimit(part, previous_part);
- string _txt = xhtml_format.special_characters(obj);
+ string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);
if (obj.metainfo.is_a == "heading") {
assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.heading_lev_markup) {
diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d
index 12392f9..7f3b9da 100644
--- a/src/doc_reform/io_out/rgx.d
+++ b/src/doc_reform/io_out/rgx.d
@@ -160,5 +160,28 @@ static template spineRgxOut() {
static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m");
static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg");
static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m");
+ /+ paragraph operators +/
+ static grouped_para_indent_1 = ctRegex!(`^_1[ ]`, "m");
+ static grouped_para_indent_2 = ctRegex!(`^_2[ ]`, "m");
+ static grouped_para_indent_3 = ctRegex!(`^_3[ ]`, "m");
+ static grouped_para_indent_4 = ctRegex!(`^_4[ ]`, "m");
+ static grouped_para_indent_5 = ctRegex!(`^_5[ ]`, "m");
+ static grouped_para_indent_6 = ctRegex!(`^_6[ ]`, "m");
+ static grouped_para_indent_7 = ctRegex!(`^_7[ ]`, "m");
+ static grouped_para_indent_8 = ctRegex!(`^_8[ ]`, "m");
+ static grouped_para_indent_9 = ctRegex!(`^_9[ ]`, "m");
+ static grouped_para_bullet = ctRegex!(`^_[*] `, "m");
+ static grouped_para_bullet_indent_1 = ctRegex!(`^_1[*] `, "m");
+ static grouped_para_bullet_indent_2 = ctRegex!(`^_2[*] `, "m");
+ static grouped_para_bullet_indent_3 = ctRegex!(`^_3[*] `, "m");
+ static grouped_para_bullet_indent_4 = ctRegex!(`^_4[*] `, "m");
+ static grouped_para_bullet_indent_5 = ctRegex!(`^_5[*] `, "m");
+ static grouped_para_bullet_indent_6 = ctRegex!(`^_6[*] `, "m");
+ static grouped_para_bullet_indent_7 = ctRegex!(`^_7[*] `, "m");
+ static grouped_para_bullet_indent_8 = ctRegex!(`^_8[*] `, "m");
+ static grouped_para_bullet_indent_9 = ctRegex!(`^_9[*] `, "m");
+ static grouped_para_bullet_indent = ctRegex!(`^_(?P<indent>[1-9])[*] `, "m");
+ static grouped_para_indent = ctRegex!(`^_(?P<indent>[1-9])[ ]`, "m");
+ static grouped_para_indent_hang = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`, "m");
}
}
diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d
index 58f8dd9..c1b55de 100644
--- a/src/doc_reform/io_out/sqlite.d
+++ b/src/doc_reform/io_out/sqlite.d
@@ -294,6 +294,57 @@ template SQLiteFormatAndLoadObject() {
.replaceAll(rgx.inline_cite, "<cite>$1</cite>");
return _txt;
}
+ string inline_grouped_text_bullets_indents(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ string _suffix = ".html",
+ string _xml_type = "seg",
+ ) {
+ static auto rgx = RgxO();
+ if (obj.metainfo.is_a == "group") {
+ _txt = (_txt)
+ .replaceAll(rgx.grouped_para_indent_1,
+ "&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_2,
+ "&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_3,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_4,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_5,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_6,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_7,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_8,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_9,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_hang, "&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet, "●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_1,
+ "&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_2,
+ "&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_3,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_4,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_5,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_6,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_7,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_8,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_9,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;");
+ }
+ return _txt;
+ }
string inline_images(M,O)(
M doc_matters,
const O obj,
@@ -457,6 +508,9 @@ template SQLiteFormatAndLoadObject() {
const O obj,
string _txt,
) {
+ if (obj.metainfo.is_a == "group") {
+ _txt = inline_grouped_text_bullets_indents(doc_matters, obj, _txt, xml_type);
+ }
_txt = inline_images(doc_matters, obj, _txt, xml_type);
_txt = inline_links(doc_matters, obj, _txt, xml_type);
_txt = inline_notes_scroll(doc_matters, obj, _txt);
@@ -527,6 +581,7 @@ template SQLiteFormatAndLoadObject() {
assert(obj.metainfo.is_of_type == "block");
assert(obj.metainfo.is_a == "group");
string _txt = munge_html(doc_matters, obj);
+ _txt = inline_markup(doc_matters, obj, _txt);
string o = format(q"┃<p class="%s">
%s
</p>┃",
@@ -544,6 +599,7 @@ template SQLiteFormatAndLoadObject() {
assert(obj.metainfo.is_of_type == "block");
assert(obj.metainfo.is_a == "block");
string _txt = munge_html(doc_matters, obj);
+ _txt = inline_markup(doc_matters, obj, _txt);
string o = format(q"┃
<p class="%s">%s</p>┃",
obj.metainfo.is_a,
diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d
index 0112df8..f0c7185 100644
--- a/src/doc_reform/io_out/xmls.d
+++ b/src/doc_reform/io_out/xmls.d
@@ -102,10 +102,51 @@ template outputXHTMLs() {
.replaceAll(rgx.nbsp_char, " ");
return _txt;
}
- @safe string special_characters(O)(
+ @safe string special_characters_breaks_indents_bullets(O)(
const O obj,
) {
string _txt = special_characters_text(obj.text);
+ if (obj.metainfo.is_a == "group") {
+ _txt = (_txt)
+ .replaceAll(rgx.grouped_para_indent_1,
+ "&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_2,
+ "&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_3,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_4,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_5,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_6,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_7,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_8,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_9,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_indent_hang, "&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet, "●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_1,
+ "&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_2,
+ "&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_3,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_4,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_5,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_6,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_7,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_8,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;")
+ .replaceAll(rgx.grouped_para_bullet_indent_9,
+ "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●&nbsp;&nbsp;");
+ }
if (!(obj.metainfo.is_a == "code")) {
_txt = (_txt)
.replaceAll(rgx.xhtml_line_break, "<br />");
diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d
index 78b86a4..5df1e9c 100644
--- a/src/doc_reform/meta/rgx.d
+++ b/src/doc_reform/meta/rgx.d
@@ -96,7 +96,7 @@ static template spineRgxIn() {
static raw_author_munge = ctRegex!(`(?P<last>\S.+?),\s+(?P<first>.+)`,"i");
static yaml_header_meta_title = ctRegex!(`^\s*title\s*:\s*(?:"?\w|$)`, "m");
static yaml_config = ctRegex!(`^[a-z]+\s*:\s*(?:"?\w|$)`, "m");
- /+ heading & paragraph operators +/
+ /+ heading operators +/
static heading_a = ctRegex!(`^:?[A][~] `, "m");
static heading = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+`,"i");
static headings = ctRegex!(`^:?(?P<level>[A-D1-4])[~](?:[a-z0-9_.-]*[?]?|[!](?:glossary|bibliogrphy|biblio|references?|blurb))(?:\s|$)`,"i");
@@ -112,6 +112,7 @@ static template spineRgxIn() {
static heading_biblio = ctRegex!(`^1[~][!](biblio(?:graphy)?|references?)`);
static heading_glossary = ctRegex!(`^1[~][!](glossary)`);
static heading_blurb = ctRegex!(`^1[~][!](blurb)`);
+ /+ paragraph operators +/
static para_bullet = ctRegex!(`^_[*] `);
static para_bullet_indent = ctRegex!(`^_(?P<indent>[1-9])[*] `);
static para_indent = ctRegex!(`^_(?P<indent>[1-9])[ ]`);