From e8186088585cd04a791c0be89b5c08db8130b3b1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 2 May 2019 21:45:58 -0400 Subject: cosmetic mostly --- org/doc_reform.org | 1 - org/meta_abstraction.org | 337 +++++++++++++++----------------------------- org/meta_conf_make_meta.org | 141 +++++++++--------- 3 files changed, 175 insertions(+), 304 deletions(-) (limited to 'org') diff --git a/org/doc_reform.org b/org/doc_reform.org index d5027fb..32b08be 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -904,7 +904,6 @@ template DocReformHarvestGetFromHead() { // TODO <> enum headBody { header, body_content, insert_file_list, image_list } enum makeMeta { make, meta } - enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images } static auto rgx = Rgx(); auto DocReformHarvestGetFromHead(E,O,M)( // TODO E _env, diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index e3d97ce..677f353 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -54,43 +54,37 @@ template DocReformDocAbstraction() { <> /+ ↓ ↻ loop markup document/text line by line +/ srcDocLoop: - foreach (line; markup_sourcefile_content) { + foreach (line; markup_sourcefile_content) { /+ ↓ markup document/text line by line +/ // "line" variable can be empty but should never be null - /+ ↓ markup document/text line by line +/ <> if (obj_type_status["code"] == TriState.on) { <> - } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { - /+ object other than "code block" object - (includes regular text paragraph, headings & blocks other than code) +/ + } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/ + /+ (includes regular text paragraph, headings & blocks other than code) +/ /+ heading, glossary, blurb, poem, group, block, quote, table +/ <> - } else { - /+ not within a block group +/ + } else { /+ not within a block group +/ <> if (line.matchFirst(rgx.block_open)) { <> - } else if (!line.empty) { - /+ line not empty +/ + } else if (!line.empty) { /+ line not empty +/ /+ non blocks (headings, paragraphs) & closed blocks +/ <> - } else if (obj_type_status["blocks"] == TriState.closing) { - /+ line empty, with blocks flag +/ + } else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ <> - } else { - /+ line.empty, post contents, empty variables: +/ + } else { /+ line.empty, post contents, empty variables: +/ <> } // close else for line empty } // close else for not the above } // close after non code, other blocks or regular text <> - } /+ ← srcDocLoop closed: loop markup document/text line by line +/ + } /+ ← srcDocLoop closed: loop markup document/text line by line +/ /+ ↓ post loop markup document/text +/ <> <> <> /+ post loop markup document/text ↑ +/ - } /+ ← closed: abstract doc source +/ + } /+ ← closed: abstract doc source +/ /+ ↓ abstraction functions +/ <> <> @@ -964,25 +958,25 @@ if there is a blurb section you need to: tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else if (line.matchFirst(rgx.heading) && (opt_action.backmatter && opt_action.section_blurb)) { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "blurb"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = line.to!string; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = false; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "blurb"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = line.to!string; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html; - comp_obj_heading_.metainfo.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv - comp_obj_heading_.metainfo.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_blurb_section ~= comp_obj_heading_; + comp_obj_heading_.metainfo.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv + comp_obj_heading_.metainfo.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + the_blurb_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else { @@ -1013,10 +1007,10 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (obj_type_status["quote"] == TriState.on) { - /+ within block object: quote +/ - line = line._doc_header_and_make_substitutions_(conf_make_meta); - line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); +} else if (obj_type_status["quote"] == TriState.on) { /+ within block object: quote +/ + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); line.txt_block_quote(an_object, obj_type_status); continue; #+END_SRC @@ -1026,11 +1020,10 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d /+ within block object: group +/ -} else if (obj_type_status["group"] == TriState.on) { - /+ within block object: group +/ - line = line._doc_header_and_make_substitutions_(conf_make_meta); - line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); +} else if (obj_type_status["group"] == TriState.on) { /+ within block object: group +/ line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta) .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); line.txt_block_group(an_object, obj_type_status); continue; @@ -1040,10 +1033,10 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (obj_type_status["block"] == TriState.on) { - /+ within block object: block +/ - line = line._doc_header_and_make_substitutions_(conf_make_meta); - line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); +} else if (obj_type_status["block"] == TriState.on) { /+ within block object: block +/ + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); if (auto m = line.match(rgx.spaces_keep)) { line = line .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); @@ -1056,8 +1049,7 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (obj_type_status["poem"] == TriState.on) { - /+ within block object: poem +/ +} else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ line.txt_block_poem(an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, tag_in_seg); continue; #+END_SRC @@ -1066,8 +1058,7 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (obj_type_status["table"] == TriState.on) { - /+ within block object: table +/ +} else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ line.txt_block_table(an_object, obj_type_status, conf_make_meta); continue; #+END_SRC @@ -1089,8 +1080,7 @@ assertions_flag_types_block_status_none_or_closed(obj_type_status); #+name: abs_in_loop_body_open_block_obj #+BEGIN_SRC d -if (line.matchFirst(rgx.block_poem_open)) { - /+ poem to verse exceptions! +/ +if (line.matchFirst(rgx.block_poem_open)) { /+ poem to verse exceptions! +/ object_reset(an_object); processing.remove("verse"); object_number_poem["start"] = obj_cite_digits.object_number.to!string; @@ -1114,7 +1104,7 @@ assert( "code block status: none or closed" ); if (obj_type_status["blocks"] == TriState.closing) { - debug(check) { // block + debug(check) { writeln(__LINE__); writeln(line); } @@ -1134,8 +1124,7 @@ if (obj_type_status["blocks"] == TriState.closing) { #+BEGIN_SRC d if (line.matchFirst(rgx.book_index) || line.matchFirst(rgx.book_index_open) -|| obj_type_status["book_index"] == State.on ) { - /+ book_index +/ +|| obj_type_status["book_index"] == State.on ) { /+ book_index +/ line._book_index_(book_idx_tmp, an_object, obj_type_status, opt_action); #+END_SRC @@ -1143,8 +1132,7 @@ if (line.matchFirst(rgx.book_index) #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d -} else { - /+ not book_index +/ +} else { /+ not book_index +/ #+END_SRC ******** matched: comment :comment:match: @@ -1152,8 +1140,7 @@ if (line.matchFirst(rgx.book_index) #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d an_object_key="body_nugget"; - if (auto m = line.matchFirst(rgx.comment)) { - /+ matched comment +/ + if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/ debug(comment) { writeln(line); } @@ -1177,19 +1164,16 @@ if (line.matchFirst(rgx.book_index) } else if (((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) && ((obj_type_status["para"] == State.off) - && (obj_type_status["heading"] == State.off))) { - /+ heading or para but neither flag nor line exists +/ + && (obj_type_status["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/ if ((conf_make_meta.make.headings.length > 2) - && (obj_type_status["make_headings"] == State.off)) { - /+ heading found +/ + && (obj_type_status["make_headings"] == State.off)) { /+ heading found +/ line._heading_found_(conf_make_meta.make.headings, heading_match_str, heading_match_rgx, obj_type_status); } if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) && ((obj_type_status["para"] == State.off) - && (obj_type_status["heading"] == State.off))) { - /+ heading make set +/ + && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ line = line._heading_make_set_(line_occur, heading_match_rgx, obj_type_status); } /+ TODO node info: all headings identified at this point, @@ -1198,15 +1182,14 @@ if (line.matchFirst(rgx.book_index) - should be incorporated in composite objects - should happen before endnote links set (they need to be moved down?) +/ - if (line.matchFirst(rgx.heading)) { - /+ heading match +/ + if (line.matchFirst(rgx.heading)) { /+ heading match +/ line = line._doc_header_and_make_substitutions_(conf_make_meta); line._heading_matched_(line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta); - } else if (line_occur["para"] == State.off) { - /+ para match +/ + } else if (line_occur["para"] == State.off) { /+ para match +/ an_object_key="body_nugget"; - line = line._doc_header_and_make_substitutions_(conf_make_meta); - line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); line._para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); } #+END_SRC @@ -1215,8 +1198,7 @@ if (line.matchFirst(rgx.book_index) #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d - } else if (line_occur["heading"] > State.off) { - /+ heading +/ + } else if (line_occur["heading"] > State.off) { /+ heading +/ debug(heading) { writeln(line); } @@ -1228,13 +1210,13 @@ if (line.matchFirst(rgx.book_index) #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d - } else if (line_occur["para"] > State.off) { - /+ paragraph +/ + } else if (line_occur["para"] > State.off) { /+ paragraph +/ debug(para) { writeln(an_object_key, "-> ", line); } - line = line._doc_header_and_make_substitutions_(conf_make_meta); - line = line._doc_header_and_make_substitutions_fontface_(conf_make_meta); + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); an_object[an_object_key] ~= " " ~ line; ++line_occur["para"]; } @@ -1287,8 +1269,7 @@ if (_new_doc) { tag_in_seg = tag_in_seg.init; } if ((obj_type_status["heading"] == State.on) -&& (line_occur["heading"] > State.off)) { - /+ heading object (current line empty) +/ +&& (line_occur["heading"] > State.off)) { /+ heading object (current line empty) +/ obj_cite_digits = (an_object["lev_markup_number"].to!int == 0) ? ocn_emit(OCNstatus.reset) : ocn_emit(obj_type_status["ocn_status"]); @@ -1329,7 +1310,7 @@ if ((obj_type_status["heading"] == State.on) tag_assoc[anchor_tag]["seg_lv1_to_4"] = tag_in_seg["seg_lv1_to_4"]; } else if (an_object["lev_markup_number"].to!int < 4) { string segn; - switch (an_object["lev_markup_number"].to!int) { /+ names used for epub markup segments A to D +/ + switch (an_object["lev_markup_number"].to!int) { /+ names used for epub markup segments A to D +/ case 0: segn = "_the_title"; goto default; @@ -1465,7 +1446,7 @@ if ((obj_type_status["heading"] == State.on) comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links]; comp_obj_para.has.image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions]; the_document_body_section ~= comp_obj_para; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); _common_reset_(line_occur, an_object, obj_type_status); indent=[ "hang_position" : 0, @@ -1494,12 +1475,11 @@ if (the_document_body_section.length > 0) { && (the_document_body_section.length > previous_length)) { if ((the_document_body_section[$-1].metainfo.is_a == "heading") && (the_document_body_section[$-1].metainfo.heading_lev_markup < 5)) { - obj_type_status["biblio_section"] = State.off; obj_type_status["glossary_section"] = State.off; + obj_type_status["biblio_section"] = State.off; obj_type_status["blurb_section"] = State.off; } - if (the_document_body_section[$-1].metainfo.is_a == "verse") { - /+ scan for endnotes for whole poem (each verse in poem) +/ + if (the_document_body_section[$-1].metainfo.is_a == "verse") { /+ scan for endnotes for whole poem (each verse in poem) +/ foreach (i; previous_length .. the_document_body_section.length) { if (the_document_body_section[i].metainfo.is_a == "verse") { if ((the_document_body_section[i].text).match( @@ -1513,8 +1493,7 @@ if (the_document_body_section.length > 0) { } } } - } else { - /+ scan object for endnotes +/ + } else { /+ scan object for endnotes +/ previous_length = the_document_body_section.length.to!int; if ((the_document_body_section[$-1].text).match( rgx.inline_notes_al_regular_number_note @@ -2696,8 +2675,7 @@ if (the_bibliography_section.length > 1) { int ocn_ = obj_cite_digits.object_number; int ocn_bkidx_ = 0; int ocn_bidx_; -if (the_bookindex_section.length > 1) { - /+ scroll +/ +if (the_bookindex_section.length > 1) { /+ scroll +/ dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; foreach (ref obj; the_bookindex_section) { @@ -3086,7 +3064,7 @@ auto _common_reset_(L,O,T)( line_occur["para"] = State.off; obj_type_status["heading"] = State.off; obj_type_status["para"] = State.off; - an_object = object_reset(an_object); + an_object = an_object.object_reset; } #+END_SRC @@ -3103,13 +3081,11 @@ static auto _check_ocn_status_(L,T)( static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if ( - !(line.empty) + if (!(line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) ) { /+ not multi-line object, check whether object_number is on or turned off +/ - if (line.matchFirst(rgx.object_number_block_marks)) { - /+ switch off object_number +/ + if (line.matchFirst(rgx.object_number_block_marks)) { /+ switch off object_number +/ if (line.matchFirst(rgx.object_number_off_block)) { obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on; obj_type_status["ocn_status"] = OCNstatus.off; @@ -3252,7 +3228,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d if (auto m = line.matchFirst(rgx.block_curly_code_open)) { - /+ curly code open +/ code_block_syntax = (m[1]) ? m[1].to!string : ""; code_block_numbered = (m[2].matchFirst(rgx.code_numbering)) ? true : false; @@ -3272,7 +3247,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_poem_open)) { - /+ curly poem open +/ debug(poem) { // poem (curly) open writefln( "* [poem curly] %s", @@ -3291,7 +3265,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_group_open)) { - /+ curly group open +/ debug(group) { // group (curly) open writefln( "* [group curly] %s", @@ -3308,7 +3281,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_block_open)) { - /+ curly block open +/ debug(block) { // block (curly) open writefln( "* [block curly] %s", @@ -3325,7 +3297,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_curly_quote_open)) { - /+ curly quote open +/ debug(quote) { // quote (curly) open writefln( "* [quote curly] %s", @@ -3341,8 +3312,7 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { - /+ curly table open +/ + } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open writefln( "* [table curly] %s", @@ -3360,8 +3330,7 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { - /+ table: special table block markup syntax! +/ + } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ an_object["table_head"] = m["attrib"].to!string; an_object["block_type"] = "special"; obj_type_status["blocks"] = TriState.on; @@ -3375,7 +3344,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { - /+ tic code open +/ code_block_syntax = (m[1]) ? m[1].to!string : ""; code_block_numbered = (m[2].matchFirst(rgx.code_numbering)) ? true : false; @@ -3395,7 +3363,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_poem_open)) { - /+ tic poem open +/ debug(poem) { // poem (tic) open writefln( "* [poem tic] %s", @@ -3414,7 +3381,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_group_open)) { - /+ tic group open +/ debug(group) { // group (tic) open writefln( "* [group tic] %s", @@ -3431,7 +3397,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_block_open)) { - /+ tic block open +/ debug(block) { // block (tic) open writefln( "* [block tic] %s", @@ -3448,7 +3413,6 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d } else if (line.matchFirst(rgx.block_tic_quote_open)) { - /+ tic quote open +/ debug(quote) { // quote (tic) open writefln( "* [quote tic] %s", @@ -3464,8 +3428,7 @@ void txt_block_start(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { - /+ tic table open +/ + } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open writefln( "* [table tic] %s", @@ -3615,15 +3578,16 @@ void txt_block_biblio( auto jsn = BibJsnStr(); static auto rgx = Rgx(); if (line.matchFirst(rgx.heading_biblio) - && obj_type_status["para"] != State.on - && obj_type_status["group"] != State.on - && obj_type_status["block"] != State.on - && obj_type_status["poem"] != State.on - && obj_type_status["table"] != State.on - && obj_type_status["quote"] != State.on) { + && obj_type_status["para"] != State.on + && obj_type_status["group"] != State.on + && obj_type_status["block"] != State.on + && obj_type_status["poem"] != State.on + && obj_type_status["table"] != State.on + && obj_type_status["quote"] != State.on + ) { + obj_type_status["glossary_section"] = State.off; obj_type_status["biblio_section"] = TriState.on; obj_type_status["blurb_section"] = State.off; - obj_type_status["glossary_section"] = State.off; } if (line.empty) { debug { @@ -3953,16 +3917,16 @@ void txt_block_poem(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + 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"]; comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); } object_reset(an_object); processing.remove("verse"); @@ -4016,16 +3980,16 @@ void txt_block_poem(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + 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"]; comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); object_reset(an_object); processing.remove("verse"); ++cntr; @@ -4062,16 +4026,16 @@ void txt_block_poem(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + 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"]; comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); object_number_poem["end"] = obj_cite_digits.object_number.to!string; object_reset(an_object); processing.remove("verse"); @@ -4125,16 +4089,16 @@ void txt_block_poem(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + 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"]; comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); object_reset(an_object); processing.remove("verse"); ++cntr; @@ -4165,8 +4129,8 @@ you need: #+name: abs_functions_block_table #+BEGIN_SRC d void txt_block_table(L,O,T,CMM)( - L line, - return ref O an_object, + L line, + return ref O an_object, return ref T obj_type_status, return ref CMM conf_make_meta, ) { @@ -4352,16 +4316,16 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + 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"]; comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); obj_type_status["blocks"] = TriState.off; obj_type_status["quote"] = TriState.off; object_reset(an_object); @@ -4407,16 +4371,16 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + 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"]; comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); obj_type_status["blocks"] = TriState.off; obj_type_status["group"] = TriState.off; object_reset(an_object); @@ -4462,10 +4426,10 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + 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"]; comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -4557,12 +4521,12 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_code.metainfo.is_of_type = "block"; comp_obj_code.metainfo.is_a = "code"; comp_obj_code.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_code.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_code.metainfo.identifier = obj_cite_digits.identifier; comp_obj_code.metainfo.object_number_off = obj_cite_digits.off; - 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.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_code.metainfo.object_number_type = obj_cite_digits.type; + 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"]; comp_obj_code.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -4649,8 +4613,7 @@ auto _book_index_(L,I,O,T,B)( static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (auto m = line.match(rgx.book_index)) { - /+ match book_index +/ + if (auto m = line.match(rgx.book_index)) { /+ match book_index +/ debug(bookindexmatch) { writefln( "* [bookindex] %s\n", @@ -4658,8 +4621,7 @@ auto _book_index_(L,I,O,T,B)( ); } an_object["bookindex_nugget"] = m.captures[1].to!string; - } else if (auto m = line.match(rgx.book_index_open)) { - /+ match open book_index +/ + } else if (auto m = line.match(rgx.book_index_open)) { /+ match open book_index +/ obj_type_status["book_index"] = State.on; if (opt_action.backmatter && opt_action.section_bookindex) { book_idx_tmp = m.captures[1].to!string; @@ -4670,8 +4632,7 @@ auto _book_index_(L,I,O,T,B)( ); } } - } else if (obj_type_status["book_index"] == State.on ) { - /+ book_index flag set +/ + } else if (obj_type_status["book_index"] == State.on ) { /+ book_index flag set +/ if (auto m = line.match(rgx.book_index_close)) { obj_type_status["book_index"] = State.off; if (opt_action.backmatter @@ -4716,8 +4677,7 @@ auto _heading_found_(L,X,H,R,T)( } static auto rgx = Rgx(); if ((_make_unmarked_headings.length > 2) - && (obj_type_status["make_headings"] == State.off)) { - /+ headings found +/ + && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ debug(headingsfound) { writeln(_make_unmarked_headings); } @@ -4810,8 +4770,7 @@ auto _heading_make_set_(L,C,R,T)( && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) && ((obj_type_status["para"] == State.off) - && (obj_type_status["heading"] == State.off))) { - /+ heading make set +/ + && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ if (line.matchFirst(heading_match_rgx["h_B"])) { line = "B~ " ~ line; debug(headingsfound) { @@ -4883,14 +4842,13 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,CMM)( static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (auto m = line.match(rgx.heading)) { - /+ heading match +/ + if (auto m = line.match(rgx.heading)) { /+ heading match +/ ++line_occur["heading"]; obj_type_status["heading"] = State.on; obj_type_status["para"] = State.off; if (line.match(rgx.heading_seg_and_above)) { - obj_type_status["biblio_section"] = State.off; obj_type_status["glossary_section"] = State.off; + obj_type_status["biblio_section"] = State.off; obj_type_status["blurb_section"] = State.off; } an_object[an_object_key] ~= line ~= "\n"; @@ -5277,31 +5235,6 @@ auto table_array_munge(O,T)( } #+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, -) { - static auto rgx = Rgx(); - static 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 @@ -5433,7 +5366,7 @@ static struct ObjInlineMarkupMunge { static auto mng = InlineMarkup(); /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented - if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ + if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ debug(images) { writeln("Image: ", obj_txt_in); } @@ -6265,56 +6198,6 @@ private: } #+END_SRC -******** unittests - -#+name: meta_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags -#+BEGIN_SRC d - unittest { - string txt_lev="1"; - string txt_in, txt_out; - - txt_in = "1~copyright Copyright"; - txt_out ="1~copyright Copyright"; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in = "1~ 6. Writing Copyright Licenses"; - txt_out ="1~s6 6. Writing Copyright Licenses"; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ 1. Reinforcing trends"; - txt_out= "1~s1 1. Reinforcing trends"; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ 11 SCIENCE AS A COMMONS"; - txt_out= "1~s11 11 SCIENCE AS A COMMONS"; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ Chapter 1"; - txt_out="1~chapter_1 Chapter 1"; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ Chapter 1."; - txt_out="1~chapter_1 Chapter 1."; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ Chapter 1: Done"; - txt_out="1~chapter_1 Chapter 1: Done"; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ Chapter 11 - The Battle Over the Institutional Ecology of the Digital Environment"; - txt_out= "1~chapter_11 Chapter 11 - The Battle Over the Institutional Ecology of the Digital Environment"; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ CHAPTER I."; - txt_out="1~x1 CHAPTER I."; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - - txt_in= "1~ CHAPTER II."; - txt_out="1~x2 CHAPTER II."; - assert(_make_segment_anchor_tags_if_none_provided(txt_in, txt_lev) == txt_out); - } -#+END_SRC - ****** } #+name: meta_emitters_obj_inline_markup_close diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 71f9124..a0440e3 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -499,64 +499,59 @@ if ("make" in _json.object) { ) { _struct_composite.make_str.emphasis = _json.object["make"]["emphasis"].str; } - if ("footer" in _json.object["make"] - && (_json.object["make"]["footer"].type().to!string == "string") - ) { - char[][] __match_footer_array - = (cast(char[]) _json.object["make"]["footer"].str) - .split(_rgx.make_heading_delimiter); - _struct_composite.make_str.footer = __match_footer_array.to!(string[]); - } else if ("footer" in _json.object["make"] - && _json.object["make"]["footer"].type().to!string == "array") { - string[] _match_footer_array; - foreach (_match_heading; _json.object["make"]["footer"].arrayNoRef) { - _match_footer_array ~= _match_heading.str; + if ("footer" in _json.object["make"]) { + if (_json.object["make"]["footer"].type().to!string == "string") { + char[][] __match_footer_array + = (cast(char[]) _json.object["make"]["footer"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.footer = __match_footer_array.to!(string[]); + } else if (_json.object["make"]["footer"].type().to!string == "array") { + string[] _match_footer_array; + foreach (_match_heading; _json.object["make"]["footer"].arrayNoRef) { + _match_footer_array ~= _match_heading.str; + } + _struct_composite.make_str.footer = _match_footer_array; } - _struct_composite.make_str.footer = _match_footer_array; - } - if ("headings" in _json.object["make"] - && (_json.object["make"]["headings"].type().to!string == "string") - ) { - char[][] __match_headings_array - = (cast(char[]) _json.object["make"]["headings"].str) - .split(_rgx.make_heading_delimiter); - _struct_composite.make_str.headings = __match_headings_array.to!(string[]); - } else if ("headings" in _json.object["make"] - && _json.object["make"]["headings"].type().to!string == "array") { - string[] _match_headings_array; - foreach (_match_heading; _json.object["make"]["headings"].arrayNoRef) { - _match_headings_array ~= _match_heading.str; + } + if ("headings" in _json.object["make"]) { + if (_json.object["make"]["headings"].type().to!string == "string") { + char[][] __match_headings_array + = (cast(char[]) _json.object["make"]["headings"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.headings = __match_headings_array.to!(string[]); + } else if (_json.object["make"]["headings"].type().to!string == "array") { + string[] _match_headings_array; + foreach (_match_heading; _json.object["make"]["headings"].arrayNoRef) { + _match_headings_array ~= _match_heading.str; + } + _struct_composite.make_str.headings = _match_headings_array; } - _struct_composite.make_str.headings = _match_headings_array; - } - if ("home_button_image" in _json.object["make"] - && (_json.object["make"]["home_button_image"].type().to!string == "string") - ) { - char[][] __match_home_button_image_array - = (cast(char[]) _json.object["make"]["home_button_image"].str) - .split(_rgx.make_heading_delimiter); - _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); - } else if ("home_button_image" in _json.object["make"] - && _json.object["make"]["home_button_image"].type().to!string == "array") { - string[] _match_home_button_image_array; - foreach (_match_heading; _json.object["make"]["home_button_image"].arrayNoRef) { - _match_home_button_image_array ~= _match_heading.str; + } + if ("home_button_image" in _json.object["make"]) { + if (_json.object["make"]["home_button_image"].type().to!string == "string") { + char[][] __match_home_button_image_array + = (cast(char[]) _json.object["make"]["home_button_image"].str) + .split(_rgx.make_heading_delimiter); + _struct_composite.make_str.home_button_image = __match_home_button_image_array.to!(string[]); + } else if (_json.object["make"]["home_button_image"].type().to!string == "array") { + string[] _match_home_button_image_array; + foreach (_match_heading; _json.object["make"]["home_button_image"].arrayNoRef) { + _match_home_button_image_array ~= _match_heading.str; + } + _struct_composite.make_str.home_button_image = _match_home_button_image_array; } - _struct_composite.make_str.home_button_image = _match_home_button_image_array; } - if ("home_button_text" in _json.object["make"] - && (_json.object["make"]["home_button_text"].type().to!string == "string") - ) { - _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str; - } else if ("home_button_text" in _json.object["make"] - && _json.object["make"]["home_button_text"].type().to!string == "array" - ) { - string[] _match_home_button_text_array; - foreach (_match_heading; _json.object["make"]["home_button_text"].arrayNoRef) { - _match_home_button_text_array ~= _match_heading.str; + if ("home_button_text" in _json.object["make"]) { + if (_json.object["make"]["home_button_text"].type().to!string == "string") { + _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str; + } else if (_json.object["make"]["home_button_text"].type().to!string == "array") { + string[] _match_home_button_text_array; + foreach (_match_heading; _json.object["make"]["home_button_text"].arrayNoRef) { + _match_home_button_text_array ~= _match_heading.str; + } + string _match_home_button_text_str = (_match_home_button_text_array).join("; "); + _struct_composite.make_str.home_button_text = _match_home_button_text_str; } - string _match_home_button_text_str = (_match_home_button_text_array).join("; "); - _struct_composite.make_str.home_button_text = _match_home_button_text_str; } if ("italics" in _json.object["make"] && (_json.object["make"]["italics"].type().to!string == "string") @@ -588,35 +583,29 @@ if ("make" in _json.object) { break; } } - if ("auto_num_depth" in _json.object["make"] - && (_json.object["make"]["auto_num_depth"].type().to!string == "INTEGER") - ) { - _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].integer.to!int; - } else if ("auto_num_depth" in _json.object["make"] - && (_json.object["make"]["auto_num_depth"].type().to!string == "string") - ) { - _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].str.to!int; + if ("auto_num_depth" in _json.object["make"]) { + if (_json.object["make"]["auto_num_depth"].type().to!string == "int") { // TODO watch this match + _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].integer.to!int; + } else if (_json.object["make"]["auto_num_depth"].type().to!string == "string") { + _struct_composite.make_str.auto_num_depth = _json.object["make"]["auto_num_depth"].str.to!int; + } } if ("substitute" in _json.object["make"]) { string[][] _sub; - if ( - (_json.object["make"]["substitute"].type().to!string == "array") - && (_json.object["make"]["substitute"][0].type().to!string == "array") - ) { - foreach (substitute_pair; _json.object["make"]["substitute"].arrayNoRef) { - if ((substitute_pair.type().to!string) == "array") { - if (!empty(substitute_pair[0].str) && !empty(substitute_pair[1].str)) { - _sub ~= [ substitute_pair[0].str, substitute_pair[1].str]; + if (_json.object["make"]["substitute"].type().to!string == "array") { + if (_json.object["make"]["substitute"][0].type().to!string == "array") { + foreach (substitute_pair; _json.object["make"]["substitute"].arrayNoRef) { + if ((substitute_pair.type().to!string) == "array") { + if (!empty(substitute_pair[0].str) && !empty(substitute_pair[1].str)) { + _sub ~= [ substitute_pair[0].str, substitute_pair[1].str]; + } } } + } else if (_json.object["make"]["substitute"][0].type().to!string == "string") { + if (!empty(_json.object["make"]["substitute"][0].str) && !empty(_json.object["make"]["substitute"][1].str)) { + _sub = [[_json.object["make"]["substitute"][0].str, _json.object["make"]["substitute"][1].str]]; + } } - } else if ( - (_json.object["make"]["substitute"].type().to!string == "array") - && (_json.object["make"]["substitute"][0].type().to!string == "string") - ) { - if (!empty(_json.object["make"]["substitute"][0].str) && !empty(_json.object["make"]["substitute"][1].str)) { - _sub = [[_json.object["make"]["substitute"][0].str, _json.object["make"]["substitute"][1].str]]; - } } // writeln(_sub); _struct_composite.make_str.substitute = _sub; -- cgit v1.2.3