diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-05-06 11:33:10 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 7a73aa10276b0c1151500d26b194336b56af7aba (patch) | |
tree | e267901f73375393cc429c5c17ce661216de111a /org | |
parent | xmls work particularly with epub output (diff) |
cleaningdoc-reform_v0.0.14
Diffstat (limited to 'org')
-rw-r--r-- | org/ao_conf_make_meta.org | 140 | ||||
-rw-r--r-- | org/ao_debugs.org | 16 | ||||
-rw-r--r-- | org/ao_doc_abstraction.org | 27 | ||||
-rw-r--r-- | org/ao_read_source_files.org | 8 | ||||
-rw-r--r-- | org/compile_time_info.org | 2 | ||||
-rw-r--r-- | org/default_misc.org | 33 | ||||
-rw-r--r-- | org/default_paths.org | 6 | ||||
-rw-r--r-- | org/default_regex.org | 29 | ||||
-rw-r--r-- | org/output_sisupod.org | 8 | ||||
-rw-r--r-- | org/output_xmls.org | 95 | ||||
-rw-r--r-- | org/output_zip.org | 2 | ||||
-rw-r--r-- | org/sdp.org | 8 |
12 files changed, 102 insertions, 272 deletions
diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org index 30e16a0..ad656aa 100644 --- a/org/ao_conf_make_meta.org +++ b/org/ao_conf_make_meta.org @@ -136,141 +136,6 @@ private auto configSettingsSDLangToAAmake(Tag)(Tag conf_sdlang) { #+BEGIN_SRC d private auto documentMakeSDLangToAAmake(Tag)(Tag document_make_sdlang) { auto dochead_make = sdlangToAAmake(make_aa, document_make_sdlang); - /+ - /+ dochead +/ - string hm; - string hs; - /+ make +/ - auto dochead_make = make_aa; - if (!(document_make_sdlang.maybe.tags["make"].empty)) { - hm = "make"; - hs = "bold"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "breaks"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "cover_image"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "css"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "emphasis"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "footer"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "headings"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "home_button_image"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "home_button_text"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "italics"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "num_top"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "substitute"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - hs = "texpdf_font"; - if (!(document_make_sdlang.tags[hm][0].maybe.attributes[hs].empty) - && (document_make_sdlang.tags[hm][0].attributes[hs][0].value.length > 1)) { - debug(headersdlang) { - writeln(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - dochead_make[hm][hs] = - to!string(document_make_sdlang.tags[hm][0].attributes[hs][0].value); - } - } - +/ - /+ - hm = "links"; - if (!(document_make_sdlang.maybe.tags[hm].empty)) { - /+ TODO - stuff to fix - +/ - } - +/ return dochead_make; } #+END_SRC @@ -322,7 +187,6 @@ private auto headerSDLangGet(Hs)(Hs src_header) { char[][] source_header_arr = (cast(char[]) src_header).split(rgx.newline_eol_delimiter); char[] header_clean; - // TODO foreach(header_line; source_header_arr) { if (!match(header_line, rgx.comments)) { header_clean ~= header_line ~ "\n"; @@ -355,7 +219,7 @@ private auto headerSDLangToAAmake(Tag,Ma)(Tag header_sdlang, Ma dochead_make) { auto dochead_meta = sdlangToAAmake(meta_aa, header_sdlang); if (dochead_meta["title"]["main"].empty) { dochead_meta["title"]["main"] = - to!string(header_sdlang.maybe.tags["title"][0].values[0]); // test that this exists + to!string(header_sdlang.maybe.tags["title"][0].values[0]); } if (!(dochead_meta["title"]["subtitle"].empty) && (dochead_meta["title"]["sub"].empty)) { @@ -393,7 +257,7 @@ private auto headerSDLangToAA(Hs,Ma)(Hs header_sdlang_src, Ma conf_doc_make_aa) static assert(is(typeof(header_sdlang_src) == char[])); static assert(is(typeof(conf_doc_make_aa) == string[string][string])); } - auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); // sdlang.ast.Tag + auto header_sdlang_tag = headerSDLangGet(header_sdlang_src); auto header_aa_tuple = headerSDLangToAAmake(header_sdlang_tag, conf_doc_make_aa); return header_aa_tuple; } diff --git a/org/ao_debugs.org b/org/ao_debugs.org index 3a73da0..e0f96da 100644 --- a/org/ao_debugs.org +++ b/org/ao_debugs.org @@ -313,10 +313,14 @@ debug(toc_nav_dom) { break; case DomTags.close_and_open : writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); break; case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); break; default : break; @@ -336,10 +340,14 @@ debug(toc_nav_dom) { break; case DomTags.close_and_open : writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); break; case DomTags.open : - writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + writeln(markup.indent_by_spaces_provided(k), + "<", k, ">", obj.text, + " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); break; default : break; diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org index 878f1a0..f6d65e1 100644 --- a/org/ao_doc_abstraction.org +++ b/org/ao_doc_abstraction.org @@ -961,7 +961,7 @@ continue; #+BEGIN_SRC d assert( !line.empty, - "line tested, line not empty surely" + "line tested, line not empty surely:\n \"" ~ line ~ "\"" ); assert( (type["blocks"] == TriState.off) @@ -976,7 +976,9 @@ if (type["blocks"] == TriState.closing) { assert( line.matchFirst(rgx.book_index) || line.matchFirst(rgx.book_index_open) - || type["book_index"] == State.on + || type["book_index"] == State.on, + "\nblocks closed, unless followed by book index, non-matching line:\n \"" + ~ line ~ "\"" ); } #+END_SRC @@ -1022,7 +1024,7 @@ if (line.matchFirst(rgx.book_index) ++cntr; #+END_SRC -******** flag not set & line not exist: heading or para :heading:paragraph: +******** flag !set & line !exist: heading or para :heading:paragraph: #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d @@ -1080,7 +1082,7 @@ if (line.matchFirst(rgx.book_index) } else if (line_occur["para"] > State.off) { /+ paragraph +/ debug(para) { - writeln(line); + writeln(an_object_key, "-> ", line); } an_object[an_object_key] ~= " " ~ line; ++line_occur["para"]; @@ -1114,7 +1116,8 @@ _block_flag_line_empty_( #+BEGIN_SRC d assert( line.empty, - "line should be empty" + "\nline should be empty:\n \"" + ~ line ~ "\"" ); assert( (type["blocks"] == State.off), @@ -3362,7 +3365,8 @@ void _block_flag_line_empty_(B)( ) { assert( line.empty, - "line should be empty" + "\nline should be empty:\n \"" + ~ line ~ "\"" ); assert( (type["blocks"] == TriState.closing), @@ -3523,7 +3527,7 @@ void _block_flag_line_empty_(B)( obj_cite_number, segment_anchor_tag_that_object_belongs_to ); - an_object["is"] = "verse"; + an_object["is"] = "verse"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -5098,7 +5102,7 @@ struct ObjInlineMarkup { private: #+END_SRC -******* make heading number and segment anchor tags if instructed :markup:inline:segment:anchor:tags: +******* make heading number & segment anchor tags if instructed :markup:inline:segment:anchor:tags: #+name: ao_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d @@ -5239,17 +5243,10 @@ private: } #+END_SRC -******** unittests - -#+name: ao_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags -#+BEGIN_SRC d -#+END_SRC - ******* make segment anchor tags if not provided :markup:inline:segment:anchor:tags: #+name: ao_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d - static string _make_segment_anchor_tags_if_none_provided(M,Lv)(M munge_, Lv lev_) { debug(asserts) { static assert(is(typeof(munge_) == string)); diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index fa3da1a..134b64b 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -29,7 +29,7 @@ template ConfigIn() { } #+END_SRC -** read config file, source string (conf.sdl & sisu_document_make) :file:config: +** read config file, (conf.sdl & sisu_document_make) :file:config: #+name: ao_config_file_in #+BEGIN_SRC d @@ -435,7 +435,7 @@ if (type1["curly_code"] == 1) { auto raw = MarkupRawUnit(); auto markup_sourcesubfile_insert_content = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); - debug(insert) { // insert file + debug(insert_file) { tell_l("red", line); tell_l("red", fn_src_insert); tell_l("fuchsia", "ERROR"); @@ -514,7 +514,7 @@ if (type["curly_code"] == 1) { } auto markup_sourcefile_insert_content = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); - debug(insert) { // insert file + debug(insert_file) { tell_l("red", line); tell_l("red", fn_src_insert); writeln( @@ -546,7 +546,7 @@ if (type["curly_code"] == 1) { #+name: ao_master_doc_scan_for_insert_filenames_post #+BEGIN_SRC d -debug(insert) { // insert file +debug(insert_file) { writeln(__LINE__); writeln(contents.length); } diff --git a/org/compile_time_info.org b/org/compile_time_info.org index 8aa083d..66e56fc 100644 --- a/org/compile_time_info.org +++ b/org/compile_time_info.org @@ -20,7 +20,7 @@ e.g. do on linux bsd osx not windows: version(Windows) {} else { ... } -** 0. compile_time_info: :compile_time_info.d: +** 0. compile_time_info :compile_time_info: #+begin_src d :tangle ../src/sdp/compile_time_info.d /++ diff --git a/org/default_misc.org b/org/default_misc.org index 4b835b1..bf18361 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -229,7 +229,7 @@ auto ptr_head_main = "date", "identifier", "links", - "make", /+ make +/ + "make", "original", "notes", "rights", @@ -473,7 +473,6 @@ template SiSUnode() { "is" : "", "ocn" : "", "attrib" : "", - // "segment_anchor_tag" : "", ]; return _node; } @@ -483,10 +482,6 @@ template SiSUnode() { "indent_base" : 0, "indent_hang" : 0, "bullet" : 0, // bool (0|1) - // "ptr_doc_object" : 0, - // "ptr_html_segnames" : 0, - // "parent_ocn" : 0, - // "parent_lev_markup" : 9, ]; return _node; } @@ -581,23 +576,23 @@ private import #+BEGIN_SRC d template InternalMarkup() { struct InlineMarkup { - auto en_a_o = "【"; auto en_a_c = "】"; // endnote en_a_o: '~{'; en_a_c: '}~'; - auto en_b_o = "〖"; auto en_b_c = "〗"; // endnote en_b_o: '~['; en_b_c: ']~'; - auto lnk_o = "┥"; auto lnk_c = "┝"; // auto lnk_o = "⌠"; auto lnk_c = "⌡"; // '⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o= '◁'; Mx[:lnk_c= '▷' #‹ › + auto en_a_o = "【"; auto en_a_c = "】"; + auto en_b_o = "〖"; auto en_b_c = "〗"; + auto lnk_o = "┥"; auto lnk_c = "┝"; auto url_o = "┤"; auto url_c = "├"; auto mark_internal_site_lnk = "¤"; auto nbsp = "░"; - auto br_line = "┘"; // "╱"; // lB ▌ 9612 ┘ ¶ - auto br_nl = "┙"; // "╲"; // lB ▌ 』 ┘ - auto br_paragraph = "┚"; // "█"; // FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616 + auto br_line = "┘"; + auto br_nl = "┙"; + auto br_paragraph = "┚"; auto br_obj = "break_obj"; - 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 + auto br_page_line = "┼"; + auto br_page = "┿"; + auto br_page_new = "╂"; + auto tc_s = "┊"; + auto tc_o = "┏"; + auto tc_c = "┚"; + auto tc_p = "┆"; string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { _indent_spaces = replicate(_indent_spaces, indent); return _indent_spaces; diff --git a/org/default_paths.org b/org/default_paths.org index 4c1cb3d..65a0c0f 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -158,7 +158,7 @@ template SiSUpathsSisupodZipped() { Lng lng, ) { struct _PathsStruct { - auto spod_pths = SiSUpathsSisupod!()(); // SiSUpodPaths(); + auto spod_pths = SiSUpathsSisupod!()(); string base_filename(string fn_src) { return spod_pths.base_filename(fn_src); } @@ -181,7 +181,7 @@ template SiSUpathsSisupodZipped() { return pod_root(fn_src).chainPath("conf").array; } auto doc(string fn_src) { - return text_root(fn_src); // or pod_root? + return text_root(fn_src); } auto doc_lng(string fn_src) { return text_root(fn_src).chainPath(lng).array; @@ -216,7 +216,7 @@ template SiSUpathsSisupodFileSystem() { Lng lng, ) { struct _PathsStruct { - auto spod_pths = SiSUpathsSisupod!()(); // SiSUpodPaths(); + auto spod_pths = SiSUpathsSisupod!()(); string base_filename(string fn_src) { return spod_pths.base_filename(fn_src); } diff --git a/org/default_regex.org b/org/default_regex.org index baeca25..01aa763 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -62,8 +62,8 @@ 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 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]$`); @@ -128,12 +128,11 @@ static heading_seg_and_above = ctRegex!(`^:?([A-D1])[~] static heading_marker = ctRegex!(`^:?([A-D1-4])[~]`); static heading_anchor_tag = ctRegex!(`^:?[A-D1-4][~]([a-z0-9_.-]+) `,"i"); static heading_identify_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(?:(?:(?:chapter|article|section|clause)\s+[0-9.]+)|(?:[0-9]+))`,"i"); - // unless dob.obj =~/^:?[A-D1-4]~\s+(?:|(?:chapter|article|section|clause)\s+)([0-9.]+)/i static heading_extract_named_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+(chapter|article|section|clause)\s+((?:[0-9]+.)*[0-9]+)(?:[.:;, ]|$)`,"i"); static heading_extract_unnamed_anchor_tag = ctRegex!(`^:?[A-D1-4][~]\s+((?:[0-9]+.)*[0-9]+)(?:[.:;, ]|$)`); static heading_marker_missing_tag = ctRegex!(`^:?([A-D1-4])[~] `); static heading_title = ctRegex!(`^:?[A-D1-4][~][a-z0-9_.-]*[?]?\s+(.+?)$`); -static heading_all = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+(.+?)$`); // test, particularly [2] name/hashtag which may or may not be, does this affect title [3] +static heading_all = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+(.+?)$`); static heading_backmatter = ctRegex!(`^:?1[~][!](glossary|bibliography|biblio|blurb)\s+`,"i"); static heading_biblio = ctRegex!(`^:?(1)[~][!](biblio(?:graphy)?|references?)`); static heading_glossary = ctRegex!(`^:?(1)[~][!](glossary)`); @@ -191,7 +190,7 @@ 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_close = ctRegex!(`^([}]table)`); -static block_curly_table_special_markup = ctRegex!(`^[{]table((~h)?(?P<columns>(?:[ ]+[0-9]+;)+))[}]`, "mg"); // sepcial table block markup +static block_curly_table_special_markup = ctRegex!(`^[{]table((~h)?(?P<columns>(?:[ ]+[0-9]+;)+))[}]`, "mg"); #+END_SRC *** block sub-matches :block:curly: @@ -225,9 +224,9 @@ static inline_text_and_note_square_sp = ctRegex!(`(.+?)~\[[*+]+\ static inline_text_and_note_square = ctRegex!(`(.+?)~\[\s*(.+?)\]~`, "mg"); static inline_note_square_delimiters = ctRegex!(`(~\[\s*)(.+?)(\]~)`, "mg"); static inline_curly_delimiter_open_regular = ctRegex!(`~\{\s*`, "m"); -static inline_curly_delimiter_open_symbol_star = ctRegex!(`~\{[*]\s`, "m"); // -static inline_curly_delimiter_open_symbol_plus = ctRegex!(`~\{[+]\s`, "m"); // -static inline_curly_delimiter_open_star_or_plus = ctRegex!(`~\{[+*]`, "m"); // +static inline_curly_delimiter_open_symbol_star = ctRegex!(`~\{[*]\s`, "m"); +static inline_curly_delimiter_open_symbol_plus = ctRegex!(`~\{[+]\s`, "m"); +static inline_curly_delimiter_open_star_or_plus = ctRegex!(`~\{[+*]`, "m"); static inline_curly_delimiter_close_regular = ctRegex!(`\s*\}~`, "m"); static inline_text_and_note_curly = ctRegex!(`(?P<text>.+?)(?:(?:[~])[{][*+ ]*)(?P<note>.+?)(?:[}][~])`, "mg"); static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73 @@ -259,7 +258,7 @@ static image = ctRegex!(`([a-zA-Z0-9._ /+ inline markup book index +/ static book_index = ctRegex!(`^=\{\s*(.+?)\}$`, "m"); static book_index_open = ctRegex!(`^=\{\s*([^}]+?)$`); -static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); // strip +static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); #+END_SRC ** no obj_cite_number object :ocn:off:object: @@ -288,7 +287,7 @@ static obj_cite_number_block_marks = ctRegex!(`^--[+~-]#$`); #+name: ao_rgx #+BEGIN_SRC d /+ ignore outside code blocks +/ -static skip_from_regular_parse = ctRegex!(`^(--[+~-]#|-[\\]{2}-|=[.\\]{2}=)$`); // not structural info +static skip_from_regular_parse = ctRegex!(`^(--[+~-]#|-[\\]{2}-|=[.\\]{2}=)$`); #+END_SRC ** line & page breaks :break: @@ -387,7 +386,7 @@ static newline = ctRegex!("\n", "mg"); static strip_br = ctRegex!("^<br>\n|<br>\n*$"); static space = ctRegex!(`[ ]`, "mg"); static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg"); -static spaces_multiple = ctRegex!(`(?P<multiple_spaces>[ ]{2,})`, "mg"); // could be issues for endnotes +static spaces_multiple = ctRegex!(`(?P<multiple_spaces>[ ]{2,})`, "mg"); static two_spaces = ctRegex!(`[ ]{2}`, "mg"); static nbsp_char = ctRegex!(`░`, "mg"); static nbsp_chars_line_start = ctRegex!(`^░+`, "mg"); @@ -395,7 +394,7 @@ static nbsp_and_space = ctRegex!(` [ ]`, "m static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg"); #+END_SRC -** filename (and path) matching (including markup insert file) :insert:file:path:filename: +** filename (& path) (including insert file) :insert:file:path:filename: #+name: prgmkup_rgx #+BEGIN_SRC d @@ -443,7 +442,7 @@ static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.f static mark_internal_site_lnk = ctRegex!(`¤`, "mg"); #+END_SRC -*** inline markup font face mod :inline:font:face: +*** inline markup font face mod :inline:font:face: #+name: prgmkup_rgx #+BEGIN_SRC d @@ -471,6 +470,6 @@ static inline_underscore_line = ctRegex!(`^__ (?P<text>. #+name: prgmkup_rgx #+BEGIN_SRC d /+ table delimiters +/ -static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); // -static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); // +static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); +static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); #+END_SRC diff --git a/org/output_sisupod.org b/org/output_sisupod.org index 5471a6a..e161f54 100644 --- a/org/output_sisupod.org +++ b/org/output_sisupod.org @@ -124,7 +124,7 @@ debug(sisupod) { doc_matters.source_filename, )); } -auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive(); +auto zip = new ZipArchive(); auto fn_sisupod = pth_sisupod.sisupod_filename(doc_matters.source_filename); { /+ bundle images +/ foreach (image; doc_matters.image_list) { @@ -243,8 +243,7 @@ if (exists(fn_sisupod)) { auto zipped = new ZipArchive((fn_sisupod).read); foreach (filename, member; zipped.directory) { auto data = zipped.expand(member); - writeln("> ", filename, " length ", data.length); // filename == member.name - // Use data + writeln("> ", filename, " length ", data.length); } } catch (ZipException ex) { @@ -272,8 +271,7 @@ if (exists(fn_sisupod)) { } } } - catch (ErrnoException ex) - { + catch (ErrnoException ex) { // Handle errors } } diff --git a/org/output_xmls.org b/org/output_xmls.org index 1757ffa..4c6013c 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -268,9 +268,11 @@ auto epub3_seg_head(Dm)( <a name="top" id="top"></a>¶", html_simple, doc_matters.dochead_meta["title"]["full"], - (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : ", " ~ doc_matters.dochead_meta["creator"]["author"], + (doc_matters.dochead_meta["creator"]["author"].empty) ? "" + : ", " ~ doc_matters.dochead_meta["creator"]["author"], doc_matters.dochead_meta["title"]["full"], - (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : ", " ~ doc_matters.dochead_meta["creator"]["author"], + (doc_matters.dochead_meta["creator"]["author"].empty) ? "" + : ", " ~ doc_matters.dochead_meta["creator"]["author"], doc_matters.language, ); return o; @@ -368,13 +370,6 @@ auto inline_notes_scroll(O)( writeln(__LINE__, " (missed) markup endnote: ", obj.is_a, ": ", obj.text); } } - // if (obj.inline_notes_star) { - // _txt = replaceAll( - // _txt, - // rgx.inline_notes_delimiter_al_regular_number_note, - // ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") - // ); - // } return _txt; } #+END_SRC @@ -541,7 +536,7 @@ auto heading_scroll(O)( string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); // issue + _txt = inline_markup_scroll(obj, _txt, _suffix); string o = heading(obj, _txt); return o; } @@ -625,7 +620,7 @@ auto para_scroll(O)( string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); // issue + _txt = inline_markup_scroll(obj, _txt, _suffix); string o = para(obj, _txt); return o; } @@ -700,7 +695,7 @@ auto quote_scroll(O)( string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); // issue + _txt = inline_markup_scroll(obj, _txt, _suffix); string o = quote(obj, _txt); return o; } @@ -775,7 +770,7 @@ auto group_scroll(O)( string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); // issue + _txt = inline_markup_scroll(obj, _txt, _suffix); string o = group(obj, _txt); return o; } @@ -846,7 +841,7 @@ auto block_scroll(O)( string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); // issue + _txt = inline_markup_scroll(obj, _txt, _suffix); string o = block(obj, _txt); return o; } @@ -878,7 +873,7 @@ auto block_seg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -auto verse(O)( // using code from code block, review +auto verse(O)( auto return ref const O obj, string _txt, ) { @@ -917,7 +912,7 @@ auto verse_scroll(O)( string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); // issue + _txt = inline_markup_scroll(obj, _txt, _suffix); string o = verse(obj, _txt); return o; } @@ -1002,7 +997,7 @@ auto tablarize(O)( _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) + && (_table_rows.length <= row_idx+2)) { _tablenote ~= cell; } else { string _col_is = (row_idx == 0 && obj.table_heading) ? "th" : "td"; @@ -1274,7 +1269,7 @@ void scroll_write_output(M,C)( } #+END_SRC -*** seg :seg: +*** seg :seg: **** switch (sections & objects) format html output #+name: output_html_seg @@ -1295,7 +1290,7 @@ void seg(D,I)( foreach (part; doc_matters.keys_seq.seg) { foreach (obj; doc_abstraction[part]) { string _txt = xhtml_format.special_characters(obj, obj.text); - if (obj.is_a == "heading") { // all headings: frontmatter, body & backmatter + if (obj.is_a == "heading") { switch (obj.heading_lev_markup) { case 0: .. case 3: /+ fill buffer, and replace with new levels from 1 to 3 +/ @@ -1320,7 +1315,7 @@ void seg(D,I)( goto default; default: auto t = xhtml_format.heading_seg(obj, _txt, suffix); - top_level_headings[obj.heading_lev_markup] = t[0]; // should probably have different css tagging (fontsize etc) + top_level_headings[obj.heading_lev_markup] = t[0]; break; } break; @@ -1340,10 +1335,10 @@ void seg(D,I)( doc_html[segment_filename] ~= to!string(t[0]); doc_html_endnotes[segment_filename] ~= t[1]; break; - case 8: .. case 9: // unused numbers, if remain check + case 8: .. case 9: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check + writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: @@ -1414,7 +1409,7 @@ void seg(D,I)( case "verse": auto t = xhtml_format.verse_seg(obj, _txt, suffix); doc_html[segment_filename] ~= to!string(t[0]); - doc_html_endnotes[segment_filename] ~= t[1]; // work on + doc_html_endnotes[segment_filename] ~= t[1]; break; case "code": doc_html[segment_filename] ~= xhtml_format.code(obj, _txt); @@ -1526,7 +1521,7 @@ void seg_write_output(M,D,E)( foreach (docseg; doc_html_endnotes[seg_filename]) { f.writeln(docseg); } - f.writeln(xhtml_format.tail); // needed for each lev4 + f.writeln(xhtml_format.tail); } } catch (ErrnoException ex) { @@ -1535,7 +1530,7 @@ void seg_write_output(M,D,E)( } #+END_SRC -*** css :css: +*** css :css: #+name: output_html_css #+BEGIN_SRC d @@ -1956,10 +1951,10 @@ void outputEPub3(D,I)( doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; - case 8: .. case 9: // unused numbers, if remain check + case 8: .. case 9: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check + writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: @@ -2026,7 +2021,7 @@ void outputEPub3(D,I)( doc_epub3[segment_filename] ~= to!string(t[0]); doc_epub3_endnotes[segment_filename] ~= t[1]; break; - case "poem": // double check why both poem & verse + case "poem": break; case "verse": auto t = xhtml_format.verse_seg(obj, _txt, suffix); @@ -2222,26 +2217,23 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( { /+ OEBPS/[segments].xhtml (the document contents) +/ foreach (seg_filename; doc_matters.segnames_lv_0_to_4) { string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename); - /+ add zip archive file members (with their content) +/ auto zip_arc_member_file = new ArchiveMember(); - // add seg fn to zip archive zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); debug(epub_output) { string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename); auto f = File(fn_dbg, "w"); } - /+ // f.writeln(seg_head); // not needed built and inserted earlier +/ foreach (docseg; doc_epub3[seg_filename]) { debug(epub_output) { f.writeln(docseg); } - zip_data.write(docseg.dup); // cast as: char[] + zip_data.write(docseg.dup); } foreach (docseg; doc_epub3_endnotes[seg_filename]) { debug(epub_output) { f.writeln(docseg); } - zip_data.write(docseg.dup); // cast as: char[] + zip_data.write(docseg.dup); } - debug(epub_output) { f.writeln(xhtml_format.tail); } // needed for each lev4 - zip_data.write(xhtml_format.tail.dup); // cast as: char[] + debug(epub_output) { f.writeln(xhtml_format.tail); } + zip_data.write(xhtml_format.tail.dup); zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); /+ create the zip file +/ @@ -2257,15 +2249,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( File(fn_dbg, "w").writeln(mimetypes); } fn = pth_epub3.fn_mimetypes(doc_matters.source_filename); - /+ add zip archive file members (with their content) +/ auto zip_arc_member_file = new ArchiveMember(); - // add mimetypes to zip archive zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - zip_data.write(mimetypes.dup); // cast as: char[] + zip_data.write(mimetypes.dup); zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); - /+ create the zip file +/ createZipFile!()(fn_epub, zip.build()); } { /+ META-INF/container.xml (identify doc root) +/ @@ -2274,15 +2263,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( File(fn_dbg, "w").writeln(meta_inf_container_xml); } fn = pth_epub3.fn_dmi_container_xml(doc_matters.source_filename); - /+ add zip archive file members (with their content) +/ auto zip_arc_member_file = new ArchiveMember(); - // add META-INF/container.xml to zip archive zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - zip_data.write(meta_inf_container_xml.dup); // cast as: char[] + zip_data.write(meta_inf_container_xml.dup); zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); - /+ create the zip file +/ createZipFile!()(fn_epub, zip.build()); } { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/ @@ -2291,15 +2277,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( File(fn_dbg, "w").writeln(oebps_toc_nav_xhtml); } fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.source_filename); - /+ add zip archive file members (with their content) +/ auto zip_arc_member_file = new ArchiveMember(); - // add OEBPS/toc_nav.xhtml to zip archive zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - zip_data.write(oebps_toc_nav_xhtml.dup); // cast as: char[] + zip_data.write(oebps_toc_nav_xhtml.dup); zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); - /+ create the zip file +/ createZipFile!()(fn_epub, zip.build()); } { /+ OEBPS/toc.ncx (navigation toc epub2) +/ @@ -2308,15 +2291,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( File(fn_dbg, "w").writeln(oebps_toc_ncx); } fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.source_filename); - /+ add zip archive file members (with their content) +/ auto zip_arc_member_file = new ArchiveMember(); - // add OEBPS/toc.ncx to zip archive zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - zip_data.write(oebps_toc_ncx.dup); // cast as: char[] + zip_data.write(oebps_toc_ncx.dup); zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); - /+ create the zip file +/ createZipFile!()(fn_epub, zip.build()); } { /+ OEBPS/content.opf (doc manifest) +/ @@ -2325,15 +2305,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( File(fn_dbg, "w").writeln(oebps_content_opf); } fn = pth_epub3.fn_oebps_content_opf(doc_matters.source_filename); - /+ add zip archive file members (with their content) +/ auto zip_arc_member_file = new ArchiveMember(); - // add OEBPS/content.opf to zip archive zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - zip_data.write(oebps_content_opf.dup); // cast as: char[] + zip_data.write(oebps_content_opf.dup); zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); - /+ create the zip file +/ createZipFile!()(fn_epub, zip.build()); } { /+ OEBPS/_sisu/image (images) +/ @@ -2376,15 +2353,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( File(fn_dbg, "w").writeln(css.epub_css); } fn = pth_epub3.fn_oebps_css(doc_matters.source_filename); - /+ add zip archive file members (with their content) +/ auto zip_arc_member_file = new ArchiveMember(); - // add OEBPS/content.opf to zip archive zip_arc_member_file.name = fn; auto zip_data = new OutBuffer(); - zip_data.write(css.epub_css.dup); // cast as: char[] + zip_data.write(css.epub_css.dup); zip_arc_member_file.expandedData = zip_data.toBytes(); zip.addMember(zip_arc_member_file); - /+ create the zip file +/ createZipFile!()(fn_epub, zip.build()); } } @@ -2403,8 +2377,7 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( auto zipped = new ZipArchive((fn_epub).read); foreach (filename, member; zipped.directory) { auto data = zipped.expand(member); - writeln(filename, " length ", data.length); // member.name - // Use data + writeln(filename, " length ", data.length); } } catch (ZipException ex) { diff --git a/org/output_zip.org b/org/output_zip.org index a907997..8dd6f23 100644 --- a/org/output_zip.org +++ b/org/output_zip.org @@ -14,7 +14,7 @@ [[./sdp.org][sdp]] [[./][org/]] * _zip_ -** template :template: +** template :template: #+BEGIN_SRC d :tangle ../src/sdp/create_zip_file.d template createZipFile() { diff --git a/org/sdp.org b/org/sdp.org index 0817dfd..edf258e 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -130,7 +130,7 @@ check: #+NAME: imports_sdlang #+BEGIN_SRC d /+ sdlang http://sdlang.org +/ -import sdlang; // sdlang.d +import sdlang; #+END_SRC ****** notes @@ -541,7 +541,7 @@ auto da = SiSUdocAbstraction!()( ); static assert(!isTypeTuple!(da)); static assert(da.length==5); -auto doc_abstraction = da[docAbst.doc_abstraction]; // head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb; +auto doc_abstraction = da[docAbst.doc_abstraction]; /+ head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~ blurb; +/ auto _document_section_keys_sequenced = da[docAbst.section_keys]; string[] _doc_html_segnames = da[docAbst.segnames]; string[] _doc_epub_segnames_0_4 = da[docAbst.segnames_0_4]; @@ -728,7 +728,3 @@ writefln( markup.repeat_character_by_number_provided("-", min_repeat_number), ); #+END_SRC - -markup.repeat_character_by_number_provided("-", 10) -markup.repeat_character_by_number_provided("-", (doc_matters.dochead_meta["title"]["full"].length)) -markup.repeat_character_by_number_provided("-", (doc_matters.source_filename.length)) |