aboutsummaryrefslogtreecommitdiffhomepage
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
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
-rw-r--r--org/ao_doc_abstraction.org760
-rw-r--r--org/defaults.org71
-rw-r--r--org/output.org135
-rw-r--r--org/sdp.org2
-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
-rw-r--r--views/version.txt2
13 files changed, 1463 insertions, 569 deletions
diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org
index aac99f7..e527f8c 100644
--- a/org/ao_doc_abstraction.org
+++ b/org/ao_doc_abstraction.org
@@ -162,18 +162,19 @@ template SiSUdocAbstraction() {
<<abs_functions_header_set_common>>
<<abs_functions_ocn_status>>
<<abs_functions_block>>
- <<abs_functions_block_code>>
- <<abs_functions_block_biblio>>
- // <<abs_functions_block_glossary>>
+ <<abs_functions_block_quote>>
<<abs_functions_block_group>>
<<abs_functions_block_block>>
<<abs_functions_block_poem>>
- <<abs_functions_block_quote>>
+ <<abs_functions_block_code>>
<<abs_functions_block_table>>
+ <<abs_functions_block_biblio>>
+ // <<abs_functions_block_glossary>>
<<abs_functions_block_line_status_empty>>
<<abs_functions_book_index>>
<<abs_functions_heading>>
<<abs_functions_para>>
+ <<abs_functions_table>>
/+ abstraction functions ↑ +/
/+ ↓ abstraction function emitters +/
<<ao_emitters_ocn>>
@@ -846,6 +847,16 @@ if there is a blurb section you need to:
#+END_SRC
***** in blocks [+1] :block:active:
+****** in block: quote :quote:
+
+#+name: abs_in_loop_body_non_code_obj
+#+BEGIN_SRC d
+} else if (type["quote"] == TriState.on) {
+ /+ within block object: quote +/
+ _quote_block_(line, an_object, type);
+ continue;
+#+END_SRC
+
****** in block: group :group:
#+name: abs_in_loop_body_non_code_obj
@@ -877,23 +888,13 @@ if there is a blurb section you need to:
continue;
#+END_SRC
-****** in block: quote :quote:
-
-#+name: abs_in_loop_body_non_code_obj
-#+BEGIN_SRC d
-} else if (type["quote"] == TriState.on) {
- /+ within block object: quote +/
- _quote_block_(line, an_object, type);
- continue;
-#+END_SRC
-
****** in block: table :table:
#+name: abs_in_loop_body_non_code_obj
#+BEGIN_SRC d
} 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;
#+END_SRC
@@ -2283,8 +2284,12 @@ void _start_block_(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
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",
@@ -2341,7 +2346,7 @@ void _start_block_(L,T,N)(
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(
@@ -2349,17 +2354,28 @@ void _start_block_(L,T,N)(
line
);
}
- type["blocks"] = TriState.on;
- type["table"] = TriState.on;
- type["curly_table"] = TriState.on;
+ 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;
#+END_SRC
***** block (various) tic open :tic:
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_tic_code_open)) {
+ } 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",
@@ -2415,7 +2431,7 @@ void _start_block_(L,T,N)(
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(
@@ -2423,9 +2439,11 @@ void _start_block_(L,T,N)(
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;
}
#+END_SRC
@@ -2701,6 +2719,53 @@ void _biblio_block_(
}
#+END_SRC
+***** quote block :quote:
+
+#+name: abs_functions_block_quote
+#+BEGIN_SRC d
+void _quote_block_(L,O,T)(
+ return ref L line,
+ return ref O an_object,
+ return ref T type
+) {
+ debug(asserts) {
+ static assert(is(typeof(line) == char[]));
+ static assert(is(typeof(an_object) == string[string]));
+ 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
+ writeln(line);
+ }
+ type["blocks"] = TriState.closing;
+ type["quote"] = TriState.closing;
+ type["curly_quote"] = TriState.off;
+ } else {
+ debug(quote) {
+ writeln(line);
+ }
+ an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
+ }
+ } else if (type["tic_quote"] == TriState.on) {
+ if (line.matchFirst(rgx.block_tic_close)) {
+ debug(quote) { // quote (tic) close
+ writeln(line);
+ }
+ type["blocks"] = TriState.closing;
+ type["quote"] = TriState.closing;
+ type["tic_quote"] = TriState.off;
+ } else {
+ debug(quote) {
+ writeln(line);
+ }
+ an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
+ }
+ }
+}
+#+END_SRC
+
***** group block :group:
#+name: abs_functions_block_group
@@ -2820,47 +2885,50 @@ void _poem_block_(L,O,T,C,N,Ma)(
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;
@@ -2891,7 +2959,7 @@ void _poem_block_(L,O,T,C,N,Ma)(
);
}
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,
@@ -2938,7 +3006,7 @@ void _poem_block_(L,O,T,C,N,Ma)(
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];
@@ -2983,7 +3051,7 @@ void _poem_block_(L,O,T,C,N,Ma)(
);
}
processing.remove("verse");
- an_object["is"] = "verse";
+ an_object["is"] = "verse";
auto comp_obj_location =
node_construct.node_location_emitter(
content_non_header,
@@ -3017,61 +3085,15 @@ void _poem_block_(L,O,T,C,N,Ma)(
}
#+END_SRC
-***** quote block :quote:
-
-#+name: abs_functions_block_quote
-#+BEGIN_SRC d
-void _quote_block_(L,O,T)(
- return ref L line,
- return ref O an_object,
- return ref T type
-) {
- debug(asserts) {
- static assert(is(typeof(line) == char[]));
- static assert(is(typeof(an_object) == string[string]));
- 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
- writeln(line);
- }
- type["blocks"] = TriState.closing;
- type["quote"] = TriState.closing;
- type["curly_quote"] = TriState.off;
- } else {
- debug(quote) {
- writeln(line);
- }
- an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
- }
- } else if (type["tic_quote"] == TriState.on) {
- if (line.matchFirst(rgx.block_tic_close)) {
- debug(quote) { // quote (tic) close
- writeln(line);
- }
- type["blocks"] = TriState.closing;
- type["quote"] = TriState.closing;
- type["tic_quote"] = TriState.off;
- } else {
- debug(quote) {
- writeln(line);
- }
- an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string)
- }
- }
-}
-#+END_SRC
-
***** table block :table:
#+name: abs_functions_block_table
#+BEGIN_SRC d
-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[]));
@@ -3093,6 +3115,27 @@ void _table_block_(L,O,T)(
}
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
@@ -3111,9 +3154,56 @@ void _table_block_(L,O,T)(
}
#+END_SRC
-**** block end (close an open block): line empty, block flag :close:
+**** special table notation, make: table
+
+process and use an_object["table_head"] (then empty it)
+- present table header info in uniform way
+ - table_number_of_columns, int (count)
+ - table_column_widths, int[] column widths (as given or calculate average)
+ - show table walls, bool
+
+#+name: abs_functions_block_line_status_empty
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
+**** block end (close an open block): line empty, block flag _makes_ :close:
-***** { line empty, make block
+***** { line empty, _make block_
#+name: abs_functions_block_line_status_empty
#+BEGIN_SRC d
@@ -3142,11 +3232,11 @@ void _block_flag_line_empty_(B)(
assertions_flag_types_block_status_none_or_closed(type);
#+END_SRC
-***** make: group block
+***** make: quote block
#+name: abs_functions_block_line_status_empty
#+BEGIN_SRC d
- if (type["group"] == TriState.closing) {
+ if (type["quote"] == TriState.closing) {
obj_cite_number =
ocn_emit(type["ocn_status"]);
an_object["bookindex_nugget"] =
@@ -3157,7 +3247,7 @@ void _block_flag_line_empty_(B)(
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,
@@ -3174,7 +3264,7 @@ void _block_flag_line_empty_(B)(
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"];
@@ -3183,18 +3273,19 @@ void _block_flag_line_empty_(B)(
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;
#+END_SRC
-***** make: block
+***** make: group block
#+name: abs_functions_block_line_status_empty
#+BEGIN_SRC d
- } 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 =
@@ -3203,7 +3294,7 @@ void _block_flag_line_empty_(B)(
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,
@@ -3212,7 +3303,7 @@ void _block_flag_line_empty_(B)(
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];
@@ -3220,7 +3311,7 @@ void _block_flag_line_empty_(B)(
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"];
@@ -3229,19 +3320,18 @@ void _block_flag_line_empty_(B)(
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;
#+END_SRC
-***** make: code block
+***** make: block
#+name: abs_functions_block_line_status_empty
#+BEGIN_SRC d
- } 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 =
@@ -3250,7 +3340,7 @@ void _block_flag_line_empty_(B)(
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,
@@ -3259,24 +3349,24 @@ void _block_flag_line_empty_(B)(
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;
@@ -3295,7 +3385,7 @@ void _block_flag_line_empty_(B)(
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,
@@ -3319,11 +3409,11 @@ void _block_flag_line_empty_(B)(
processing.remove("verse");
#+END_SRC
-***** make: quote block
+***** make: code block
#+name: abs_functions_block_line_status_empty
#+BEGIN_SRC d
- } else if (type["quote"] == TriState.closing) {
+ } else if (type["code"] == TriState.closing) {
obj_cite_number =
ocn_emit(type["ocn_status"]);
an_object["bookindex_nugget"] =
@@ -3334,7 +3424,7 @@ void _block_flag_line_empty_(B)(
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,
@@ -3345,25 +3435,25 @@ void _block_flag_line_empty_(B)(
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;
#+END_SRC
***** make: table
@@ -3371,6 +3461,7 @@ void _block_flag_line_empty_(B)(
#+name: abs_functions_block_line_status_empty
#+BEGIN_SRC d
} 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"] =
@@ -3394,17 +3485,11 @@ void _block_flag_line_empty_(B)(
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;
@@ -3899,6 +3984,242 @@ auto font_faces_line(T)(
}
#+END_SRC
+**** tables
+
+- number of columns
+- column widths (either as given or uniform, first often different from rest)
+- column aligns (as given else default left for text, check whether can default right for digits)
+- table heading (auto align left)
+- table walls
+- TODO need to be able to align columns left or right (digits)
+
+***** table instructions
+
+#+name: abs_functions_table
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
+***** table array munge
+
+#+name: abs_functions_table
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
+****** table array munge simple open & close
+
+#+name: abs_functions_table
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
+***** table substantive munge
+
+#+name: abs_functions_table
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
+***** table substantive munge special
+
+#+name: abs_functions_table
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
*** function emitters :emitters:
**** object :object:
***** ocn :ocn:
@@ -4088,10 +4409,11 @@ struct ObjInlineMarkupMunge {
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;
@@ -4189,6 +4511,24 @@ struct ObjInlineMarkupMunge {
}
#+END_SRC
+****** quote
+
+#+name: ao_emitters_obj_inline_markup_munge
+#+BEGIN_SRC d
+ 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() {
+ }
+#+END_SRC
+
****** group
- group block identified by open an close tags
- general markup
@@ -4280,7 +4620,7 @@ struct ObjInlineMarkupMunge {
}
}
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"];
}
@@ -4308,24 +4648,6 @@ struct ObjInlineMarkupMunge {
}
#+END_SRC
-****** quote
-
-#+name: ao_emitters_obj_inline_markup_munge
-#+BEGIN_SRC d
- 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() {
- }
-#+END_SRC
-
****** comment
#+name: ao_emitters_obj_inline_markup_munge
@@ -5044,11 +5366,11 @@ struct ObjAttributes {
}
#+END_SRC
-******** group
+******** quote
#+name: ao_emitters_obj_attributes_private_an_attribute
#+BEGIN_SRC d
- 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));
@@ -5057,18 +5379,18 @@ struct ObjAttributes {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"group\"";
+ ~ " \"is\": \"quote\"";
return _obj_attributes;
}
invariant() {
}
#+END_SRC
-******** block
+******** group
#+name: ao_emitters_obj_attributes_private_an_attribute
#+BEGIN_SRC d
- 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));
@@ -5077,18 +5399,18 @@ struct ObjAttributes {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"block\"";
+ ~ " \"is\": \"group\"";
return _obj_attributes;
}
invariant() {
}
#+END_SRC
-******** verse
+******** block
#+name: ao_emitters_obj_attributes_private_an_attribute
#+BEGIN_SRC d
- 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));
@@ -5097,18 +5419,18 @@ struct ObjAttributes {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"verse\"";
+ ~ " \"is\": \"block\"";
return _obj_attributes;
}
invariant() {
}
#+END_SRC
-******** code
+******** verse
#+name: ao_emitters_obj_attributes_private_an_attribute
#+BEGIN_SRC d
- 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));
@@ -5117,18 +5439,18 @@ struct ObjAttributes {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"code\"";
+ ~ " \"is\": \"verse\"";
return _obj_attributes;
}
invariant() {
}
#+END_SRC
-******** table
+******** code
#+name: ao_emitters_obj_attributes_private_an_attribute
#+BEGIN_SRC d
- 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));
@@ -5137,18 +5459,18 @@ struct ObjAttributes {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"table\"";
+ ~ " \"is\": \"code\"";
return _obj_attributes;
}
invariant() {
}
#+END_SRC
-******** quote
+******** table
#+name: ao_emitters_obj_attributes_private_an_attribute
#+BEGIN_SRC d
- 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));
@@ -5157,7 +5479,7 @@ struct ObjAttributes {
body {
_obj_attributes = " \"use\": \"content\","
~ " \"of\": \"block\","
- ~ " \"is\": \"quote\"";
+ ~ " \"is\": \"table\"";
return _obj_attributes;
}
invariant() {
@@ -6435,7 +6757,13 @@ struct ObjGenericComposite {
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/org/defaults.org b/org/defaults.org
index ffd2c7c..25b1a4b 100644
--- a/org/defaults.org
+++ b/org/defaults.org
@@ -429,6 +429,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,
@@ -580,9 +581,15 @@ static newline_eol_strip_preceding = ctRegex!("[ ]*\n");
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,.$£₤Є€€¥-]+$`);
#+END_SRC
*** comments :comment:
@@ -594,7 +601,8 @@ static comment = ctRegex!(`^%+ `);
static comments = ctRegex!(`^%+ |^%+$`);
#+END_SRC
-*** native header :native:header:
+*** native headers
+**** native header :native:header:
#+name: ao_rgx
#+BEGIN_SRC d
@@ -613,7 +621,7 @@ static variable_doc_author = ctRegex!(`@author|@creat
static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i");
#+END_SRC
-*** subheader :native:subheader:
+**** subheader :native:subheader:
#+name: ao_rgx
#+BEGIN_SRC d
@@ -661,12 +669,13 @@ static para_indent_hang = ctRegex!(`^_([0-9])_([0-
static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `);
#+END_SRC
-*** blocked markup :block:tic:
+*** blocked markup
+**** blocked markup :block:tic:
#+name: ao_rgx
#+BEGIN_SRC d
/+ 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)");
#+END_SRC
@@ -676,22 +685,22 @@ static block_poem_open = ctRegex!("^((poem[{].*?$
#+BEGIN_SRC d
/+ 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");
#+END_SRC
-*** blocked markup curly :block:curly:
+**** blocked markup curly :block:curly:
#+name: ao_rgx
#+BEGIN_SRC d
/+ 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)`);
@@ -701,8 +710,22 @@ static block_curly_block_open = ctRegex!(`^(block[{].*?$
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
+#+END_SRC
+
+**** block sub-matches :block:curly:
+
+#+name: ao_rgx
+#+BEGIN_SRC d
+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");
#+END_SRC
*** inline markup footnotes endnotes :inline:footnote:
@@ -731,7 +754,7 @@ static inline_text_and_note_curly = ctRegex!(`(?P<text>.+?)(
static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73
#+END_SRC
-*** links/ urls :inline:footnote:
+**** links/ urls :inline:footnote:
#+name: ao_rgx
#+BEGIN_SRC d
@@ -743,14 +766,14 @@ static inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P<c
static inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg");
#+END_SRC
-*** images :images:
+**** images :images:
#+name: ao_rgx
#+BEGIN_SRC d
static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg");
#+END_SRC
-*** inline markup book index :inline:bookindex:
+**** inline markup book index :inline:bookindex:
#+name: ao_rgx
#+BEGIN_SRC d
@@ -830,7 +853,7 @@ static bi_sub_terms_plus_obj_cite_number_offset_split = ctRegex!(`\s*\|\s*`);
static bi_term_and_obj_cite_numbers_match = ctRegex!(`^(.+?)\+(\d+)`);
#+END_SRC
-** language codes :language:codes:
+*** language codes :language:codes:
#+name: ao_rgx
#+BEGIN_SRC d
@@ -1045,6 +1068,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);
@@ -1160,6 +1187,8 @@ static newline = ctRegex!("\n", "mg");
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");
#+END_SRC
*** filename (and path) matching (including markup insert file) :insert:file:path:filename:
@@ -1176,7 +1205,8 @@ static src_fn_find_inserts = ctRegex!(`^(?P<path>[a-z
static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`);
#+END_SRC
-*** inline (internal program) markup footnotes endnotes :inline:footnote:
+*** inline markup
+**** inline (internal program) markup footnotes endnotes :inline:footnote:
#+name: prgmkup_rgx
#+BEGIN_SRC d
@@ -1196,7 +1226,7 @@ static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)
static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
#+END_SRC
-*** inline links
+**** inline links
#+name: prgmkup_rgx
#+BEGIN_SRC d
@@ -1209,7 +1239,7 @@ static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.f
static mark_internal_site_lnk = ctRegex!(`¤`, "mg");
#+END_SRC
-*** TODO inline markup font face mod :inline:font:face:
+**** TODO inline markup font face mod :inline:font:face:
#+name: prgmkup_rgx
#+BEGIN_SRC d
@@ -1232,6 +1262,15 @@ static inline_italics_line = ctRegex!(`^/_ (?P<text>.
static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
#+END_SRC
+**** table related
+
+#+name: prgmkup_rgx
+#+BEGIN_SRC d
+/+ table delimiters +/
+static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); //
+static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); //
+#+END_SRC
+
* +set colors for terminal+ (unused) :colors:terminal:
#+name: ao_ansi_colors
diff --git a/org/output.org b/org/output.org
index 657b32f..1b2ee5f 100644
--- a/org/output.org
+++ b/org/output.org
@@ -776,6 +776,46 @@ auto para_seg(O)(
}
#+END_SRC
+**** poem 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 = 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;
+}
+#+END_SRC
+
**** nugget
#+name: xhtml_format_objects
@@ -831,6 +871,90 @@ auto endnote(O)(
}
#+END_SRC
+**** table
+
+***** TODO tablarize
+
+align="left|right|center"
+<td align="right">$100</td>
+
+"style=\"text-align:right\""
+"style=\"text-align:left\""
+
+"style=\"text-align:" ~ "right\""
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
+***** table
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+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;
+}
+#+END_SRC
+
**** code
#+name: xhtml_format_objects_code
@@ -948,7 +1072,7 @@ void scroll(D,I)(
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);
@@ -960,7 +1084,7 @@ void scroll(D,I)(
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);
@@ -1182,7 +1306,7 @@ void seg(D,I)(
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);
@@ -1194,9 +1318,8 @@ void seg(D,I)(
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/org/sdp.org b/org/sdp.org
index 3332107..b1ed6ba 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -23,7 +23,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 13, 6);
+enum ver = Version(0, 13, 7);
#+END_SRC
* 1. sdp (sisu document parser) :sdp:
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,
) {
diff --git a/views/version.txt b/views/version.txt
index 07d5047..cc55b52 100644
--- a/views/version.txt
+++ b/views/version.txt
@@ -4,4 +4,4 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 13, 6);
+enum ver = Version(0, 13, 7);