From 7a73aa10276b0c1151500d26b194336b56af7aba Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 6 May 2017 11:33:10 -0400 Subject: cleaning --- src/sdp/abstraction.d | 4 +- src/sdp/ao_abstract_doc_source.d | 18 ++--- src/sdp/ao_conf_make_meta_sdlang.d | 140 +------------------------------------ src/sdp/ao_defaults.d | 33 ++++----- src/sdp/ao_doc_debugs.d | 16 +++-- src/sdp/ao_read_source_files.d | 6 +- src/sdp/ao_rgx.d | 25 ++++--- src/sdp/defaults.d | 26 +++---- src/sdp/output_epub3.d | 50 ++++--------- src/sdp/output_html.d | 12 ++-- src/sdp/output_rgx.d | 6 +- src/sdp/output_xmls.d | 29 ++++---- src/sdp/paths_output.d | 6 +- src/sdp/source_sisupod.d | 8 +-- 14 files changed, 109 insertions(+), 270 deletions(-) (limited to 'src/sdp') diff --git a/src/sdp/abstraction.d b/src/sdp/abstraction.d index 51b76d6..726513c 100644 --- a/src/sdp/abstraction.d +++ b/src/sdp/abstraction.d @@ -14,7 +14,7 @@ template SiSUabstraction() { output_hub, paths_source; /+ sdlang http://sdlang.org +/ - import sdlang; // sdlang.d + import sdlang; /+ std +/ private import std.array, @@ -70,7 +70,7 @@ template SiSUabstraction() { ); 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]; diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index f231af6..baf13b8 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -613,7 +613,7 @@ template SiSUdocAbstraction() { /+ non blocks (headings, paragraphs) & closed blocks +/ assert( !line.empty, - "line tested, line not empty surely" + "line tested, line not empty surely:\n \"" ~ line ~ "\"" ); assert( (type["blocks"] == TriState.off) @@ -628,7 +628,9 @@ template SiSUdocAbstraction() { 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 ~ "\"" ); } if (line.matchFirst(rgx.book_index) @@ -696,7 +698,7 @@ template SiSUdocAbstraction() { } 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"]; @@ -721,7 +723,8 @@ template SiSUdocAbstraction() { /+ line.empty, post contents, empty variables: +/ assert( line.empty, - "line should be empty" + "\nline should be empty:\n \"" + ~ line ~ "\"" ); assert( (type["blocks"] == State.off), @@ -2577,7 +2580,8 @@ template SiSUdocAbstraction() { ) { assert( line.empty, - "line should be empty" + "\nline should be empty:\n \"" + ~ line ~ "\"" ); assert( (type["blocks"] == TriState.closing), @@ -2714,7 +2718,7 @@ template SiSUdocAbstraction() { 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, @@ -4175,8 +4179,6 @@ template SiSUdocAbstraction() { } return munge_; } - - 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/src/sdp/ao_conf_make_meta_sdlang.d b/src/sdp/ao_conf_make_meta_sdlang.d index 533f482..74bb996 100644 --- a/src/sdp/ao_conf_make_meta_sdlang.d +++ b/src/sdp/ao_conf_make_meta_sdlang.d @@ -45,141 +45,6 @@ template SiSUheaderExtractSDLang() { } 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; } final private auto headerMakeSDLang(Hs)(Hs src_header) { @@ -218,7 +83,6 @@ template SiSUheaderExtractSDLang() { 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"; @@ -245,7 +109,7 @@ template SiSUheaderExtractSDLang() { 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)) { @@ -277,7 +141,7 @@ template SiSUheaderExtractSDLang() { 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/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d index 0f1ba2a..363cc39 100644 --- a/src/sdp/ao_defaults.d +++ b/src/sdp/ao_defaults.d @@ -170,7 +170,7 @@ template SiSUregisters() { "date", "identifier", "links", - "make", /+ make +/ + "make", "original", "notes", "rights", @@ -325,7 +325,6 @@ template SiSUnode() { "is" : "", "ocn" : "", "attrib" : "", - // "segment_anchor_tag" : "", ]; return _node; } @@ -335,10 +334,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; } @@ -382,23 +377,23 @@ template SiSUbiblio() { } 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/src/sdp/ao_doc_debugs.d b/src/sdp/ao_doc_debugs.d index 11eb148..e650e5b 100644 --- a/src/sdp/ao_doc_debugs.d +++ b/src/sdp/ao_doc_debugs.d @@ -125,10 +125,14 @@ template SiSUdebugs() { break; case DomTags.close_and_open : writeln(markup.indent_by_spaces_provided(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; @@ -148,10 +152,14 @@ template SiSUdebugs() { break; case DomTags.close_and_open : writeln(markup.indent_by_spaces_provided(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/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d index b47918a..33e7987 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao_read_source_files.d @@ -196,7 +196,7 @@ template SiSUrawMarkupContent() { 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"); @@ -264,7 +264,7 @@ template SiSUrawMarkupContent() { } 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( @@ -291,7 +291,7 @@ template SiSUrawMarkupContent() { contents ~= line; } } // end src doc loop - debug(insert) { // insert file + debug(insert_file) { writeln(__LINE__); writeln(contents.length); } diff --git a/src/sdp/ao_rgx.d b/src/sdp/ao_rgx.d index 8c73423..38c7fae 100644 --- a/src/sdp/ao_rgx.d +++ b/src/sdp/ao_rgx.d @@ -26,8 +26,8 @@ template SiSUrgxInit() { 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]$`); @@ -67,12 +67,11 @@ template SiSUrgxInit() { 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)`); @@ -111,7 +110,7 @@ template SiSUrgxInit() { 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(?:[ ]+[0-9]+;)+))[}]`, "mg"); // sepcial table block markup + static block_curly_table_special_markup = ctRegex!(`^[{]table((~h)?(?P(?:[ ]+[0-9]+;)+))[}]`, "mg"); static table_head_instructions = ctRegex!(`(?Ph)?(?:[ ]+c(?P[0-9]);)?(?P(?:[ ]+[0-9]+[lr]?;)+)`); static table_col_widths_and_alignment = ctRegex!(`(?P[0-9]+)(?P[lr]?)`); static table_col_widths = ctRegex!(`(?P[0-9]+)`); @@ -133,9 +132,9 @@ template SiSUrgxInit() { 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.+?)(?:(?:[~])[{][*+ ]*)(?P.+?)(?:[}][~])`, "mg"); static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73 @@ -149,7 +148,7 @@ template SiSUrgxInit() { /+ 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"); /+ no obj_cite_number object +/ static obj_cite_number_off = ctRegex!(`~#$`, "m"); static obj_cite_number_off_dh = ctRegex!(`-#$`, "m"); @@ -160,7 +159,7 @@ template SiSUrgxInit() { static obj_cite_number_off_block_close = ctRegex!(`^--\+#$`); static obj_cite_number_block_marks = ctRegex!(`^--[+~-]#$`); /+ ignore outside code blocks +/ - static skip_from_regular_parse = ctRegex!(`^(--[+~-]#|-[\\]{2}-|=[.\\]{2}=)$`); // not structural info + static skip_from_regular_parse = ctRegex!(`^(--[+~-]#|-[\\]{2}-|=[.\\]{2}=)$`); /+ line & page breaks +/ static break_line_within_object = ctRegex!(`[\\]{2}( |$)`); static break_page = ctRegex!(`^-[\\]{2}-$`); @@ -187,7 +186,7 @@ template SiSUrgxInit() { static strip_br = ctRegex!("^
\n|
\n*$"); static space = ctRegex!(`[ ]`, "mg"); static spaces_line_start = ctRegex!(`^(?P[ ]+)`, "mg"); - static spaces_multiple = ctRegex!(`(?P[ ]{2,})`, "mg"); // could be issues for endnotes + static spaces_multiple = ctRegex!(`(?P[ ]{2,})`, "mg"); static two_spaces = ctRegex!(`[ ]{2}`, "mg"); static nbsp_char = ctRegex!(`░`, "mg"); static nbsp_chars_line_start = ctRegex!(`^░+`, "mg"); @@ -240,7 +239,7 @@ template SiSUrgxInit() { static inline_italics_line = ctRegex!(`^/_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_underscore_line = ctRegex!(`^__ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); /+ 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"); } } diff --git a/src/sdp/defaults.d b/src/sdp/defaults.d index bbfd8d8..d4e4220 100644 --- a/src/sdp/defaults.d +++ b/src/sdp/defaults.d @@ -4,23 +4,23 @@ 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/src/sdp/output_epub3.d b/src/sdp/output_epub3.d index 074808c..56f9be3 100644 --- a/src/sdp/output_epub3.d +++ b/src/sdp/output_epub3.d @@ -346,10 +346,10 @@ template outputEPub3() { 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: @@ -416,7 +416,7 @@ template outputEPub3() { 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); @@ -606,26 +606,23 @@ template outputEPub3() { { /+ 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 +/ @@ -641,15 +638,12 @@ template outputEPub3() { 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) +/ @@ -658,15 +652,12 @@ template outputEPub3() { 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) +/ @@ -675,15 +666,12 @@ template outputEPub3() { 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) +/ @@ -692,15 +680,12 @@ template outputEPub3() { 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) +/ @@ -709,15 +694,12 @@ template outputEPub3() { 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) +/ @@ -760,15 +742,12 @@ template outputEPub3() { 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()); } } @@ -781,8 +760,7 @@ template outputEPub3() { 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/src/sdp/output_html.d b/src/sdp/output_html.d index 048d6e9..363ff4a 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -213,7 +213,7 @@ template outputHTML() { 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 +/ @@ -238,7 +238,7 @@ template outputHTML() { 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; @@ -258,10 +258,10 @@ template outputHTML() { 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: @@ -332,7 +332,7 @@ template outputHTML() { 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); @@ -438,7 +438,7 @@ template outputHTML() { 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) { diff --git a/src/sdp/output_rgx.d b/src/sdp/output_rgx.d index 149b41b..be0a91e 100644 --- a/src/sdp/output_rgx.d +++ b/src/sdp/output_rgx.d @@ -8,7 +8,7 @@ template SiSUoutputRgxInit() { static strip_br = ctRegex!("^
\n|
\n*$"); static space = ctRegex!(`[ ]`, "mg"); static spaces_line_start = ctRegex!(`^(?P[ ]+)`, "mg"); - static spaces_multiple = ctRegex!(`(?P[ ]{2,})`, "mg"); // could be issues for endnotes + static spaces_multiple = ctRegex!(`(?P[ ]{2,})`, "mg"); static two_spaces = ctRegex!(`[ ]{2}`, "mg"); static nbsp_char = ctRegex!(`░`, "mg"); static nbsp_chars_line_start = ctRegex!(`^░+`, "mg"); @@ -61,8 +61,8 @@ template SiSUoutputRgxInit() { static inline_italics_line = ctRegex!(`^/_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); static inline_underscore_line = ctRegex!(`^__ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`); /+ 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"); static xhtml_ampersand = ctRegex!(`[&]`); // & static xhtml_quotation = ctRegex!(`[&]`); // " static xhtml_less_than = ctRegex!(`[<]`); // < diff --git a/src/sdp/output_xmls.d b/src/sdp/output_xmls.d index 78ee414..a408872 100644 --- a/src/sdp/output_xmls.d +++ b/src/sdp/output_xmls.d @@ -198,9 +198,11 @@ template outputXHTMLs() { ¶", 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; @@ -279,13 +281,6 @@ template outputXHTMLs() { 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, - // (" $1 ") - // ); - // } return _txt; } auto inline_notes_seg(O)( @@ -415,7 +410,7 @@ template outputXHTMLs() { 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; } @@ -480,7 +475,7 @@ template outputXHTMLs() { 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; } @@ -536,7 +531,7 @@ template outputXHTMLs() { 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; } @@ -592,7 +587,7 @@ template outputXHTMLs() { 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; } @@ -644,7 +639,7 @@ template outputXHTMLs() { 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; } @@ -663,7 +658,7 @@ template outputXHTMLs() { ); return u; } - auto verse(O)( // using code from code block, review + auto verse(O)( auto return ref const O obj, string _txt, ) { @@ -696,7 +691,7 @@ template outputXHTMLs() { 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; } @@ -728,7 +723,7 @@ template outputXHTMLs() { _table ~= ""; 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"; diff --git a/src/sdp/paths_output.d b/src/sdp/paths_output.d index 9c91384..e9599db 100644 --- a/src/sdp/paths_output.d +++ b/src/sdp/paths_output.d @@ -34,7 +34,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); } @@ -57,7 +57,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; @@ -86,7 +86,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/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d index 8718074..e5233ba 100644 --- a/src/sdp/source_sisupod.d +++ b/src/sdp/source_sisupod.d @@ -71,7 +71,7 @@ template 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) { @@ -184,8 +184,7 @@ template 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) { @@ -213,8 +212,7 @@ template SiSUpod() { } } } - catch (ErrnoException ex) - { + catch (ErrnoException ex) { // Handle errors } } -- cgit v1.2.3