aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-05-03 09:18:27 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-21 12:03:47 -0400
commite923c850c2a19640fa28b8663e5dabff57c47954 (patch)
tree7769e4f31a228bfc239c313b7966eaafdebbe85a
parentquestionable code, clean ("flow" commit related) (diff)
block (grouped text) attributes (possibility)
-rw-r--r--org/meta_abstraction.org65
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d62
-rw-r--r--src/doc_reform/meta/object_setter.d3
3 files changed, 98 insertions, 32 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index d050abb..abfa404 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -3219,8 +3219,6 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
static auto rgx = Rgx();
- string code_block_syntax = "";
- bool code_block_numbered = false;
#+END_SRC
******* code
@@ -3228,9 +3226,9 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
if (auto m = line.matchFirst(rgx.block_curly_code_open)) {
- code_block_syntax = (m[1]) ? m[1].to!string : "";
- code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
- ? true : false;
+ an_object["lang"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : "";
debug(codecurly) { // code (curly) open
writefln(
"* [code curly] %s",
@@ -3246,7 +3244,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_curly_poem_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_poem_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(poem) { // poem (curly) open
writefln(
"* [poem curly] %s",
@@ -3264,7 +3265,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_curly_group_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_group_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(group) { // group (curly) open
writefln(
"* [group curly] %s",
@@ -3280,7 +3284,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_curly_block_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_block_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(block) { // block (curly) open
writefln(
"* [block curly] %s",
@@ -3296,7 +3303,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_curly_quote_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_quote_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = m["attrib"].to!string;
+ an_object["lang"] = m["lang"].to!string;
debug(quote) { // quote (curly) open
writefln(
"* [quote curly] %s",
@@ -3344,9 +3354,9 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_tic_code_open)) {
- code_block_syntax = (m[1]) ? m[1].to!string : "";
- code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
- ? true : false;
+ an_object["lang"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : "";
debug(codetic) { // code (tic) open
writefln(
"* [code tic] %s",
@@ -3362,7 +3372,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_tic_poem_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_poem_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(poem) { // poem (tic) open
writefln(
"* [poem tic] %s",
@@ -3380,7 +3393,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_tic_group_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_group_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(group) { // group (tic) open
writefln(
"* [group tic] %s",
@@ -3396,7 +3412,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_tic_block_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_block_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(block) { // block (tic) open
writefln(
"* [block tic] %s",
@@ -3412,7 +3431,10 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
- } else if (line.matchFirst(rgx.block_tic_quote_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_quote_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = m["attrib"].to!string;
+ an_object["lang"] = m["lang"].to!string;
debug(quote) { // quote (tic) open
writefln(
"* [quote tic] %s",
@@ -4318,6 +4340,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)(
comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digit_type;
+ comp_obj_block.metainfo.lang = an_object["lang"];
+ comp_obj_block.metainfo.attrib = an_object["attrib"];
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.text = an_object["substantive"];
@@ -4373,6 +4397,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)(
comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
+ comp_obj_block.metainfo.lang = an_object["lang"];
+ comp_obj_block.metainfo.attrib = an_object["attrib"];
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.text = an_object["substantive"];
@@ -4428,6 +4454,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)(
comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digit_type;
+ comp_obj_block.metainfo.lang = an_object["lang"];
+ comp_obj_block.metainfo.attrib = an_object["attrib"];
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.text = an_object["substantive"];
@@ -4525,6 +4553,8 @@ void flow_block_flag_line_empty_(B,N,CMM,Ts)(
comp_obj_code.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_code.metainfo.object_number_type = obj_cite_digits.type;
+ comp_obj_code.metainfo.syntax = an_object["syntax"];
+ comp_obj_code.metainfo.attrib = an_object["attrib"];
comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_code.text = an_object["substantive"];
@@ -7817,6 +7847,9 @@ struct DocObj_MetaInfo_ {
alias of_part = is_of_part;
alias of_section = is_of_section;
alias is_of = is_of_type;
+ string attrib = ""; // TODO analyze attrib and subdivide here?
+ string lang = ""; // blocks: group, block, quote; not codeblock; TODO poem:verse not yet done
+ string syntax = ""; // codeblock only
/+ o_n +/
int o_n_substantive = 0;
int o_n_non_substantive = 0;
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index f603ab8..c4c7365 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -2494,12 +2494,10 @@ template DocReformDocAbstraction() {
static assert(is(typeof(object_number_poem) == string[string]));
}
static auto rgx = Rgx();
- string code_block_syntax = "";
- bool code_block_numbered = false;
if (auto m = line.matchFirst(rgx.block_curly_code_open)) {
- code_block_syntax = (m[1]) ? m[1].to!string : "";
- code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
- ? true : false;
+ an_object["lang"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : "";
debug(codecurly) { // code (curly) open
writefln(
"* [code curly] %s",
@@ -2509,7 +2507,10 @@ template DocReformDocAbstraction() {
obj_type_status["blocks"] = TriState.on;
obj_type_status["code"] = TriState.on;
obj_type_status["curly_code"] = TriState.on;
- } else if (line.matchFirst(rgx.block_curly_poem_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_poem_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(poem) { // poem (curly) open
writefln(
"* [poem curly] %s",
@@ -2521,7 +2522,10 @@ template DocReformDocAbstraction() {
obj_type_status["verse_new"] = State.on;
obj_type_status["poem"] = TriState.on;
obj_type_status["curly_poem"] = TriState.on;
- } else if (line.matchFirst(rgx.block_curly_group_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_group_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(group) { // group (curly) open
writefln(
"* [group curly] %s",
@@ -2531,7 +2535,10 @@ template DocReformDocAbstraction() {
obj_type_status["blocks"] = TriState.on;
obj_type_status["group"] = TriState.on;
obj_type_status["curly_group"] = TriState.on;
- } else if (line.matchFirst(rgx.block_curly_block_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_block_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(block) { // block (curly) open
writefln(
"* [block curly] %s",
@@ -2541,7 +2548,10 @@ template DocReformDocAbstraction() {
obj_type_status["blocks"] = TriState.on;
obj_type_status["block"] = TriState.on;
obj_type_status["curly_block"] = TriState.on;
- } else if (line.matchFirst(rgx.block_curly_quote_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_curly_quote_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = m["attrib"].to!string;
+ an_object["lang"] = m["lang"].to!string;
debug(quote) { // quote (curly) open
writefln(
"* [quote curly] %s",
@@ -2570,9 +2580,9 @@ template DocReformDocAbstraction() {
obj_type_status["table"] = TriState.on;
obj_type_status["curly_table_special_markup"] = TriState.on;
} else if (auto m = line.matchFirst(rgx.block_tic_code_open)) {
- code_block_syntax = (m[1]) ? m[1].to!string : "";
- code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
- ? true : false;
+ an_object["lang"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : "";
debug(codetic) { // code (tic) open
writefln(
"* [code tic] %s",
@@ -2582,7 +2592,10 @@ template DocReformDocAbstraction() {
obj_type_status["blocks"] = TriState.on;
obj_type_status["code"] = TriState.on;
obj_type_status["tic_code"] = TriState.on;
- } else if (line.matchFirst(rgx.block_tic_poem_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_poem_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(poem) { // poem (tic) open
writefln(
"* [poem tic] %s",
@@ -2594,7 +2607,10 @@ template DocReformDocAbstraction() {
obj_type_status["verse_new"] = State.on;
obj_type_status["poem"] = TriState.on;
obj_type_status["tic_poem"] = TriState.on;
- } else if (line.matchFirst(rgx.block_tic_group_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_group_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(group) { // group (tic) open
writefln(
"* [group tic] %s",
@@ -2604,7 +2620,10 @@ template DocReformDocAbstraction() {
obj_type_status["blocks"] = TriState.on;
obj_type_status["group"] = TriState.on;
obj_type_status["tic_group"] = TriState.on;
- } else if (line.matchFirst(rgx.block_tic_block_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_block_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
+ an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
debug(block) { // block (tic) open
writefln(
"* [block tic] %s",
@@ -2614,7 +2633,10 @@ template DocReformDocAbstraction() {
obj_type_status["blocks"] = TriState.on;
obj_type_status["block"] = TriState.on;
obj_type_status["tic_block"] = TriState.on;
- } else if (line.matchFirst(rgx.block_tic_quote_open)) {
+ } else if (auto m = line.matchFirst(rgx.block_tic_quote_open)) {
+ an_object["syntax"] = "";
+ an_object["attrib"] = m["attrib"].to!string;
+ an_object["lang"] = m["lang"].to!string;
debug(quote) { // quote (tic) open
writefln(
"* [quote tic] %s",
@@ -3377,6 +3399,8 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digit_type;
+ comp_obj_block.metainfo.lang = an_object["lang"];
+ comp_obj_block.metainfo.attrib = an_object["attrib"];
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.text = an_object["substantive"];
@@ -3426,6 +3450,8 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
+ comp_obj_block.metainfo.lang = an_object["lang"];
+ comp_obj_block.metainfo.attrib = an_object["attrib"];
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.text = an_object["substantive"];
@@ -3475,6 +3501,8 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digit_type;
+ comp_obj_block.metainfo.lang = an_object["lang"];
+ comp_obj_block.metainfo.attrib = an_object["attrib"];
comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_block.text = an_object["substantive"];
@@ -3560,6 +3588,8 @@ template DocReformDocAbstraction() {
comp_obj_code.metainfo.object_number_off = obj_cite_digits.off;
comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_code.metainfo.object_number_type = obj_cite_digits.type;
+ comp_obj_code.metainfo.syntax = an_object["syntax"];
+ comp_obj_code.metainfo.attrib = an_object["attrib"];
comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"];
comp_obj_code.text = an_object["substantive"];
diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d
index c675f9e..dac10da 100644
--- a/src/doc_reform/meta/object_setter.d
+++ b/src/doc_reform/meta/object_setter.d
@@ -14,6 +14,9 @@ template ObjectSetter() {
alias of_part = is_of_part;
alias of_section = is_of_section;
alias is_of = is_of_type;
+ string attrib = ""; // TODO analyze attrib and subdivide here?
+ string lang = ""; // blocks: group, block, quote; not codeblock; TODO poem:verse not yet done
+ string syntax = ""; // codeblock only
/+ o_n +/
int o_n_substantive = 0;
int o_n_non_substantive = 0;