aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-03-22 14:54:07 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitcdaba1c73f0555e1128a7a35addddcfaf715dbde (patch)
treebae4b5cbacd1db42d993b5043ff9c66c8478f08c /src
parent0.13.6 dlang function calls, syntax (ufcs related), logic should be retained (diff)
0.13.7 tables ao and html output, poem html output
Diffstat (limited to 'src')
-rw-r--r--src/sdp/ao_abstract_doc_source.d904
-rw-r--r--src/sdp/ao_defaults.d5
-rw-r--r--src/sdp/ao_object_setter.d8
-rw-r--r--src/sdp/ao_rgx.d29
-rw-r--r--src/sdp/defaults.d4
-rw-r--r--src/sdp/output_html.d11
-rw-r--r--src/sdp/output_rgx.d5
-rw-r--r--src/sdp/output_xhtmls.d96
8 files changed, 733 insertions, 329 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index a277a61..de3d575 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -557,6 +557,10 @@ template SiSUdocAbstraction() {
type["ocn_status"] = TriState.off;
}
continue;
+ } else if (type["quote"] == TriState.on) {
+ /+ within block object: quote +/
+ _quote_block_(line, an_object, type);
+ continue;
/+ within block object: group +/
} else if (type["group"] == TriState.on) {
/+ within block object: group +/
@@ -570,13 +574,9 @@ template SiSUdocAbstraction() {
/+ within block object: poem +/
_poem_block_(line, an_object, type, cntr, obj_cite_number_poem, dochead_make_aa);
continue;
- } else if (type["quote"] == TriState.on) {
- /+ within block object: quote +/
- _quote_block_(line, an_object, type);
- continue;
} else if (type["table"] == TriState.on) {
/+ within block object: table +/
- _table_block_(line, an_object, type);
+ _table_block_(line, an_object, type, dochead_make_aa);
continue;
} else {
/+ not within a block group +/
@@ -1688,8 +1688,12 @@ template SiSUdocAbstraction() {
static assert(is(typeof(obj_cite_number_poem) == string[string]));
}
auto rgx = Rgx();
- if (line.matchFirst(rgx.block_curly_code_open)) {
+ string code_block_syntax = "";
+ bool code_block_numbered = false;
+ if (auto m = line.matchFirst(rgx.block_curly_code_open)) {
/+ curly code open +/
+ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
+ code_block_numbered = (m.captures[2] == "#") ? true : false;
debug(code) { // code (curly) open
writefln(
"* [code curly] %s",
@@ -1746,7 +1750,7 @@ template SiSUdocAbstraction() {
type["blocks"] = TriState.on;
type["quote"] = TriState.on;
type["curly_quote"] = TriState.on;
- } else if (line.matchFirst(rgx.block_curly_table_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) {
/+ curly table open +/
debug(table) { // table (curly) open
writefln(
@@ -1754,11 +1758,22 @@ template SiSUdocAbstraction() {
line
);
}
- type["blocks"] = TriState.on;
- type["table"] = TriState.on;
- type["curly_table"] = TriState.on;
- } else if (line.matchFirst(rgx.block_tic_code_open)) {
+ an_object["table_head"] = m.captures[1].to!string;
+ an_object["block_type"] = "curly";
+ type["blocks"] = TriState.on;
+ type["table"] = TriState.on;
+ type["curly_table"] = TriState.on;
+ } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) {
+ /+ table: special table block markup syntax! +/
+ an_object["table_head"] = m.captures[1].to!string;
+ an_object["block_type"] = "special";
+ type["blocks"] = TriState.on;
+ type["table"] = TriState.on;
+ type["curly_table_special_markup"] = TriState.on;
+ } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) {
/+ tic code open +/
+ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
+ code_block_numbered = (m.captures[2] == "#") ? true : false;
debug(code) { // code (tic) open
writefln(
"* [code tic] %s",
@@ -1814,7 +1829,7 @@ template SiSUdocAbstraction() {
type["blocks"] = TriState.on;
type["quote"] = TriState.on;
type["tic_quote"] = TriState.on;
- } else if (line.matchFirst(rgx.block_tic_table_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) {
/+ tic table open +/
debug(table) { // table (tic) open
writefln(
@@ -1822,12 +1837,14 @@ template SiSUdocAbstraction() {
line
);
}
- type["blocks"] = TriState.on;
- type["table"] = TriState.on;
- type["tic_table"] = TriState.on;
+ an_object["table_head"] = m.captures[1].to!string;
+ an_object["block_type"] = "tic";
+ type["blocks"] = TriState.on;
+ type["table"] = TriState.on;
+ type["tic_table"] = TriState.on;
}
}
- void _code_block_(L,O,T)(
+ void _quote_block_(L,O,T)(
return ref L line,
return ref O an_object,
return ref T type
@@ -1838,181 +1855,36 @@ template SiSUdocAbstraction() {
static assert(is(typeof(type) == int[string]));
}
auto rgx = Rgx();
- if (type["curly_code"] == TriState.on) {
- if (line.matchFirst(rgx.block_curly_code_close)) {
- debug(code) { // code (curly) close
+ if (type["curly_quote"] == TriState.on) {
+ if (line.matchFirst(rgx.block_curly_quote_close)) {
+ debug(quote) { // quote (curly) close
writeln(line);
}
- type["blocks"] = TriState.closing;
- type["code"] = TriState.closing;
- type["curly_code"] = TriState.off;
+ type["blocks"] = TriState.closing;
+ type["quote"] = TriState.closing;
+ type["curly_quote"] = TriState.off;
} else {
- debug(code) { // code (curly) line
+ debug(quote) {
writeln(line);
}
- an_object[an_object_key] ~= line ~= "\n"; // code (curly) line
+ an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
}
- } else if (type["tic_code"] == TriState.on) {
+ } else if (type["tic_quote"] == TriState.on) {
if (line.matchFirst(rgx.block_tic_close)) {
- debug(code) { // code (tic) close
+ debug(quote) { // quote (tic) close
writeln(line);
}
- type["blocks"] = TriState.closing;
- type["code"] = TriState.closing;
- type["tic_code"] = TriState.off;
+ type["blocks"] = TriState.closing;
+ type["quote"] = TriState.closing;
+ type["tic_quote"] = TriState.off;
} else {
- debug(code) { // code (tic) line
- writeln(line);
- }
- an_object[an_object_key] ~= line ~= "\n"; // code (tic) line
- }
- }
- }
- final string biblio_tag_map(A)(A abr) {
- debug(asserts) {
- static assert(is(typeof(abr) == string));
- }
- auto btm = [
- "au" : "author_raw",
- "ed" : "editor_raw",
- "ti" : "fulltitle",
- "lng" : "language",
- "jo" : "journal",
- "vol" : "volume",
- "edn" : "edition",
- "yr" : "year",
- "pl" : "place",
- "pb" : "publisher",
- "pub" : "publisher",
- "pg" : "pages",
- "pgs" : "pages",
- "sn" : "short_name"
- ];
- return btm[abr];
- }
- void _biblio_block_(
- char[] line,
- return ref int[string] type,
- return ref int bib_entry,
- return ref string biblio_entry_str_json,
- return ref string[] biblio_arr_json
- ) {
- mixin SiSUbiblio;
- auto jsn = BibJsnStr();
- auto rgx = Rgx();
- if (line.matchFirst(rgx.heading_biblio)) {
- type["biblio_section"] = TriState.on;
- type["blurb_section"] = State.off;
- type["glossary_section"] = State.off;
- }
- if (line.empty) {
- debug {
- debug(biblioblock) {
- writeln("---");
- }
- debug(biblioblockinclude) {
- writeln(biblio_entry_str_json.length);
- }
- }
- if ((bib_entry == State.off)
- && (biblio_entry_str_json.empty)) {
- bib_entry = State.on;
- biblio_entry_str_json = jsn.biblio_entry_tags_jsonstr;
- } else if (!(biblio_entry_str_json.empty)) {
- bib_entry = State.off;
- if (!(biblio_entry_str_json == jsn.biblio_entry_tags_jsonstr)) {
- auto biblio_entry = parseJSON(biblio_entry_str_json);
- if (biblio_entry["fulltitle"].str.empty) {
- writeln("check problem entry (Title missing): ", biblio_entry_str_json);
- } else if ((biblio_entry["author_raw"].str.empty) && (biblio_entry["editor_raw"].str.empty)) {
- writeln("check problem entry (No author and no editor): ", biblio_entry_str_json);
- } else {
- biblio_arr_json ~= biblio_entry_str_json;
- }
- biblio_entry_str_json = jsn.biblio_entry_tags_jsonstr;
- }
- } else { // CHECK ERROR
- writeln("?? 2. ERROR ", biblio_entry_str_json, "??");
- biblio_entry_str_json = "";
- }
- } else if (line.matchFirst(rgx.biblio_tags)) {
- debug(biblioblock) {
- writeln(line);
- }
- auto bt = line.match(rgx.biblio_tags);
- bib_entry = State.off;
- st = bt.captures[1].to!string;
- auto header_tag_value=(bt.captures[2]).to!string;
- JSONValue j = parseJSON(biblio_entry_str_json);
- biblio_tag_name = (st.match(rgx.biblio_abbreviations))
- ? (biblio_tag_map(st))
- : st;
- j.object[biblio_tag_name] = header_tag_value;
- debug(bibliounsortedcheckduplicates) {
- writeln(biblio_tag_name, ": ", header_tag_value);
- writeln("--");
- }
- switch (biblio_tag_name) {
- case "author_raw": // author_arr author (fn sn)
- j["author_arr"] =
- header_tag_value.split(rgx.arr_delimiter);
- string tmp;
- biblioAuthorLoop:
- foreach (au; j["author_arr"].array) {
- if (auto x = au.str.match(rgx.name_delimiter)) {
- tmp ~= x.captures[2] ~ " " ~ x.captures[1] ~ ", ";
- } else {
- tmp ~= au.str;
- }
- }
- tmp = (tmp).replace(rgx.trailing_comma, "");
- j["author"].str = tmp;
- goto default;
- case "editor_raw": // editor_arr editor (fn sn)
- j["editor_arr"] =
- header_tag_value.split(rgx.arr_delimiter);
- string tmp;
- biblioEditorLoop:
- foreach (ed; j["editor_arr"].array) {
- if (auto x = ed.str.match(rgx.name_delimiter)) {
- tmp ~= x.captures[2] ~ " " ~ x.captures[1] ~ ", ";
- } else {
- tmp ~= ed.str;
- }
- }
- tmp = (tmp).replace(rgx.trailing_comma, "");
- j["editor"].str = tmp;
- goto default;
- case "fulltitle": // title & subtitle
- goto default;
- default:
- break;
- }
- auto s = j.toString();
- debug(biblio1) {
- writefln(
- "* %s: %s\n%s",
- biblio_tag_name,
- biblio_tag_entry,
- j[biblio_tag_name]
- );
- }
- if (line.match(rgx.comment)) {
- writeln("ERROR", line, "COMMENT");
- writeln("ERROR", s, "%%");
- }
- if (!(match(line, rgx.comment))) {
- debug(biblioblockinclude) {
+ debug(quote) {
writeln(line);
}
- biblio_entry_str_json = s;
- } else {
- biblio_entry_str_json = "";
+ an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
}
- header_tag_value="";
}
}
- //
void _group_block_(L,O,T)(
return ref L line,
return ref O an_object,
@@ -2114,47 +1986,50 @@ template SiSUdocAbstraction() {
auto rgx = Rgx();
if (type["curly_poem"] == TriState.on) {
if (line.matchFirst(rgx.block_curly_poem_close)) {
- an_object[an_object_key]="verse";
- debug(poem) { // poem (curly) close
- writefln(
- "* [poem curly] %s",
- line
- );
- }
- if (processing.length > 0) {
- an_object[an_object_key] = processing["verse"];
- }
- debug(poem) { // poem (curly) close
- writeln(__LINE__);
- writefln(
- "* %s %s",
- obj_cite_number,
- line
- );
- }
- if (an_object.length > 0) {
- debug(poem) { // poem (curly) close
- writeln(
+ if (an_object_key in an_object
+ || processing.length > 0) {
+ an_object[an_object_key] = "";
+ debug(poem) { // poem (curly) close
+ writefln(
+ "* [poem curly] %s",
+ line
+ );
+ }
+ if (processing.length > 0) {
+ an_object[an_object_key] = processing["verse"];
+ }
+ debug(poem) { // poem (curly) close
+ writeln(__LINE__);
+ writefln(
+ "* %s %s",
obj_cite_number,
- an_object[an_object_key]
+ line
);
}
- an_object["is"] = "verse";
- auto substantive_obj_misc_tuple =
- obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
- an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
- comp_obj_block = comp_obj_block.init;
- comp_obj_block.use = "body";
- comp_obj_block.is_of = "block";
- comp_obj_block.is_a = "verse";
- comp_obj_block.ocn = obj_cite_number;
- comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
- comp_obj_block.text = an_object["substantive"];
- comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
- comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
- comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links];
- the_document_body_section ~= comp_obj_block;
+ if (an_object.length > 0) {
+ debug(poem) { // poem (curly) close
+ writeln(
+ obj_cite_number,
+ an_object[an_object_key]
+ );
+ }
+ an_object["is"] = "verse";
+ auto substantive_obj_misc_tuple =
+ obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
+ an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
+ anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ comp_obj_block = comp_obj_block.init;
+ comp_obj_block.use = "body";
+ comp_obj_block.is_of = "block";
+ comp_obj_block.is_a = "verse";
+ comp_obj_block.ocn = obj_cite_number;
+ comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
+ comp_obj_block.text = an_object["substantive"];
+ comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
+ comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
+ comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links];
+ the_document_body_section ~= comp_obj_block;
+ }
object_reset(an_object);
processing.remove("verse");
++cntr;
@@ -2185,7 +2060,7 @@ template SiSUdocAbstraction() {
);
}
processing.remove("verse");
- an_object["is"] = "verse";
+ an_object["is"] = "verse";
auto comp_obj_location = node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
@@ -2232,7 +2107,7 @@ template SiSUdocAbstraction() {
writeln(obj_cite_number, line);
}
processing.remove("verse");
- an_object["is"] = "verse";
+ an_object["is"] = "verse";
auto substantive_obj_misc_tuple =
obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
@@ -2277,7 +2152,7 @@ template SiSUdocAbstraction() {
);
}
processing.remove("verse");
- an_object["is"] = "verse";
+ an_object["is"] = "verse";
auto comp_obj_location =
node_construct.node_location_emitter(
content_non_header,
@@ -2309,7 +2184,7 @@ template SiSUdocAbstraction() {
}
}
}
- void _quote_block_(L,O,T)(
+ void _code_block_(L,O,T)(
return ref L line,
return ref O an_object,
return ref T type
@@ -2320,40 +2195,41 @@ template SiSUdocAbstraction() {
static assert(is(typeof(type) == int[string]));
}
auto rgx = Rgx();
- if (type["curly_quote"] == TriState.on) {
- if (line.matchFirst(rgx.block_curly_quote_close)) {
- debug(quote) { // quote (curly) close
+ if (type["curly_code"] == TriState.on) {
+ if (line.matchFirst(rgx.block_curly_code_close)) {
+ debug(code) { // code (curly) close
writeln(line);
}
- type["blocks"] = TriState.closing;
- type["quote"] = TriState.closing;
- type["curly_quote"] = TriState.off;
+ type["blocks"] = TriState.closing;
+ type["code"] = TriState.closing;
+ type["curly_code"] = TriState.off;
} else {
- debug(quote) {
+ debug(code) { // code (curly) line
writeln(line);
}
- an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
+ an_object[an_object_key] ~= line ~= "\n"; // code (curly) line
}
- } else if (type["tic_quote"] == TriState.on) {
+ } else if (type["tic_code"] == TriState.on) {
if (line.matchFirst(rgx.block_tic_close)) {
- debug(quote) { // quote (tic) close
+ debug(code) { // code (tic) close
writeln(line);
}
- type["blocks"] = TriState.closing;
- type["quote"] = TriState.closing;
- type["tic_quote"] = TriState.off;
+ type["blocks"] = TriState.closing;
+ type["code"] = TriState.closing;
+ type["tic_code"] = TriState.off;
} else {
- debug(quote) {
+ debug(code) { // code (tic) line
writeln(line);
}
- an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
+ an_object[an_object_key] ~= line ~= "\n"; // code (tic) line
}
}
}
- void _table_block_(L,O,T)(
+ void _table_block_(L,O,T,Ma)(
return ref L line,
return ref O an_object,
- return ref T type
+ return ref T type,
+ return ref Ma dochead_make_aa
) {
debug(asserts) {
static assert(is(typeof(line) == char[]));
@@ -2375,6 +2251,27 @@ template SiSUdocAbstraction() {
}
an_object[an_object_key] ~= line ~= "\n"; // build table array (or string)
}
+ } else if (type["curly_table_special_markup"] == TriState.on) {
+ if (line.empty) {
+ type["blocks"] = TriState.off;
+ type["table"] = TriState.off;
+ type["curly_table_special_markup"] = TriState.off;
+ _table_closed_make_special_notation_table_(
+ line,
+ an_object,
+ the_document_body_section,
+ obj_cite_number,
+ comp_obj_heading,
+ cntr,
+ type,
+ dochead_make_aa
+ );
+ } else {
+ debug(table) {
+ writeln(line);
+ }
+ an_object[an_object_key] ~= line ~= "\n";
+ }
} else if (type["tic_table"] == TriState.on) {
if (line.matchFirst(rgx.block_tic_close)) {
debug(table) { // table (tic) close
@@ -2391,6 +2288,186 @@ template SiSUdocAbstraction() {
}
}
}
+ final string biblio_tag_map(A)(A abr) {
+ debug(asserts) {
+ static assert(is(typeof(abr) == string));
+ }
+ auto btm = [
+ "au" : "author_raw",
+ "ed" : "editor_raw",
+ "ti" : "fulltitle",
+ "lng" : "language",
+ "jo" : "journal",
+ "vol" : "volume",
+ "edn" : "edition",
+ "yr" : "year",
+ "pl" : "place",
+ "pb" : "publisher",
+ "pub" : "publisher",
+ "pg" : "pages",
+ "pgs" : "pages",
+ "sn" : "short_name"
+ ];
+ return btm[abr];
+ }
+ void _biblio_block_(
+ char[] line,
+ return ref int[string] type,
+ return ref int bib_entry,
+ return ref string biblio_entry_str_json,
+ return ref string[] biblio_arr_json
+ ) {
+ mixin SiSUbiblio;
+ auto jsn = BibJsnStr();
+ auto rgx = Rgx();
+ if (line.matchFirst(rgx.heading_biblio)) {
+ type["biblio_section"] = TriState.on;
+ type["blurb_section"] = State.off;
+ type["glossary_section"] = State.off;
+ }
+ if (line.empty) {
+ debug {
+ debug(biblioblock) {
+ writeln("---");
+ }
+ debug(biblioblockinclude) {
+ writeln(biblio_entry_str_json.length);
+ }
+ }
+ if ((bib_entry == State.off)
+ && (biblio_entry_str_json.empty)) {
+ bib_entry = State.on;
+ biblio_entry_str_json = jsn.biblio_entry_tags_jsonstr;
+ } else if (!(biblio_entry_str_json.empty)) {
+ bib_entry = State.off;
+ if (!(biblio_entry_str_json == jsn.biblio_entry_tags_jsonstr)) {
+ auto biblio_entry = parseJSON(biblio_entry_str_json);
+ if (biblio_entry["fulltitle"].str.empty) {
+ writeln("check problem entry (Title missing): ", biblio_entry_str_json);
+ } else if ((biblio_entry["author_raw"].str.empty) && (biblio_entry["editor_raw"].str.empty)) {
+ writeln("check problem entry (No author and no editor): ", biblio_entry_str_json);
+ } else {
+ biblio_arr_json ~= biblio_entry_str_json;
+ }
+ biblio_entry_str_json = jsn.biblio_entry_tags_jsonstr;
+ }
+ } else { // CHECK ERROR
+ writeln("?? 2. ERROR ", biblio_entry_str_json, "??");
+ biblio_entry_str_json = "";
+ }
+ } else if (line.matchFirst(rgx.biblio_tags)) {
+ debug(biblioblock) {
+ writeln(line);
+ }
+ auto bt = line.match(rgx.biblio_tags);
+ bib_entry = State.off;
+ st = bt.captures[1].to!string;
+ auto header_tag_value=(bt.captures[2]).to!string;
+ JSONValue j = parseJSON(biblio_entry_str_json);
+ biblio_tag_name = (st.match(rgx.biblio_abbreviations))
+ ? (biblio_tag_map(st))
+ : st;
+ j.object[biblio_tag_name] = header_tag_value;
+ debug(bibliounsortedcheckduplicates) {
+ writeln(biblio_tag_name, ": ", header_tag_value);
+ writeln("--");
+ }
+ switch (biblio_tag_name) {
+ case "author_raw": // author_arr author (fn sn)
+ j["author_arr"] =
+ header_tag_value.split(rgx.arr_delimiter);
+ string tmp;
+ biblioAuthorLoop:
+ foreach (au; j["author_arr"].array) {
+ if (auto x = au.str.match(rgx.name_delimiter)) {
+ tmp ~= x.captures[2] ~ " " ~ x.captures[1] ~ ", ";
+ } else {
+ tmp ~= au.str;
+ }
+ }
+ tmp = (tmp).replace(rgx.trailing_comma, "");
+ j["author"].str = tmp;
+ goto default;
+ case "editor_raw": // editor_arr editor (fn sn)
+ j["editor_arr"] =
+ header_tag_value.split(rgx.arr_delimiter);
+ string tmp;
+ biblioEditorLoop:
+ foreach (ed; j["editor_arr"].array) {
+ if (auto x = ed.str.match(rgx.name_delimiter)) {
+ tmp ~= x.captures[2] ~ " " ~ x.captures[1] ~ ", ";
+ } else {
+ tmp ~= ed.str;
+ }
+ }
+ tmp = (tmp).replace(rgx.trailing_comma, "");
+ j["editor"].str = tmp;
+ goto default;
+ case "fulltitle": // title & subtitle
+ goto default;
+ default:
+ break;
+ }
+ auto s = j.toString();
+ debug(biblio1) {
+ writefln(
+ "* %s: %s\n%s",
+ biblio_tag_name,
+ biblio_tag_entry,
+ j[biblio_tag_name]
+ );
+ }
+ if (line.match(rgx.comment)) {
+ writeln("ERROR", line, "COMMENT");
+ writeln("ERROR", s, "%%");
+ }
+ if (!(match(line, rgx.comment))) {
+ debug(biblioblockinclude) {
+ writeln(line);
+ }
+ biblio_entry_str_json = s;
+ } else {
+ biblio_entry_str_json = "";
+ }
+ header_tag_value="";
+ }
+ }
+ //
+ void _table_closed_make_special_notation_table_(
+ char[] line,
+ return ref string[string] an_object,
+ return ref ObjGenericComposite[] the_document_body_section,
+ return ref int obj_cite_number,
+ return ref ObjGenericComposite _comp_obj_heading,
+ return ref int cntr,
+ return ref int[string] type,
+ string[string][string] dochead_make_aa,
+ ) {
+ comp_obj_block = comp_obj_block.init;
+ obj_cite_number =
+ ocn_emit(type["ocn_status"]);
+ auto comp_obj_location =
+ node_construct.node_location_emitter(
+ content_non_header,
+ segment_anchor_tag_that_object_belongs_to,
+ obj_cite_number,
+ cntr,
+ heading_ptr-1,
+ "table"
+ );
+ an_object["is"] = "table";
+ auto substantive_obj_misc_tuple =
+ obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", dochead_make_aa);
+ an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
+ comp_obj_block.ocn = obj_cite_number;
+ comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
+ comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]);
+ comp_obj_block = table_substantive_munge_special(comp_obj_block, an_object["substantive"]);
+ the_document_body_section ~= comp_obj_block;
+ object_reset(an_object);
+ processing.remove("verse");
+ ++cntr;
+ }
void _block_flag_line_empty_(B)(
B bookindex_extract_hash,
char[] line,
@@ -2414,7 +2491,7 @@ template SiSUdocAbstraction() {
"code block status: closed"
);
assertions_flag_types_block_status_none_or_closed(type);
- if (type["group"] == TriState.closing) {
+ if (type["quote"] == TriState.closing) {
obj_cite_number =
ocn_emit(type["ocn_status"]);
an_object["bookindex_nugget"] =
@@ -2425,7 +2502,7 @@ template SiSUdocAbstraction() {
obj_cite_number,
segment_anchor_tag_that_object_belongs_to
);
- an_object["is"] = "group";
+ an_object["is"] = "quote";
auto comp_obj_location =
node_construct.node_location_emitter(
content_non_header,
@@ -2442,7 +2519,7 @@ template SiSUdocAbstraction() {
comp_obj_block = comp_obj_block.init;
comp_obj_block.use = "body";
comp_obj_block.is_of = "block";
- comp_obj_block.is_a = "group";
+ comp_obj_block.is_a = "quote";
comp_obj_block.ocn = obj_cite_number;
comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
comp_obj_block.text = an_object["substantive"];
@@ -2451,12 +2528,13 @@ template SiSUdocAbstraction() {
comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links];
the_document_body_section ~= comp_obj_block;
type["blocks"] = TriState.off;
- type["group"] = TriState.off;
+ type["table"] = TriState.off;
object_reset(an_object);
processing.remove("verse");
++cntr;
- } else if (type["block"] == TriState.closing) {
- obj_cite_number = ocn_emit(type["ocn_status"]);
+ } else if (type["group"] == TriState.closing) {
+ obj_cite_number =
+ ocn_emit(type["ocn_status"]);
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
@@ -2465,7 +2543,7 @@ template SiSUdocAbstraction() {
obj_cite_number,
segment_anchor_tag_that_object_belongs_to
);
- an_object["is"] = "block";
+ an_object["is"] = "group";
auto comp_obj_location =
node_construct.node_location_emitter(
content_non_header,
@@ -2474,7 +2552,7 @@ template SiSUdocAbstraction() {
cntr,
heading_ptr-1,
an_object["is"]
- );
+ );
auto substantive_obj_misc_tuple =
obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
@@ -2482,7 +2560,7 @@ template SiSUdocAbstraction() {
comp_obj_block = comp_obj_block.init;
comp_obj_block.use = "body";
comp_obj_block.is_of = "block";
- comp_obj_block.is_a = "block";
+ comp_obj_block.is_a = "group";
comp_obj_block.ocn = obj_cite_number;
comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
comp_obj_block.text = an_object["substantive"];
@@ -2491,13 +2569,12 @@ template SiSUdocAbstraction() {
comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links];
the_document_body_section ~= comp_obj_block;
type["blocks"] = TriState.off;
- type["block"] = TriState.off;
+ type["group"] = TriState.off;
object_reset(an_object);
processing.remove("verse");
++cntr;
- } else if (type["code"] == TriState.closing) {
- obj_cite_number =
- ocn_emit(type["ocn_status"]);
+ } else if (type["block"] == TriState.closing) {
+ obj_cite_number = ocn_emit(type["ocn_status"]);
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
@@ -2506,7 +2583,7 @@ template SiSUdocAbstraction() {
obj_cite_number,
segment_anchor_tag_that_object_belongs_to
);
- an_object["is"] = "code";
+ an_object["is"] = "block";
auto comp_obj_location =
node_construct.node_location_emitter(
content_non_header,
@@ -2515,24 +2592,24 @@ template SiSUdocAbstraction() {
cntr,
heading_ptr-1,
an_object["is"]
- );
+ );
auto substantive_obj_misc_tuple =
obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
- comp_obj_code = comp_obj_code.init;
- comp_obj_code.use = "body";
- comp_obj_code.is_of = "block";
- comp_obj_code.is_a = "code";
- comp_obj_code.ocn = obj_cite_number;
- comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
- comp_obj_code.text = an_object["substantive"];
- comp_obj_code.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
- comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
- comp_obj_code.inline_links = substantive_obj_misc_tuple[sObj.links];
- the_document_body_section ~= comp_obj_code;
+ comp_obj_block = comp_obj_block.init;
+ comp_obj_block.use = "body";
+ comp_obj_block.is_of = "block";
+ comp_obj_block.is_a = "block";
+ comp_obj_block.ocn = obj_cite_number;
+ comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
+ comp_obj_block.text = an_object["substantive"];
+ comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
+ comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
+ comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links];
+ the_document_body_section ~= comp_obj_block;
type["blocks"] = TriState.off;
- type["code"] = TriState.off;
+ type["block"] = TriState.off;
object_reset(an_object);
processing.remove("verse");
++cntr;
@@ -2545,7 +2622,7 @@ template SiSUdocAbstraction() {
obj_cite_number,
segment_anchor_tag_that_object_belongs_to
);
- an_object["is"] = "verse"; // check also
+ an_object["is"] = "verse";
auto comp_obj_location =
node_construct.node_location_emitter(
content_non_header,
@@ -2567,7 +2644,7 @@ template SiSUdocAbstraction() {
type["poem"] = TriState.off;
object_reset(an_object);
processing.remove("verse");
- } else if (type["quote"] == TriState.closing) {
+ } else if (type["code"] == TriState.closing) {
obj_cite_number =
ocn_emit(type["ocn_status"]);
an_object["bookindex_nugget"] =
@@ -2578,7 +2655,7 @@ template SiSUdocAbstraction() {
obj_cite_number,
segment_anchor_tag_that_object_belongs_to
);
- an_object["is"] = "quote";
+ an_object["is"] = "code";
auto comp_obj_location =
node_construct.node_location_emitter(
content_non_header,
@@ -2589,26 +2666,27 @@ template SiSUdocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple =
- obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); // ...
- an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; // ...
+ obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
+ an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
- comp_obj_block = comp_obj_block.init;
- comp_obj_block.use = "body";
- comp_obj_block.is_of = "block";
- comp_obj_block.is_a = "quote";
- comp_obj_block.ocn = obj_cite_number;
- comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
- comp_obj_block.text = an_object["substantive"];
- comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
- comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
- comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links];
- the_document_body_section ~= comp_obj_block;
+ comp_obj_code = comp_obj_code.init;
+ comp_obj_code.use = "body";
+ comp_obj_code.is_of = "block";
+ comp_obj_code.is_a = "code";
+ comp_obj_code.ocn = obj_cite_number;
+ comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
+ comp_obj_code.text = an_object["substantive"];
+ comp_obj_code.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
+ comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
+ comp_obj_code.inline_links = substantive_obj_misc_tuple[sObj.links];
+ the_document_body_section ~= comp_obj_code;
+ type["blocks"] = TriState.off;
+ type["code"] = TriState.off;
object_reset(an_object);
processing.remove("verse");
++cntr;
- type["blocks"] = TriState.off;
- type["quote"] = TriState.off;
} else if (type["table"] == TriState.closing) {
+ comp_obj_block = comp_obj_block.init;
obj_cite_number =
ocn_emit(type["ocn_status"]);
an_object["bookindex_nugget"] =
@@ -2632,17 +2710,11 @@ template SiSUdocAbstraction() {
auto substantive_obj_misc_tuple =
obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
comp_obj_block = comp_obj_block.init;
- comp_obj_block.use = "body";
- comp_obj_block.is_of = "block";
- comp_obj_block.is_a = "table";
comp_obj_block.ocn = obj_cite_number;
comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string;
- comp_obj_block.text = an_object["substantive"];
- comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
- comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
- comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links];
+ comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]);
+ comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]);
the_document_body_section ~= comp_obj_block;
type["blocks"] = TriState.off;
type["table"] = TriState.off;
@@ -3092,6 +3164,203 @@ template SiSUdocAbstraction() {
}
return textline;
}
+ auto table_instructions(O,H)(
+ return ref O table_object,
+ return ref H table_head,
+ ) {
+ auto rgx = Rgx();
+ table_object.use = "body";
+ table_object.is_of = "block";
+ table_object.is_a = "table";
+ table_object.inline_notes_reg = false;
+ table_object.inline_notes_star = false;
+ table_object.inline_links = false;
+ if (auto m = table_head.matchFirst(rgx.table_head_instructions)) {
+ table_object.table_heading = ((m["c_heading"].length > 0) && (m["c_heading"] == "h")) ? true : false;
+ table_object.table_number_of_columns = ((m["c_num"].length > 0) && (m["c_num"].to!int > 0)) ? m["c_num"].to!int : 0; // double check, may be obsolete
+ foreach (cw; m["c_widths"].matchAll(rgx.table_col_widths)) {
+ auto x = cw.hit.matchFirst(rgx.table_col_widths_and_alignment);
+ table_object.table_column_widths ~= x["width"].to!int;
+ table_object.table_column_aligns ~= (x["align"].empty) ? "" : x["align"];
+ }
+ }
+ return table_object;
+ }
+ auto table_array_munge(O,T)(
+ return ref O table_object,
+ return ref T table_array,
+ ) {
+ auto rgx = Rgx();
+ auto mng = InlineMarkup();
+ string _table_substantive;
+ ulong col_num;
+ ulong col_num_;
+ ulong col_num_chk = 0;
+ foreach(idx_r, row; table_array) {
+ debug(table_dev) {
+ writeln("row ", idx_r);
+ }
+ col_num_ = 0;
+ if (col_num == 0
+ || col_num < row.length) {
+ col_num = row.length;
+ }
+ if (col_num_chk == 0) {
+ col_num_chk = col_num;
+ } else if (col_num == 1) {
+ debug(table_dev) {
+ writeln("table note: ");
+ }
+ } else if (col_num_chk != col_num) {
+ debug(table_dev) {
+ writeln("warning irregular number of columns: ", col_num_chk, " != ", col_num);
+ }
+ } else {
+ }
+ foreach(idx_c, col; row) {
+ debug(table_dev) {
+ write(idx_c, ", ");
+ }
+ col_num_ = idx_c;
+ _table_substantive ~= col ~ mng.tc_s;
+ if (idx_r == 0 && comp_obj_block.table_heading) {
+ } else if (idx_r == 1 && col.match(rgx.numeric_col)) {
+ if ((comp_obj_block.table_column_aligns.length > idx_c)
+ && (comp_obj_block.table_column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) {
+ comp_obj_block.table_column_aligns[idx_c]
+ = comp_obj_block.table_column_aligns[idx_c];
+ } else if (comp_obj_block.table_column_aligns.length > idx_c) {
+ comp_obj_block.table_column_aligns[idx_c] = "r";
+ } else {
+ comp_obj_block.table_column_aligns ~= "r";
+ }
+ } else if (idx_r == 1) {
+ if ((comp_obj_block.table_column_aligns.length > idx_c)
+ && (comp_obj_block.table_column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) {
+ comp_obj_block.table_column_aligns[idx_c]
+ = comp_obj_block.table_column_aligns[idx_c];
+ } else if (comp_obj_block.table_column_aligns.length > idx_c) {
+ comp_obj_block.table_column_aligns[idx_c] = "l";
+ } else {
+ comp_obj_block.table_column_aligns ~= "l";
+ }
+ }
+ }
+ debug(table_dev) {
+ writeln("");
+ }
+ if (col_num_chk > 0 && (col_num != col_num_chk)) {
+ } else if (col_num == col_num_chk){
+ } else {
+ col_num_chk = col_num;
+ }
+ _table_substantive = _table_substantive.replaceFirst(rgx.table_col_separator_nl, "\n");
+ }
+ if (comp_obj_block.table_number_of_columns != col_num) {
+ if (comp_obj_block.table_number_of_columns == 0) {
+ comp_obj_block.table_number_of_columns = (col_num).to!int;
+ } else {
+ debug(table_dev) {
+ writeln(comp_obj_block.table_number_of_columns, " != ", col_num);
+ }
+ }
+ }
+ if (table_object.table_number_of_columns == 0
+ && table_object.table_column_widths.length > 0) {
+ writeln(__LINE__, " ERROR");
+ }
+ if (table_object.table_number_of_columns > 0
+ && table_object.table_column_widths.length == 0) {
+ double col_w = (100.00 / table_object.table_number_of_columns);
+ foreach (i; 0..table_object.table_number_of_columns) {
+ table_object.table_column_widths ~= col_w;
+ }
+ } else if (table_object.table_number_of_columns
+ != table_object.table_column_widths.length) {
+ debug(table_dev) {
+ writeln(m.hit); // further logic required
+ }
+ if (table_object.table_number_of_columns > table_object.table_column_widths.length) {
+ double col_w = (100.00 - (table_object.table_column_widths).sum)
+ / (table_object.table_number_of_columns - table_object.table_column_widths.length);
+ foreach (i; 0..table_object.table_column_widths.length) {
+ table_object.table_column_widths ~= col_w;
+ }
+ foreach (i; 0..(table_object.table_number_of_columns - table_object.table_column_widths.length)) {
+ table_object.table_column_widths ~= col_w;
+ }
+ } else if (table_object.table_number_of_columns < table_object.table_column_widths.length) {
+ writeln(__LINE__, " warning, ERROR");
+ }
+ }
+ if (table_object.table_column_widths.sum > 101
+ || table_object.table_column_widths.sum < 95 ) {
+ writeln("sum: ", table_object.table_column_widths.sum,
+ ", array: ", table_object.table_column_widths,
+ ", cols: ", table_object.table_number_of_columns);
+ writeln(_table_substantive);
+ }
+ debug(table_res) {
+ writeln("aligns: ", comp_obj_block.table_column_aligns, "\n",
+ "no. of columns: ", comp_obj_block.table_number_of_columns, "\n",
+ "col widths: ", comp_obj_block.table_column_widths,
+ " sum: ", comp_obj_block.table_column_widths.sum, "\n",
+ _table_substantive);
+ }
+ comp_obj_block.text = _table_substantive;
+ return table_object;
+ }
+ auto table_array_munge_open_close(O,T)(
+ return ref O table_object,
+ return ref T table_array,
+ ) {
+ auto rgx = Rgx();
+ auto mng = InlineMarkup();
+ string _table_substantive;
+ foreach(row; table_array) {
+ foreach(col; row) {
+ _table_substantive ~= mng.tc_o ~ col ~ mng.tc_c;
+ }
+ _table_substantive ~= "\n";
+ }
+ debug(table_dev) {
+ writeln(_table_substantive);
+ }
+ comp_obj_block.text = _table_substantive;
+ return table_object;
+ }
+ auto table_substantive_munge(O,T)(
+ return ref O table_object,
+ return ref T table_substantive,
+ ) {
+ auto rgx = Rgx();
+ auto munge = ObjInlineMarkupMunge();
+ string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter);
+ string[] _table_cols;
+ string[][] _table;
+ foreach(col; _table_rows) {
+ _table_cols = col.split(rgx.table_col_delimiter);
+ _table ~= _table_cols;
+ }
+ table_object = table_array_munge(table_object, _table);
+ return table_object;
+ }
+ auto table_substantive_munge_special(O,T)(
+ return ref O table_object,
+ return ref T table_substantive,
+ ) {
+ auto rgx = Rgx();
+ auto munge = ObjInlineMarkupMunge();
+ string[] _table_rows = (table_substantive).split(rgx.table_row_delimiter_special);
+ string[] _table_cols;
+ string[][] _table;
+ foreach(col; _table_rows) {
+ _table_cols = col.split(rgx.table_col_delimiter_special);
+ _table ~= _table_cols;
+ }
+ table_object = table_array_munge(table_object, _table);
+ return table_object;
+ }
/+ abstraction functions ↑ +/
/+ ↓ abstraction function emitters +/
struct OCNemitter {
@@ -3252,10 +3521,11 @@ template SiSUdocAbstraction() {
rgx.inline_notes_curly_sp_asterisk,
(mkup.en_a_o ~ "*" ~ " $1" ~ mkup.en_a_c)
);
- obj_txt_in = obj_txt_in.replaceAll(
- rgx.inline_notes_curly_sp_plus,
- (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c)
- );
+ obj_txt_in =
+ obj_txt_in.replaceAll(
+ rgx.inline_notes_curly_sp_plus,
+ (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c)
+ );
/+ url matched +/
if (obj_txt_in.match(rgx.inline_url)) {
urls = true;
@@ -3331,6 +3601,18 @@ template SiSUdocAbstraction() {
}
return t;
}
+ string munge_quote(Ot)(Ot obj_txt_in)
+ in {
+ debug(asserts) {
+ static assert(is(typeof(obj_txt_in) == string));
+ }
+ }
+ body {
+ obj_txt["munge"]=obj_txt_in;
+ return obj_txt["munge"];
+ }
+ invariant() {
+ }
auto munge_group(string obj_txt_in)
in { }
body {
@@ -3373,7 +3655,7 @@ template SiSUdocAbstraction() {
}
}
body {
- obj_txt_in = (obj_txt_in).replaceAll(rgx.two_spaces, mkup.nbsp ~ mkup.nbsp);
+ obj_txt_in = (obj_txt_in).replaceAll(rgx.space, mkup.nbsp);
obj_txt["munge"] = obj_txt_in;
return obj_txt["munge"];
}
@@ -3391,18 +3673,6 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- string munge_quote(Ot)(Ot obj_txt_in)
- in {
- debug(asserts) {
- static assert(is(typeof(obj_txt_in) == string));
- }
- }
- body {
- obj_txt["munge"]=obj_txt_in;
- return obj_txt["munge"];
- }
- invariant() {
- }
string munge_comment(Ot)(Ot obj_txt_in)
in {
debug(asserts) {
@@ -4018,7 +4288,7 @@ template SiSUdocAbstraction() {
}
invariant() {
}
- string _group(Ot)(Ot obj_txt_in)
+ string _quote(Ot)(Ot obj_txt_in)
in {
debug(asserts) {
static assert(is(typeof(obj_txt_in) == string));
@@ -4027,12 +4297,12 @@ template SiSUdocAbstraction() {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"group\"";
+ ~ " \"is\": \"quote\"";
return _obj_attributes;
}
invariant() {
}
- string _block(Ot)(Ot obj_txt_in)
+ string _group(Ot)(Ot obj_txt_in)
in {
debug(asserts) {
static assert(is(typeof(obj_txt_in) == string));
@@ -4041,12 +4311,12 @@ template SiSUdocAbstraction() {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"block\"";
+ ~ " \"is\": \"group\"";
return _obj_attributes;
}
invariant() {
}
- string _verse(Ot)(Ot obj_txt_in)
+ string _block(Ot)(Ot obj_txt_in)
in {
debug(asserts) {
static assert(is(typeof(obj_txt_in) == string));
@@ -4055,12 +4325,12 @@ template SiSUdocAbstraction() {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"verse\"";
+ ~ " \"is\": \"block\"";
return _obj_attributes;
}
invariant() {
}
- string _code(Ot)(Ot obj_txt_in)
+ string _verse(Ot)(Ot obj_txt_in)
in {
debug(asserts) {
static assert(is(typeof(obj_txt_in) == string));
@@ -4069,12 +4339,12 @@ template SiSUdocAbstraction() {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"code\"";
+ ~ " \"is\": \"verse\"";
return _obj_attributes;
}
invariant() {
}
- string _table(Ot)(Ot obj_txt_in)
+ string _code(Ot)(Ot obj_txt_in)
in {
debug(asserts) {
static assert(is(typeof(obj_txt_in) == string));
@@ -4083,12 +4353,12 @@ template SiSUdocAbstraction() {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"table\"";
+ ~ " \"is\": \"code\"";
return _obj_attributes;
}
invariant() {
}
- string _quote(Ot)(Ot obj_txt_in)
+ string _table(Ot)(Ot obj_txt_in)
in {
debug(asserts) {
static assert(is(typeof(obj_txt_in) == string));
@@ -4097,7 +4367,7 @@ template SiSUdocAbstraction() {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"quote\"";
+ ~ " \"is\": \"table\"";
return _obj_attributes;
}
invariant() {
diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d
index b6a3eb9..846a7d2 100644
--- a/src/sdp/ao_defaults.d
+++ b/src/sdp/ao_defaults.d
@@ -282,6 +282,7 @@ template SiSUrgxInitFlags() {
"curly_block" : 0,
"curly_quote" : 0,
"curly_table" : 0,
+ "curly_table_special_markup" : 0,
"tic_code" : 0,
"tic_poem" : 0,
"tic_group" : 0,
@@ -389,6 +390,10 @@ template InternalMarkup() {
auto br_page_line = "┼"; // "▭";
auto br_page = "┿"; // "┼";
auto br_page_new = "╂"; // "╋";
+ auto tc_s = "┊"; // "┴"; //"『"; // "┏" ┓
+ auto tc_o = "┏"; //"『"; // "┏" ┓
+ auto tc_c = "┚"; // "』"; // "┚" table row mark #Mx[:tc_c]="』\n"
+ auto tc_p = "┆"; // table col/misc mark
string indent_by_spaces_provided(int indent) {
auto _indent_spaces ="░░"; // auto nbsp = "░";
_indent_spaces = replicate(_indent_spaces, indent);
diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d
index 698c39e..f09e64d 100644
--- a/src/sdp/ao_object_setter.d
+++ b/src/sdp/ao_object_setter.d
@@ -28,7 +28,13 @@ template ObjectSetter() {
bool inline_links = false;
bool inline_notes_reg = false;
bool inline_notes_star = false;
- string syntax = "";
+ string language = ""; // not implemented, consider
+ string code_block_syntax = "";
+ int table_number_of_columns = 0;
+ double[] table_column_widths = [];
+ string[] table_column_aligns = [];
+ bool table_heading = false;
+ bool table_walls = false; // not implemented
int ocn = 0;
string segment_anchor_tag = "";
string segname_prev = "";
diff --git a/src/sdp/ao_rgx.d b/src/sdp/ao_rgx.d
index 109b0cf..deef9c6 100644
--- a/src/sdp/ao_rgx.d
+++ b/src/sdp/ao_rgx.d
@@ -24,9 +24,15 @@ template SiSUrgxInit() {
static newline_eol_delimiter_only = ctRegex!("^\n");
static line_delimiter_ws_strip = ctRegex!("[ ]*\n[ ]*");
static para_delimiter = ctRegex!("\n[ ]*\n+");
+ static table_col_delimiter = ctRegex!("[ ]*\n+", "mg");
+ static table_row_delimiter = ctRegex!("\n[ ]*\n+", "mg");
+ static table_row_delimiter_special = ctRegex!("[ ]*\n", "mg"); //
+ static table_col_delimiter_special = ctRegex!("[ ]*[|][ ]*", "mg"); //
static levels_markup = ctRegex!(`^[A-D1-4]$`);
static levels_numbered = ctRegex!(`^[0-9]$`);
static levels_numbered_headings = ctRegex!(`^[0-7]$`);
+ static numeric = ctRegex!(`[ 0-9,.-]+`);
+ static numeric_col = ctRegex!(`^[ 0-9,.$£₤Є€€¥-]+$`);
/+ comments +/
static comment = ctRegex!(`^%+ `);
static comments = ctRegex!(`^%+ |^%+$`);
@@ -80,20 +86,20 @@ template SiSUrgxInit() {
static para_indent_hang = ctRegex!(`^_([0-9])_([0-9]) `);
static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `);
/+ blocked markup +/
- static block_open = ctRegex!("^((code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)[{].*?$)|^`{3} (code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)");
+ static block_open = ctRegex!("^((code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)[{].*?$)|^`{3} (code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)|^[{]table(~h)?(?P<columns>(?:[ ]+[0-9]+;)+)[}]");
static block_poem_open = ctRegex!("^((poem[{].*?$)|`{3} poem)");
/+ blocked markup tics +/
static block_tic_open = ctRegex!("^`{3} (code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)");
- static block_tic_code_open = ctRegex!("^`{3} (code)([.][a-z][0-9a-z_]+)?");
+ static block_tic_code_open = ctRegex!("^`{3} (?:code)(?:[.]([a-z][0-9a-z_]+))?(?:[ ]+([#]))?");
static block_tic_poem_open = ctRegex!("^`{3} (poem)");
static block_tic_group_open = ctRegex!("^`{3} (group)");
static block_tic_block_open = ctRegex!("^`{3} (block)");
static block_tic_quote_open = ctRegex!("^`{3} (quote)");
- static block_tic_table_open = ctRegex!("^`{3} (table)");
+ static block_tic_table_open = ctRegex!("^`{3} table(.*)");
static block_tic_close = ctRegex!("^(`{3})$","m");
/+ blocked markup curly +/
static block_curly_open = ctRegex!(`^((code([.][a-z][0-9a-z_]+)?|poem|group|block|quote|table)[{].*?$)`);
- static block_curly_code_open = ctRegex!(`^(code([.][a-z][0-9a-z_]+)?[{](.*?)$)`);
+ static block_curly_code_open = ctRegex!(`^(?:code(?:[.]([a-z][0-9a-z_]+))?[{]([#]?)\s*$)`);
static block_curly_code_close = ctRegex!(`^([}]code)`);
static block_curly_poem_open = ctRegex!(`^(poem[{].*?$)`);
static block_curly_poem_close = ctRegex!(`^([}]poem)`);
@@ -103,8 +109,16 @@ template SiSUrgxInit() {
static block_curly_block_close = ctRegex!(`^([}]block)`);
static block_curly_quote_open = ctRegex!(`^(quote[{].*?$)`);
static block_curly_quote_close = ctRegex!(`^([}]quote)`);
- static block_curly_table_open = ctRegex!(`^(table[{].*?$)`);
+ static block_curly_table_open = ctRegex!(`^table[{](.*)`);
static block_curly_table_close = ctRegex!(`^([}]table)`);
+ static block_curly_table_special_markup = ctRegex!(`^[{]table((~h)?(?P<columns>(?:[ ]+[0-9]+;)+))[}]`, "mg"); // sepcial table block markup
+ static table_head_instructions = ctRegex!(`(?P<c_heading>h)?(?:[ ]+c(?P<c_num>[0-9]);)?(?P<c_widths>(?:[ ]+[0-9]+[lr]?;)+)`);
+ static table_col_widths_and_alignment = ctRegex!(`(?P<width>[0-9]+)(?P<align>[lr]?)`);
+ static table_col_widths = ctRegex!(`(?P<widths>[0-9]+)`);
+ static table_col_align = ctRegex!(`(?P<align>[lr]?)`);
+ static table_col_align_match = ctRegex!(`(?P<align>[lr])`);
+ static table_col_separator = ctRegex!(`┊`);
+ static table_col_separator_nl = ctRegex!(`[┊]$`, "mg");
/+ inline markup footnotes endnotes +/
static inline_notes_curly_gen = ctRegex!(`~\{.+?\}~`, "m");
static inline_notes_curly = ctRegex!(`~\{\s*(.+?)\}~`, "mg");
@@ -173,6 +187,8 @@ template SiSUrgxInit() {
static space = ctRegex!(`[ ]`, "mg");
static two_spaces = ctRegex!(`[ ]{2}`, "mg");
static nbsp_char = ctRegex!(`░`, "mg");
+ static nbsp_and_space = ctRegex!(`&nbsp;[ ]`, "mg");
+ static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg");
static src_pth = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
static src_fn =
ctRegex!(`^([a-zA-Z0-9._-]+/)*(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`);
@@ -219,5 +235,8 @@ template SiSUrgxInit() {
static inline_bold_line = ctRegex!(`^!_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
+ /+ table delimiters +/
+ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); //
+ static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); //
}
}
diff --git a/src/sdp/defaults.d b/src/sdp/defaults.d
index 7fac739..a6520a3 100644
--- a/src/sdp/defaults.d
+++ b/src/sdp/defaults.d
@@ -118,6 +118,10 @@ template InternalMarkup() {
auto br_page_line = "┼"; // "▭";
auto br_page = "┿"; // "┼";
auto br_page_new = "╂"; // "╋";
+ auto tc_s = "┊"; // "┴"; //"『"; // "┏" ┓
+ auto tc_o = "┏"; //"『"; // "┏" ┓
+ auto tc_c = "┚"; // "』"; // "┚" table row mark #Mx[:tc_c]="』\n"
+ auto tc_p = "┆"; // table col/misc mark
string indent_by_spaces_provided(int indent) {
auto _indent_spaces ="░░"; // auto nbsp = "░";
_indent_spaces = replicate(_indent_spaces, indent);
diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d
index 6d4e0c5..a05812f 100644
--- a/src/sdp/output_html.d
+++ b/src/sdp/output_html.d
@@ -83,7 +83,7 @@ template outputHTML() {
case "poem":
break;
case "verse":
- doc_html ~= xhtml_format.nugget(obj);
+ doc_html ~= xhtml_format.verse(obj);
break;
case "group":
doc_html ~= xhtml_format.nugget(obj);
@@ -95,7 +95,7 @@ template outputHTML() {
doc_html ~= xhtml_format.nugget(obj);
break;
case "table":
- doc_html ~= xhtml_format.para_scroll(obj, suffix);
+ doc_html ~= xhtml_format.table(obj);
break;
case "code":
doc_html ~= xhtml_format.code(obj);
@@ -304,7 +304,7 @@ template outputHTML() {
case "poem":
break;
case "verse":
- doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ doc_html[segment_filename] ~= xhtml_format.verse(obj);
break;
case "group":
doc_html[segment_filename] ~= xhtml_format.nugget(obj);
@@ -316,9 +316,8 @@ template outputHTML() {
doc_html[segment_filename] ~= xhtml_format.nugget(obj);
break;
case "table":
- auto t = xhtml_format.para_seg(obj, suffix);
- doc_html[segment_filename] ~= t[0];
- doc_html_endnotes[segment_filename] ~= t[1];
+ doc_html[segment_filename] ~= xhtml_format.table(obj);
+ doc_html_endnotes[segment_filename] ~= "";
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 e056b70..3abd76a 100644
--- a/src/sdp/output_rgx.d
+++ b/src/sdp/output_rgx.d
@@ -8,6 +8,8 @@ template SiSUoutputRgxInit() {
static space = ctRegex!(`[ ]`, "mg");
static two_spaces = ctRegex!(`[ ]{2}`, "mg");
static nbsp_char = ctRegex!(`░`, "mg");
+ static nbsp_and_space = ctRegex!(`&nbsp;[ ]`, "mg");
+ static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg");
static src_pth = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
static src_fn =
ctRegex!(`^([a-zA-Z0-9._-]+/)*(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`);
@@ -54,6 +56,9 @@ template SiSUoutputRgxInit() {
static inline_bold_line = ctRegex!(`^!_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
+ /+ table delimiters +/
+ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); //
+ static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); //
static xhtml_ampersand = ctRegex!(`[&]`); // &amp;
static xhtml_less_than = ctRegex!(`[<]`); // &lt;
static xhtml_greater_than = ctRegex!(`[>]`); // &gt;
diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d
index 4ee5a79..971dd95 100644
--- a/src/sdp/output_xhtmls.d
+++ b/src/sdp/output_xhtmls.d
@@ -419,6 +419,40 @@ template outputXHTMLs() {
);
return u;
}
+ auto verse(O)( // using code from code block, review
+ auto return ref const O obj,
+ ) {
+ string _txt = obj.text;
+ _txt = (_txt)
+ .replaceAll(rgx.newline, "<br>\n")
+ .replaceAll(rgx.two_spaces, "&nbsp;" ~ "&nbsp;" ~ "&nbsp;" ~ "&nbsp;")
+ .replaceAll(rgx.nbsp_and_space, "&nbsp;" ~ "&nbsp;");
+ 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 nugget(O)(
auto return ref const O obj,
) {
@@ -462,6 +496,68 @@ template outputXHTMLs() {
);
return o;
}
+ auto tablarize(O)(
+ auto return ref const O obj,
+ string _txt,
+ ) {
+ string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
+ string[] _table_cols;
+ string _table;
+ string _tablenote;
+ foreach(row_idx, row; _table_rows) {
+ _table_cols = row.split(rgx.table_delimiter_col);
+ _table ~= "<tr>";
+ foreach(col_idx, cell; _table_cols) {
+ if ((_table_cols.length == 1)
+ && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx)
+ _tablenote ~= cell;
+ } else {
+ string _col_is = (row_idx == 0 && obj.table_heading) ? "th" : "td";
+ string _align = ("style=\"text-align:"
+ ~ ((obj.table_column_aligns[col_idx] == "l")
+ ? "left\"" : "right\""));
+ _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table_column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">";
+ _table ~= cell;
+ _table ~= "</" ~ _col_is ~ ">";
+ }
+ }
+ _table ~= "</tr>";
+ }
+ auto t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+ }
+ auto table(O)(
+ auto return ref const O obj,
+ ) {
+ string _txt = obj.text;
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
+ _txt = font_face(_txt);
+ auto t = tablarize(obj, _txt);
+ _txt = t[0];
+ string _note = t[1];
+ string o;
+ o = format(q"¶ <div class="substance">
+ <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
+ <p class="%s" id="%s">%s
+ <table summary="normal text css" width="95%%" border="0" bgcolor="white" cellpadding="2" align="center">
+ %s
+ </table>
+ %s
+ </p>
+ </div>¶",
+ obj.obj_cite_number,
+ obj.obj_cite_number,
+ obj.is_a,
+ obj.obj_cite_number,
+ tags,
+ _txt,
+ _note
+ );
+ return o;
+ }
auto code(O)(
auto return ref const O obj,
) {