diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-06-14 22:52:15 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-04 14:48:15 -0400 |
commit | 0245c394af1a4a1400f87916bd10c398005f40da (patch) | |
tree | 716c1bf10b055740e417d2d9c7283f04d94dc246 /src | |
parent | config rearranged, more put in maker.org (diff) |
step4 some additional work
Diffstat (limited to 'src')
-rwxr-xr-x | src/sdp.d | 144 | ||||
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 219 | ||||
-rw-r--r-- | src/sdp/ao_output_debugs.d | 48 | ||||
-rw-r--r-- | src/sdp/ao_read_source_files.d | 28 | ||||
-rw-r--r-- | src/sdp/ao_rgx.d | 5 | ||||
-rw-r--r-- | src/sdp/output_hub.d | 1484 |
6 files changed, 1759 insertions, 169 deletions
@@ -3,6 +3,17 @@ sdp sdp.d +/ +/+ sdp sisu document parser http://sisudoc.org +/ +import + compile_time_info, // sdp/compile_time_info.d + ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d + ao_defaults, // sdp/ao_defaults.d + ao_read_source_files, // sdp/ao_read_source_files.d + ao_output_debugs, // sdp/ao_output_debugs.d + output_hub, // output_hub.d + ao_rgx, // sdp/ao_rgx.d + ao_ansi_colors; // sdp/ao_ansi_colors.d + // std.conv; /+ sdp sisu document parser +/ private import std.getopt, @@ -12,6 +23,7 @@ private import std.array, std.container, std.exception, + std.file, std.json, // std.path, std.range, @@ -23,16 +35,6 @@ private import std.utf, // std.variant, std.conv : to; -/+ sdp sisu document parser +/ -import - compile_time_info, // sdp/compile_time_info.d - ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d - ao_defaults, // sdp/ao_defaults.d - ao_read_source_files, // sdp/ao_read_source_files.d - ao_output_debugs, // sdp/ao_output_debugs.d - ao_rgx, // sdp/ao_rgx.d - ao_ansi_colors; // sdp/ao_ansi_colors.d - // std.conv; mixin(import("version.txt")); mixin CompileTimeInfo; mixin RgxInit; @@ -44,10 +46,64 @@ void main(string[] args) { mixin SiSUmarkupRaw; mixin SiSUdocAbstraction; mixin SiSUoutputDebugs; + mixin SiSUoutputHub; mixin ScreenTxtColors; + struct SDPoutput { + auto hub(S)( + auto ref const S contents, + string[][string][string] bookindex_unordered_hashes, + JSONValue[] biblio, + JSONValue[string] dochead_make, + JSONValue[string] dochead_meta, + string fn_src, + bool[string] opt_action_bool + ) { + mixin ScreenTxtColors; + mixin RgxInit; + mixin SiSUoutputHub; + // mixin SiSUoutput; + auto rgx = Rgx(); + uint return_ = 0; + if (opt_action_bool["source"]) { + writeln("sisupod source"); + } + if (opt_action_bool["sisupod"]) { + writeln("sisupod source"); + } + if (opt_action_bool["text"]) { + writeln("text processing"); + // auto text=SDPoutput_text(); + // text.scroll(contents, bookindex_unordered_hashes, biblio, fn_src, opt_action_bool); + // // text.scroll(contents, bookindex_unordered_hashes, biblio, dochead_make, dochead_meta, fn_src, opt_action_bool); + } + if (opt_action_bool["html"]) { + auto html=SDPoutputHTML(); + html.css_write; + // html.scroll(contents, bookindex_unordered_hashes, biblio, fn_src, opt_action_bool); + html.scroll(contents, bookindex_unordered_hashes, biblio, dochead_make, dochead_meta, fn_src, opt_action_bool); + } + if (opt_action_bool["epub"]) { + writeln("epub processing"); + } + if (opt_action_bool["pdf"]) { + writeln("pdf processing"); + } + if (opt_action_bool["odt"]) { + writeln("odt processing"); + } + if (opt_action_bool["sqlite"]) { + writeln("sqlite processing"); + } + if (opt_action_bool["postgresql"]) { + writeln("pgsql processing"); + } + return return_; + } + } auto raw = MarkupRaw(); auto abs = Abstraction(); auto dbg = SDPoutputDebugs(); + auto output = SDPoutput(); /+ struct DocumentParts { string[string][] contents; @@ -83,17 +139,52 @@ void main(string[] args) { } bool[string] opt_action_bool = [ - "assertions" : false, - "html" : false, - "no_obj_cite_number" : false, - "verbose" : false, + "assertions" : false, + "concordance" : false, + "digest" : false, + "docbook" : false, + "epub" : false, + "html" : false, + "manifest" : false, + "no_ocn" : false, + "odt" : false, + "pdf" : false, + "postgresql" : false, + "qrcode" : false, + "sisupod" : false, + "source" : false, + "sqlite" : false, + "text" : false, + "verbose" : false, + "xhtml" : false, + "xml_dom" : false, + "xml_sax" : false, ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, - "assert", "--assert set optional assertions on", &opt_action_bool["assertions"], - "html", "--html process html output", &opt_action_bool["html"], - "no-ocn", "--no-ocn suppress object cite number output", &opt_action_bool["no_obj_cite_number"], - "verbose|v", "--verbose output to terminal", &opt_action_bool["verbose"], + "assert", "--assert set optional assertions on", &opt_action_bool["assertions"], + "concordance", "--concordance file for document", &opt_action_bool["concordance"], + "digest", "--digest hash digest for each object", &opt_action_bool["digest"], + "docbook", "--docbook process docbook output", &opt_action_bool["docbook"], + "epub", "--epub process epub output", &opt_action_bool["epub"], + "html", "--html process html output", &opt_action_bool["html"], + "manifest", "--manifest process manifest output", &opt_action_bool["manifest"], + "no-ocn", "--no-ocn suppress object cite numbers", &opt_action_bool["no_ocn"], + "odf", "--odf process odf:odt output", &opt_action_bool["odt"], + "odt", "--odt process odf:odt output", &opt_action_bool["odt"], + "pdf", "--pdf process pdf output", &opt_action_bool["pdf"], + "pg", "--pg process postgresql output", &opt_action_bool["postgresql"], + "postgresql", "--postgresql process postgresql output", &opt_action_bool["postgresql"], + "qrcode", "--qrcode with document metadata", &opt_action_bool["qrcode"], + "sisupod", "--sisupod sisupod source content bundled", &opt_action_bool["sisupod"], + "source", "--source markup source text content", &opt_action_bool["source"], + "sqlite", "--sqlite process sqlite output", &opt_action_bool["sqlite"], + "text", "--text process text output", &opt_action_bool["text"], + "txt", "--txt process text output", &opt_action_bool["text"], + "verbose|v", "--verbose output to terminal", &opt_action_bool["verbose"], + "xhtml", "--xhtml process xhtml output", &opt_action_bool["xhtml"], + "xml-dom", "--xml-dom process xml dom output", &opt_action_bool["xml_dom"], + "xml-sax", "--xml-sax process xml sax output", &opt_action_bool["xml_sax"], ); if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); @@ -138,8 +229,7 @@ void main(string[] args) { auto sourcefile_content = raw.sourceContent(fn_src); /+ ↓ porcess document, return abstraction as tuple +/ - auto t = - abs.abstract_doc_source(sourcefile_content); + auto t = abs.abstract_doc_source(sourcefile_content); static assert(!isTypeTuple!(t)); auto doc_ao_contents = t[0]; // contents ~ endnotes ~ bookindex; // static assert(!isIterable!(doc_ao_contents)); @@ -152,14 +242,24 @@ void main(string[] args) { debug(checkdoc) { // checkbook & dumpdoc dbg.abstract_doc_source_debugs( doc_ao_contents, - doc_ao_make_json, - doc_ao_metadata_json, doc_ao_bookindex_unordered_hashes, doc_ao_biblio, + doc_ao_make_json, + doc_ao_metadata_json, fn_src, opt_action_bool ); } + /+ ↓ output hub +/ + output.hub( + doc_ao_contents, + doc_ao_bookindex_unordered_hashes, + doc_ao_biblio, + doc_ao_make_json, + doc_ao_metadata_json, + fn_src, + opt_action_bool + ); scope(exit) { debug(checkdoc) { writefln( diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index c1566d2..7539755 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -136,7 +136,7 @@ template SiSUdocAbstraction() { } auto type = flags_type_init; auto dochead_make = parseJSON(header_make_jsonstr).object; - auto dochead_metadata = parseJSON(header_metadata_jsonstr).object; + auto dochead_meta = parseJSON(header_metadata_jsonstr).object; mixin ScreenTxtColors; int tell_lo(string color, int obj_cite_number, in char[] line) { writefln( @@ -242,12 +242,12 @@ template SiSUdocAbstraction() { /+ block object: code +/ code_block(line, an_object, type); continue; - } else if (!match(line, rgx.regular_parse_skip)) { + } else if (!matchFirst(line, rgx.regular_parse_skip)) { /+ object other than code block object (includes regular text paragraph) +/ - if (((match(line, rgx.heading_biblio) + if (((matchFirst(line, rgx.heading_biblio) || (type["heading_biblio"] == State.on))) - && (!match(line, rgx.heading)) - && (!match(line, rgx.comment))) { + && (!matchFirst(line, rgx.heading)) + && (!matchFirst(line, rgx.comment))) { /+ within block object: biblio +/ biblio_block(line, type, bib_entry, biblio_arr_json); continue; @@ -273,15 +273,15 @@ template SiSUdocAbstraction() { table_block(line, an_object, type); continue; } else { - /+ not within a block group +/ + /+ not within a block group +/ assert( (type["blocks"] == TriState.off) || (type["blocks"] == TriState.closing), "block status: none or closed" ); assertions_flag_types_block_status_none_or_closed(type); - if (match(line, rgx.block_open)) { - if (match(line, (rgx.block_poem_open))) { + if (matchFirst(line, rgx.block_open)) { + if (matchFirst(line, (rgx.block_poem_open))) { /+ poem to verse exceptions! +/ object_reset(an_object); processing.remove("verse"); @@ -308,19 +308,19 @@ template SiSUdocAbstraction() { tell_l("red", line); } assert( - match(line, rgx.book_index) - || match(line, rgx.book_index_open) + matchFirst(line, rgx.book_index) + || matchFirst(line, rgx.book_index_open) || type["book_index"] == State.on ); } - if ((match(line, rgx.book_index)) - || (match(line, rgx.book_index_open)) + if ((matchFirst(line, rgx.book_index)) + || (matchFirst(line, rgx.book_index_open)) || (type["book_index"] == State.on )) { /+ book_index +/ book_index(line, book_idx_tmp, an_object, type); } else { /+ not book_index +/ - if (auto m = match(line, rgx.comment)) { + if (auto m = matchFirst(line, rgx.comment)) { /+ matched comment +/ debug(comment) { tell_l("blue", line); @@ -333,8 +333,8 @@ template SiSUdocAbstraction() { type["header_make"] = State.off; type["header_metadata"] = State.off; ++counter; - } else if ((match(line, rgx.header_make)) - || (match(line, rgx.header_metadata)) + } else if ((matchFirst(line, rgx.header_make)) + || (matchFirst(line, rgx.header_metadata)) || (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) || (type["header_metadata"] == State.on @@ -360,9 +360,9 @@ template SiSUdocAbstraction() { /+ heading make set +/ heading_make_set(line, line_occur, heading_match_rgx, type); } - if (auto m = match(line, rgx.heading)) { + if (matchFirst(line, rgx.heading)) { /+ heading match +/ - heading_match(line, line_occur, an_object, lv, collapsed_lev, type); + heading_match(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta); } else if (line_occur["para"] == State.off) { /+ para match +/ para_match(line, an_object, indent, bullet, type); @@ -417,9 +417,9 @@ template SiSUdocAbstraction() { && (line_occur["header_make"] > State.off)) { /+ header_make instructions (current line empty) +/ auto dochead_metadata_and_make = - set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_metadata, dochead_make); + set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_meta, dochead_make); static assert(!isTypeTuple!(dochead_metadata_and_make)); - dochead_metadata = dochead_metadata_and_make[0]; + dochead_meta = dochead_metadata_and_make[0]; dochead_make = dochead_metadata_and_make[1]; header_set_common(line_occur, an_object, type); processing.remove("verse"); @@ -427,9 +427,9 @@ template SiSUdocAbstraction() { && (line_occur["header_metadata"] > State.off)) { /+ header_metadata (current line empty) +/ auto dochead_metadata_and_make = - set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_metadata, dochead_make); - static assert(!isTypeTuple!(dochead_metadata_and_make)); - dochead_metadata = dochead_metadata_and_make[0]; + set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_meta, dochead_make); + static assert(!isTypeTuple!(dochead_meta)); + dochead_meta = dochead_metadata_and_make[0]; dochead_make = dochead_metadata_and_make[1]; header_set_common(line_occur, an_object, type); type["header_make"] = State.off; @@ -684,7 +684,7 @@ template SiSUdocAbstraction() { tuple( document_the, dochead_make, - dochead_metadata, + dochead_meta, bookindex_unordered_hashes, biblio_ordered ); @@ -721,15 +721,15 @@ template SiSUdocAbstraction() { auto check_obj_cite_number_status(char[] line, ref int[string] type) { if ((!line.empty) && (type["obj_cite_number_status_multi_obj"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ - if (match(line, rgx.obj_cite_number_block_marks)) { + if (matchFirst(line, rgx.obj_cite_number_block_marks)) { /+ switch off obj_cite_number +/ - if (match(line, rgx.obj_cite_number_off_block)) { + if (matchFirst(line, rgx.obj_cite_number_off_block)) { type["obj_cite_number_status_multi_obj"] = TriState.on; debug(ocnoff) { tell_l("fuchsia", line); } } - if (match(line, rgx.obj_cite_number_off_block_dh)) { + if (matchFirst(line, rgx.obj_cite_number_off_block_dh)) { type["obj_cite_number_status_multi_obj"] = TriState.closing; debug(ocnoff) { tell_l("fuchsia", line); @@ -737,9 +737,9 @@ template SiSUdocAbstraction() { } } else { if (type["obj_cite_number_status_multi_obj"] == TriState.off) { - if (match(line, rgx.obj_cite_number_off)) { + if (matchFirst(line, rgx.obj_cite_number_off)) { type["obj_cite_number_status"] = TriState.on; - } else if (match(line, rgx.obj_cite_number_off_dh)) { + } else if (matchFirst(line, rgx.obj_cite_number_off_dh)) { type["obj_cite_number_status"] = TriState.closing; } else { // type["obj_cite_number_status"] = TriState.closing; @@ -751,7 +751,7 @@ template SiSUdocAbstraction() { } } } else if ((!line.empty) && (type["obj_cite_number_status_multi_obj"] > TriState.off)) { - if (auto m = match(line, rgx.obj_cite_number_off_block_close)) { + if (matchFirst(line, rgx.obj_cite_number_off_block_close)) { type["obj_cite_number_status_multi_obj"] = TriState.off; type["obj_cite_number_status"] = TriState.off; debug(ocnoff) { @@ -766,7 +766,7 @@ template SiSUdocAbstraction() { ref int[string] type, string[string] obj_cite_number_poem ) { - if (match(line, rgx.block_curly_code_open)) { + if (matchFirst(line, rgx.block_curly_code_open)) { /+ curly code open +/ debug(code) { // code (curly) open writefln( @@ -779,7 +779,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["code"] = TriState.on; type["curly_code"] = TriState.on; - } else if (match(line, rgx.block_curly_poem_open)) { + } else if (matchFirst(line, rgx.block_curly_poem_open)) { /+ curly poem open +/ debug(poem) { // poem (curly) open writefln( @@ -795,7 +795,7 @@ template SiSUdocAbstraction() { type["verse_new"] = State.on; type["poem"] = TriState.on; type["curly_poem"] = TriState.on; - } else if (match(line, rgx.block_curly_group_open)) { + } else if (matchFirst(line, rgx.block_curly_group_open)) { /+ curly group open +/ debug(group) { // group (curly) open writefln( @@ -808,7 +808,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["group"] = TriState.on; type["curly_group"] = TriState.on; - } else if (match(line, rgx.block_curly_block_open)) { + } else if (matchFirst(line, rgx.block_curly_block_open)) { /+ curly block open +/ debug(block) { // block (curly) open writefln( @@ -821,7 +821,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["block"] = TriState.on; type["curly_block"] = TriState.on; - } else if (match(line, rgx.block_curly_quote_open)) { + } else if (matchFirst(line, rgx.block_curly_quote_open)) { /+ curly quote open +/ debug(quote) { // quote (curly) open writefln( @@ -834,7 +834,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["quote"] = TriState.on; type["curly_quote"] = TriState.on; - } else if (match(line, rgx.block_curly_table_open)) { + } else if (matchFirst(line, rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open writefln( @@ -847,7 +847,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["table"] = TriState.on; type["curly_table"] = TriState.on; - } else if (match(line, rgx.block_tic_code_open)) { + } else if (matchFirst(line, rgx.block_tic_code_open)) { /+ tic code open +/ debug(code) { // code (tic) open writefln( @@ -860,7 +860,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["code"] = TriState.on; type["tic_code"] = TriState.on; - } else if (match(line, rgx.block_tic_poem_open)) { + } else if (matchFirst(line, rgx.block_tic_poem_open)) { /+ tic poem open +/ debug(poem) { // poem (tic) open writefln( @@ -875,7 +875,7 @@ template SiSUdocAbstraction() { type["verse_new"] = State.on; type["poem"] = TriState.on; type["tic_poem"] = TriState.on; - } else if (match(line, rgx.block_tic_group_open)) { + } else if (matchFirst(line, rgx.block_tic_group_open)) { /+ tic group open +/ debug(group) { // group (tic) open writefln( @@ -888,7 +888,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["group"] = TriState.on; type["tic_group"] = TriState.on; - } else if (match(line, rgx.block_tic_block_open)) { + } else if (matchFirst(line, rgx.block_tic_block_open)) { /+ tic block open +/ debug(block) { // block (tic) open writefln( @@ -901,7 +901,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["block"] = TriState.on; type["tic_block"] = TriState.on; - } else if (match(line, rgx.block_tic_quote_open)) { + } else if (matchFirst(line, rgx.block_tic_quote_open)) { /+ tic quote open +/ debug(quote) { // quote (tic) open writefln( @@ -914,7 +914,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["quote"] = TriState.on; type["tic_quote"] = TriState.on; - } else if (match(line, rgx.block_tic_table_open)) { + } else if (matchFirst(line, rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open writefln( @@ -936,7 +936,7 @@ template SiSUdocAbstraction() { ref int[string] type ) { if (type["curly_code"] == TriState.on) { - if (auto m = match(line, rgx.block_curly_code_close)) { + if (matchFirst(line, rgx.block_curly_code_close)) { debug(code) { // code (curly) close tell_l("blue", line); } @@ -947,10 +947,10 @@ template SiSUdocAbstraction() { debug(code) { // code (curly) line tell_l("blue", line); } - an_object["obj"] ~= line ~= "\n"; // code (curly) line + an_object["obj"] ~= line ~= "\n"; // code (curly) line } } else if (type["tic_code"] == TriState.on) { - if (auto m = match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(code) { // code (tic) close tell_l("blue", line); } @@ -961,7 +961,7 @@ template SiSUdocAbstraction() { debug(code) { // code (tic) line tell_l("blue", line); } - an_object["obj"] ~= line ~= "\n"; // code (tic) line + an_object["obj"] ~= line ~= "\n"; // code (tic) line } } return 0; @@ -991,7 +991,7 @@ template SiSUdocAbstraction() { ref int bib_entry, ref string[] biblio_arr_json ) { - if (match(line, rgx.heading_biblio)) { + if (matchFirst(line, rgx.heading_biblio)) { type["heading_biblio"] = TriState.on; } if (empty(line) && (bib_entry == TriState.off)) { @@ -1006,7 +1006,7 @@ template SiSUdocAbstraction() { line ); } - if (match(line, rgx.biblio_tags)) { + if (matchFirst(line, rgx.biblio_tags)) { auto bt = match(line, rgx.biblio_tags); bib_entry = 0; st=to!string(bt.captures[1]); @@ -1081,7 +1081,7 @@ template SiSUdocAbstraction() { string[string] obj_cite_number_poem ) { if (type["curly_poem"] == TriState.on) { - if (auto m = match(line, rgx.block_curly_poem_close)) { + if (matchFirst(line, rgx.block_curly_poem_close)) { an_object["obj"]="verse"; // check that this is as you please debug(poem) { // poem (curly) close writefln( @@ -1140,7 +1140,7 @@ template SiSUdocAbstraction() { obj_cite_number = obj_cite_number_emit(type["obj_cite_number_status"]); type["verse_new"] = State.off; - } else if (match(line, rgx.line_delimiter_only)) { + } else if (matchFirst(line, rgx.line_delimiter_only)) { verse_line = TriState.off; type["verse_new"] = State.on; } @@ -1181,7 +1181,7 @@ template SiSUdocAbstraction() { } } } else if (type["tic_poem"] == TriState.on) { - if (auto m = match(line, rgx.block_tic_close)) { // tic_poem_close + if (auto m = matchFirst(line, rgx.block_tic_close)) { // tic_poem_close an_object["obj"]="verse"; // check that this is as you please debug(poem) { // poem (curly) close writefln( @@ -1226,7 +1226,7 @@ template SiSUdocAbstraction() { obj_cite_number = obj_cite_number_emit(type["obj_cite_number_status"]); type["verse_new"] = State.off; - } else if (match(line, rgx.line_delimiter_only)) { + } else if (matchFirst(line, rgx.line_delimiter_only)) { type["verse_new"] = State.on; verse_line = TriState.off; } @@ -1276,7 +1276,7 @@ template SiSUdocAbstraction() { ref int[string] type ) { if (type["curly_group"] == State.on) { - if (match(line, rgx.block_curly_group_close)) { + if (matchFirst(line, rgx.block_curly_group_close)) { debug(group) { // group (curly) close tell_l("blue", line); } @@ -1290,7 +1290,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build group array (or string) } } else if (type["tic_group"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(group) { // group (tic) close tell_l("blue", line); } @@ -1312,7 +1312,7 @@ template SiSUdocAbstraction() { ref int[string] type ) { if (type["curly_block"] == TriState.on) { - if (match(line, rgx.block_curly_block_close)) { + if (matchFirst(line, rgx.block_curly_block_close)) { debug(block) { // block (curly) close tell_l("blue", line); } @@ -1326,7 +1326,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build block array (or string) } } else if (type["tic_block"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(block) { // block (tic) close tell_l("blue", line); } @@ -1344,7 +1344,7 @@ template SiSUdocAbstraction() { } auto quote_block(char[] line, ref string[string] an_object, ref int[string] type) { if (type["curly_quote"] == TriState.on) { - if (match(line, rgx.block_curly_quote_close)) { + if (matchFirst(line, rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close tell_l("blue", line); } @@ -1358,7 +1358,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build quote array (or string) } } else if (type["tic_quote"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(quote) { // quote (tic) close tell_l("blue", line); } @@ -1376,7 +1376,7 @@ template SiSUdocAbstraction() { } auto table_block(char[] line, ref string[string] an_object, ref int[string] type) { if (type["curly_table"] == TriState.on) { - if (match(line, rgx.block_curly_table_close)) { + if (matchFirst(line, rgx.block_curly_table_close)) { debug(table) { // table (curly) close tell_l("blue", line); } @@ -1390,7 +1390,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build table array (or string) } } else if (type["tic_table"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(table) { // table (tic) close tell_l("blue", line); } @@ -1674,7 +1674,7 @@ template SiSUdocAbstraction() { ref string[string] an_object, ref int[string] type ) { - if (auto m = match(line, rgx.header_make)) { + if (matchFirst(line, rgx.header_make)) { /+ matched header_make +/ debug(header1) { // header tell_l("yellow", line); @@ -1686,7 +1686,7 @@ template SiSUdocAbstraction() { type["para"] = State.off; ++line_occur["header_make"]; an_object["obj"] ~= line ~= "\n"; - } else if (auto m = match(line, rgx.header_metadata)) { + } else if (matchFirst(line, rgx.header_metadata)) { /+ matched header_metadata +/ debug(header1) { // header tell_l("yellow", line); @@ -1701,7 +1701,7 @@ template SiSUdocAbstraction() { } else if (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) { /+ header_make flag set +/ - if (auto m = match(line, rgx.header_sub)) { + if (matchFirst(line, rgx.header_sub)) { /+ sub-header +/ debug(header1) { tell_l("yellow", line); @@ -1713,7 +1713,7 @@ template SiSUdocAbstraction() { } else if (type["header_metadata"] == State.on && (line_occur["header_metadata"] > State.off)) { /+ header_metadata flag set +/ - if (auto m = match(line, rgx.header_sub)) { + if (matchFirst(line, rgx.header_sub)) { /+ sub-header +/ debug(header1) { tell_l("yellow", line); @@ -1824,43 +1824,43 @@ template SiSUdocAbstraction() { && ((type["para"] == State.off) && (type["heading"] == State.off))) { /+ heading make set +/ - if (match(line, heading_match_rgx["h_B"])) { + if (matchFirst(line, heading_match_rgx["h_B"])) { line = "B~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_C"])) { + if (matchFirst(line, heading_match_rgx["h_C"])) { line = "C~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_D"])) { + if (matchFirst(line, heading_match_rgx["h_D"])) { line = "D~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_1"])) { + if (matchFirst(line, heading_match_rgx["h_1"])) { line = "1~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_2"])) { + if (matchFirst(line, heading_match_rgx["h_2"])) { line = "2~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_3"])) { + if (matchFirst(line, heading_match_rgx["h_3"])) { line = "3~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_4"])) { + if (matchFirst(line, heading_match_rgx["h_4"])) { line = "4~ " ~ line; debug(headingsfound) { writeln(line); @@ -1874,7 +1874,8 @@ template SiSUdocAbstraction() { ref string[string] an_object, ref int[string] lv, ref int[string] collapsed_lev, - ref int[string] type + ref int[string] type, + ref JSONValue[string] dochead_meta ) { if (auto m = match(line, rgx.heading)) { /+ heading match +/ @@ -1890,6 +1891,8 @@ template SiSUdocAbstraction() { assertions_doc_structure(an_object, lv); // includes most of the logic for collapsed levels switch (an_object["lev"]) { case "A": + an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_title, to!string(dochead_meta["title"]["main"])); + an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_author, to!string(dochead_meta["creator"]["author"])); collapsed_lev["h0"] = 1; an_object["lev_collapsed_number"] = to!string(collapsed_lev["h0"]); @@ -2017,7 +2020,7 @@ template SiSUdocAbstraction() { /+ para matches +/ // paragraphs // (fl ag_type["heading"] = true) && - if (auto m = match(line, rgx.para_indent)) { + if (auto m = matchFirst(line, rgx.para_indent)) { debug(paraindent) { // para indent tell_l("blue", line); } @@ -2026,7 +2029,7 @@ template SiSUdocAbstraction() { indent["first"] = to!string(m.captures[1]); indent["second"] = "0"; bullet = false; - } else if (auto m = match(line, rgx.para_bullet)) { + } else if (matchFirst(line, rgx.para_bullet)) { debug(parabullet) { // para bullet tell_l("blue", line); } @@ -2035,7 +2038,7 @@ template SiSUdocAbstraction() { indent["first"] = "0"; indent["second"] = "0"; bullet = true; - } else if (auto m = match(line, rgx.para_indent_hang)) { + } else if (auto m = matchFirst(line, rgx.para_indent_hang)) { debug(paraindenthang) { // para indent hang tell_l("blue", line); } @@ -2044,7 +2047,7 @@ template SiSUdocAbstraction() { indent["first"] = to!string(m.captures[1]); indent["second"] = to!string(m.captures[2]); bullet = false; - } else if (auto m = match(line, rgx.para_bullet_indent)) { + } else if (auto m = matchFirst(line, rgx.para_bullet_indent)) { debug(parabulletindent) { // para bullet indent tell_l("blue", line); } @@ -2092,19 +2095,19 @@ template SiSUdocAbstraction() { body { auto rgx = Rgx(); obj_txt["munge"]=obj_txt_in; - if (match(obj_txt_in, rgx.para_bullet)) { + if (matchFirst(obj_txt_in, rgx.para_bullet)) { obj_txt["attrib"] =" \"bullet\": \"true\"," ~ " \"indent_first\": 0," ~ " \"indent_rest\": 0,"; - } else if (auto m = match(obj_txt_in, rgx.para_bullet_indent)) { + } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) { obj_txt["attrib"] =" \"bullet\": \"true\"," ~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ "," ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; - } else if (auto m = match(obj_txt_in, rgx.para_indent_hang)) { + } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) { obj_txt["attrib"] =" \"bullet\": \"false\"," ~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ "," ~ " \"indent_rest\": " ~ to!string(m.captures[2]) ~ ","; - } else if (auto m = match(obj_txt_in, rgx.para_indent)) { + } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) { obj_txt["attrib"] =" \"bullet\": \"false\"," ~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ "," ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; @@ -2578,14 +2581,14 @@ template SiSUdocAbstraction() { string hm, hs; auto header_metadata_and_make_jsonstr( string header, - JSONValue[string] dochead_metadata, + JSONValue[string] dochead_meta, JSONValue[string] dochead_make ) in { } body { scope(exit) { destroy(header); - destroy(dochead_metadata); + destroy(dochead_meta); destroy(dochead_make); } if (auto t = match(header, rgx.head_main)) { @@ -2599,13 +2602,13 @@ template SiSUdocAbstraction() { if (auto m = match(line, rgx.head_main)) { if (!empty(m.captures[2])) { if (hm == "creator") { - dochead_metadata[hm]["author"].str = + dochead_meta[hm]["author"].str = to!string(m.captures[2]); } else if (hm == "title") { - dochead_metadata[hm]["main"].str = + dochead_meta[hm]["main"].str = to!string(m.captures[2]); } else if (hm == "publisher") { - dochead_metadata[hm]["name"].str = + dochead_meta[hm]["name"].str = to!string(m.captures[2]); } } @@ -2629,12 +2632,12 @@ template SiSUdocAbstraction() { default: break; } - } else if (dochead_metadata[hm].type() == JSON_TYPE.OBJECT) { + } else if (dochead_meta[hm].type() == JSON_TYPE.OBJECT) { switch (hm) { case "creator": if (match(hs, rgx.subhead_creator)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2646,11 +2649,11 @@ template SiSUdocAbstraction() { case "title": if (match(hs, rgx.subhead_title)) { if ((hs == "subtitle") - && (dochead_metadata[hm]["sub"].type() == JSON_TYPE.STRING)) { - dochead_metadata[hm]["sub"].str = + && (dochead_meta[hm]["sub"].type() == JSON_TYPE.STRING)) { + dochead_meta[hm]["sub"].str = to!string(s.captures[2]); - } else if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + } else if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2661,8 +2664,8 @@ template SiSUdocAbstraction() { break; case "rights": if (match(hs, rgx.subhead_rights)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2673,8 +2676,8 @@ template SiSUdocAbstraction() { break; case "date": if (match(hs, rgx.subhead_date)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2685,8 +2688,8 @@ template SiSUdocAbstraction() { break; case "original": if (match(hs, rgx.subhead_original)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2697,8 +2700,8 @@ template SiSUdocAbstraction() { break; case "classify": if (match(hs, rgx.subhead_classify)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2709,8 +2712,8 @@ template SiSUdocAbstraction() { break; case "identifier": if (match(hs, rgx.subhead_identifier)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2721,8 +2724,8 @@ template SiSUdocAbstraction() { break; case "notes": if (match(hs, rgx.subhead_notes)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2733,8 +2736,8 @@ template SiSUdocAbstraction() { break; case "publisher": if (match(hs, rgx.subhead_publisher)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2747,8 +2750,8 @@ template SiSUdocAbstraction() { destroy(hm); destroy(hs); // if (match(hs, rgx.subhead_links)) { - // if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - // dochead_metadata[hm][hs].str = to!string(s.captures[2]); + // if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + // dochead_meta[hm][hs].str = to!string(s.captures[2]); // } // } else { // writeln("not a valid header type:", hm, ":", hs); @@ -2767,7 +2770,7 @@ template SiSUdocAbstraction() { writeln("not a valid header type:", hm); } } - auto t = tuple(dochead_metadata, dochead_make); + auto t = tuple(dochead_meta, dochead_make); static assert(!isTypeTuple!(t)); return t; } diff --git a/src/sdp/ao_output_debugs.d b/src/sdp/ao_output_debugs.d index 8c655e8..3c97640 100644 --- a/src/sdp/ao_output_debugs.d +++ b/src/sdp/ao_output_debugs.d @@ -6,10 +6,10 @@ template SiSUoutputDebugs() { struct SDPoutputDebugs { auto abstract_doc_source_debugs(S)( auto ref const S contents, - JSONValue[string] docmake, - JSONValue[string] dochead, string[][string][string] bookindex_unordered_hashes, JSONValue[] biblio, + JSONValue[string] dochead_make, + JSONValue[string] dochead_meta, string fn_src, bool[string] opt_action_bool ) { @@ -80,19 +80,19 @@ template SiSUoutputDebugs() { writefln( "%s\n%s\n%s", "document header, metadata & make instructions:", - dochead, + dochead_meta, pointer_head_main, ); foreach (main_header; pointer_head_main) { switch (main_header) { case "make": foreach (sub_header; pointer_head_sub_make) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } @@ -106,115 +106,115 @@ template SiSUoutputDebugs() { writefln( "%s\n%s\n%s", "document header, metadata & make instructions:", - dochead, + dochead_meta, pointer_head_main, ); foreach (main_header; pointer_head_main) { switch (main_header) { case "creator": foreach (sub_header; pointer_head_sub_creator) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "title": foreach (sub_header; pointer_head_sub_title) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "rights": foreach (sub_header; pointer_head_sub_rights) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "date": foreach (sub_header; pointer_head_sub_date) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "original": foreach (sub_header; pointer_head_sub_original) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "classify": foreach (sub_header; pointer_head_sub_classify) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "identifier": foreach (sub_header; pointer_head_sub_identifier) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "notes": foreach (sub_header; pointer_head_sub_notes) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } break; case "publisher": foreach (sub_header; pointer_head_sub_publisher) { - if (to!string(dochead[main_header][sub_header]).length > 2) { + if (to!string(dochead_meta[main_header][sub_header]).length > 2) { writefln( "%s:%s: %s", main_header, sub_header, - dochead[main_header][sub_header] + dochead_meta[main_header][sub_header] ); } } diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d index a5ca084..9bfaa05 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao_read_source_files.d @@ -103,11 +103,11 @@ template SiSUmarkupRaw() { if (type1["curly_code"] == 1) { type1["header_make"] = 0; type1["header_metadata"] = 0; - if (auto m = match(line, rgx.block_curly_code_close)) { + if (matchFirst(line, rgx.block_curly_code_close)) { type1["curly_code"] = 0; } contents_insert ~= line; - } else if (auto m = match(line, rgx.block_curly_code_open)) { + } else if (matchFirst(line, rgx.block_curly_code_open)) { type1["curly_code"] = 1; type1["header_make"] = 0; type1["header_metadata"] = 0; @@ -115,25 +115,25 @@ template SiSUmarkupRaw() { } else if (type1["tic_code"] == 1) { type1["header_make"] = 0; type1["header_metadata"] = 0; - if (auto m = match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { type1["tic_code"] = 0; } contents_insert ~= line; - } else if (auto m = match(line, rgx.block_tic_code_open)) { + } else if (matchFirst(line, rgx.block_tic_code_open)) { type1["tic_code"] = 1; type1["header_make"] = 0; type1["header_metadata"] = 0; contents_insert ~= line; } else if ( (type1["header_make"] == 1) - && match(line, rgx.header_sub) + && matchFirst(line, rgx.header_sub) ) { type1["header_make"] = 1; type1["header_metadata"] = 0; // cont_dynamic_array ~= "% " ~ line; } else if ( (type1["header_metadata"] == 1) - && match(line, rgx.header_sub) + && matchFirst(line, rgx.header_sub) ) { type1["header_metadata"] = 1; type1["header_make"] = 0; @@ -193,11 +193,11 @@ template SiSUmarkupRaw() { if (type["curly_code"] == 1) { type["header_make"] = 0; type["header_metadata"] = 0; - if (auto m = match(line, rgx.block_curly_code_close)) { + if (matchFirst(line, rgx.block_curly_code_close)) { type["curly_code"] = 0; } contents ~= line; - } else if (auto m = match(line, rgx.block_curly_code_open)) { + } else if (matchFirst(line, rgx.block_curly_code_open)) { type["curly_code"] = 1; type["header_make"] = 0; type["header_metadata"] = 0; @@ -205,30 +205,30 @@ template SiSUmarkupRaw() { } else if (type["tic_code"] == 1) { type["header_make"] = 0; type["header_metadata"] = 0; - if (auto m = match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { type["tic_code"] = 0; } contents ~= line; - } else if (auto m = match(line, rgx.block_tic_code_open)) { + } else if (matchFirst(line, rgx.block_tic_code_open)) { type["tic_code"] = 1; type["header_make"] = 0; type["header_metadata"] = 0; contents ~= line; } else if ( (type["header_make"] == 1) - && match(line, rgx.header_sub) + && matchFirst(line, rgx.header_sub) ) { contents ~= line; } else if ( (type["header_metadata"] == 1) - && match(line, rgx.header_sub) + && matchFirst(line, rgx.header_sub) ) { contents ~= line; - } else if (auto m = match(line, rgx.header_make)) { + } else if (matchFirst(line, rgx.header_make)) { type["header_make"] = 1; type["header_metadata"] = 0; contents ~= line; - } else if (auto m = match(line, rgx.header_metadata)) { + } else if (matchFirst(line, rgx.header_metadata)) { type["header_make"] = 0; type["header_metadata"] = 1; contents ~= line; diff --git a/src/sdp/ao_rgx.d b/src/sdp/ao_rgx.d index e675ca1..073148e 100644 --- a/src/sdp/ao_rgx.d +++ b/src/sdp/ao_rgx.d @@ -8,7 +8,8 @@ template RgxInit() { static flag_action = ctRegex!(`^(--[a-z][a-z0-9-]+)$`); static flag_action_str = ctRegex!(` (--[a-z][a-z0-9-]+)`); static src_pth = ctRegex!(`^([a-zA-Z0-9._-]+/)*([a-zA-Z0-9._-]+[.]ss[tm])$`); - static src_fn = ctRegex!(`^([a-zA-Z0-9._-]+/)*([a-zA-Z0-9._-]+[.]ss[tm])$`); + static src_fn = + ctRegex!(`^([a-zA-Z0-9._-]+/)*(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); static src_fn_master = ctRegex!(`^([a-zA-Z0-9._-]+/)*([a-zA-Z0-9._-]+[.]ssm)$`); static src_fn_find_inserts = ctRegex!(`^([a-zA-Z0-9._-]+/)*([a-zA-Z0-9._-]+[.]ss[im])$`); // static ssm_fn = ctRegex!(`^[a-zA-Z0-9._-]+[.]ssm$`); @@ -41,6 +42,8 @@ template RgxInit() { static header_sub = ctRegex!(`^[ ]+:([a-z_]+):\s`); static head_main = ctRegex!(`^@([a-z_]+):\s*(.*)`, "m"); static head_sub = ctRegex!(`^[ ]*:([a-z_]+):\s+(.+)`, "m"); + static head_value_title = ctRegex!(`@title`); + static head_value_author = ctRegex!(`@author`); /+ heading & paragraph operators +/ static heading = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?) `); static heading_marker = ctRegex!(`^:?([A-D1-4])[~]`); diff --git a/src/sdp/output_hub.d b/src/sdp/output_hub.d new file mode 100644 index 0000000..5912e7e --- /dev/null +++ b/src/sdp/output_hub.d @@ -0,0 +1,1484 @@ +/+ + output hub + output_hub.d ++/ +template SiSUoutputHub() { + struct SDPoutputHTML { + auto html_css() { + string css; + css="/* SiSU css default stylesheet */ + body { + color: black; + background: #ffffff; + background-color: #ffffff; + } + a:link { + color: #003399; + text-decoration: none; + } + a:visited { + color: #003399; + text-decoration: none; + } + a:hover { + color: #000000; + background-color: #f9f9aa; + } + a.lnkocn:link { + color: #777777; + text-decoration: none; + } + a:hover img { + background-color: #ffffff; + } + a:active { + color: #003399; + text-decoration: underline; + } + div { + margin-left: 0; + margin-right: 0; + } + div.p { + margin-left: 5%; + margin-right: 1%; + } + + #top_band { + position: absolute; + top: 0; + bottom: 80px; + width: 100%; + } + #top_band_search { + position: absolute; + top: 0px; + right: 0px; + margin-left: 75%; + width: 20%; + } + #column_left { + position: absolute; + top: 80px; + left: 0; + margin-left: 1%; + width: 20%; + } + #column_center { + position: absolute; + top: 80px; + margin-left: 20%; + width: 55%; + } + #column_right { + position: absolute; + top: 80px; + right: 0px; + margin-left: 75%; + width: 25%; + } + #pane_major { + position: absolute; + top: 0px; + left: 0; + margin-left: 0; + width: 80%; + } + #pane_minor { + position: absolute; + top: 0px; + right: 0px; + margin-left: 75%; + width: 20%; + background-color: #aaaaaa; + } + .norm, .bold, .verse, .group, .block, .alt { + line-height: 133%; + margin-left: 0em; + margin-right: 2em; + margin-top: 12px; + margin-bottom: 0px; + padding-left: 0em; + text-indent: 0em; + } + p, h0, h1, h2, h3, h4, h5, h6, h7 { + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + font-size: 100%; + font-weight: normal; + line-height: 133%; + text-align: justify; + margin-left: 0em; + margin-right: 2em; + text-indent: 0mm; + margin-top: 0.8em; + margin-bottom: 0.8em; + } + /* indent */ + p.norm { } + p.i1 {padding-left: 1em;} + p.i2 {padding-left: 2em;} + p.i3 {padding-left: 3em;} + p.i4 {padding-left: 4em;} + p.i5 {padding-left: 5em;} + p.i6 {padding-left: 6em;} + p.i7 {padding-left: 7em;} + p.i8 {padding-left: 8em;} + p.i9 {padding-left: 9em;} + /* hanging indent */ + p.h0i0 { + padding-left: 0em; + text-indent: 0em; + } + p.h0i1 { + padding-left: 1em; + text-indent: -1em; + } + p.h0i2 { + padding-left: 2em; + text-indent: -2em; + } + p.h0i3 { + padding-left: 3em; + text-indent: -3em; + } + p.h0i4 { + padding-left: 4em; + text-indent: -4em; + } + p.h0i5 { + padding-left: 5em; + text-indent: -5em; + } + p.h0i6 { + padding-left: 6em; + text-indent: -6em; + } + p.h0i7 { + padding-left: 7em; + text-indent: -7em; + } + p.h0i8 { + padding-left: 8em; + text-indent: -8em; + } + p.h0i9 { + padding-left: 9em; + text-indent: -9em; + } + p.h1i0 { + padding-left: 0em; + text-indent: 1em; + } + p.h1i1 { + padding-left: 1em; + text-indent: 0em; + } + p.h1i2 { + padding-left: 2em; + text-indent: -1em; + } + p.h1i3 { + padding-left: 3em; + text-indent: -2em; + } + p.h1i4 { + padding-left: 4em; + text-indent: -3em; + } + p.h1i5 { + padding-left: 5em; + text-indent: -4em; + } + p.h1i6 { + padding-left: 6em; + text-indent: -5em; + } + p.h1i7 { + padding-left: 7em; + text-indent: -6em; + } + p.h1i8 { + padding-left: 8em; + text-indent: -7em; + } + p.h1i9 { + padding-left: 9em; + text-indent: -8em; + } + p.h2i0 { + padding-left: 0em; + text-indent: 2em; + } + p.h2i1 { + padding-left: 1em; + text-indent: 1em; + } + p.h2i2 { + padding-left: 2em; + text-indent: 0em; + } + p.h2i3 { + padding-left: 3em; + text-indent: -1em; + } + p.h2i4 { + padding-left: 4em; + text-indent: -2em; + } + p.h2i5 { + padding-left: 5em; + text-indent: -3em; + } + p.h2i6 { + padding-left: 6em; + text-indent: -4em; + } + p.h2i7 { + padding-left: 7em; + text-indent: -5em; + } + p.h2i8 { + padding-left: 8em; + text-indent: -6em; + } + p.h2i9 { + padding-left: 9em; + text-indent: -7em; + } + p.h3i0 { + padding-left: 0em; + text-indent: 3em; + } + p.h3i1 { + padding-left: 1em; + text-indent: 2em; + } + p.h3i2 { + padding-left: 2em; + text-indent: 1em; + } + p.h3i3 { + padding-left: 3em; + text-indent: 0em; + } + p.h3i4 { + padding-left: 4em; + text-indent: -1em; + } + p.h3i5 { + padding-left: 5em; + text-indent: -2em; + } + p.h3i6 { + padding-left: 6em; + text-indent: -3em; + } + p.h3i7 { + padding-left: 7em; + text-indent: -4em; + } + p.h3i8 { + padding-left: 8em; + text-indent: -5em; + } + p.h3i9 { + padding-left: 9em; + text-indent: -6em; + } + p.h4i0 { + padding-left: 0em; + text-indent: 4em; + } + p.h4i1 { + padding-left: 1em; + text-indent: 3em; + } + p.h4i2 { + padding-left: 2em; + text-indent: 2em; + } + p.h4i3 { + padding-left: 3em; + text-indent: 1em; + } + p.h4i4 { + padding-left: 4em; + text-indent: 0em; + } + p.h4i5 { + padding-left: 5em; + text-indent: -1em; + } + p.h4i6 { + padding-left: 6em; + text-indent: -2em; + } + p.h4i7 { + padding-left: 7em; + text-indent: -3em; + } + p.h4i8 { + padding-left: 8em; + text-indent: -4em; + } + p.h4i9 { + padding-left: 9em; + text-indent: -5em; + } + p.h5i0 { + padding-left: 0em; + text-indent: 5em; + } + p.h5i1 { + padding-left: 1em; + text-indent: 4em; + } + p.h5i2 { + padding-left: 2em; + text-indent: 3em; + } + p.h5i3 { + padding-left: 3em; + text-indent: 2em; + } + p.h5i4 { + padding-left: 4em; + text-indent: 1em; + } + p.h5i5 { + padding-left: 5em; + text-indent: 0em; + } + p.h5i6 { + padding-left: 6em; + text-indent: -1em; + } + p.h5i7 { + padding-left: 7em; + text-indent: -2em; + } + p.h5i8 { + padding-left: 8em; + text-indent: -3em; + } + p.h5i9 { + padding-left: 9em; + text-indent: -4em; + } + p.h6i0 { + padding-left: 0em; + text-indent: 6em; + } + p.h6i1 { + padding-left: 1em; + text-indent: 5em; + } + p.h6i2 { + padding-left: 2em; + text-indent: 4em; + } + p.h6i3 { + padding-left: 3em; + text-indent: 3em; + } + p.h6i4 { + padding-left: 4em; + text-indent: 2em; + } + p.h6i5 { + padding-left: 5em; + text-indent: 1em; + } + p.h6i6 { + padding-left: 6em; + text-indent: 0em; + } + p.h6i7 { + padding-left: 7em; + text-indent: -1em; + } + p.h6i8 { + padding-left: 8em; + text-indent: -2em; + } + p.h6i9 { + padding-left: 9em; + text-indent: -3em; + } + p.h7i0 { + padding-left: 0em; + text-indent: 7em; + } + p.h7i1 { + padding-left: 1em; + text-indent: 6em; + } + p.h7i2 { + padding-left: 2em; + text-indent: 5em; + } + p.h7i3 { + padding-left: 3em; + text-indent: 4em; + } + p.h7i4 { + padding-left: 4em; + text-indent: 3em; + } + p.h7i5 { + padding-left: 5em; + text-indent: 2em; + } + p.h7i6 { + padding-left: 6em; + text-indent: 1em; + } + p.h7i7 { + padding-left: 7em; + text-indent: 0em; + } + p.h7i8 { + padding-left: 8em; + text-indent: -1em; + } + p.h7i9 { + padding-left: 9em; + text-indent: -2em; + } + p.h8i0 { + padding-left: 0em; + text-indent: 8em; + } + p.h8i1 { + padding-left: 1em; + text-indent: 7em; + } + p.h8i2 { + padding-left: 2em; + text-indent: 6em; + } + p.h8i3 { + padding-left: 3em; + text-indent: 5em; + } + p.h8i4 { + padding-left: 4em; + text-indent: 4em; + } + p.h8i5 { + padding-left: 5em; + text-indent: 3em; + } + p.h8i6 { + padding-left: 6em; + text-indent: 2em; + } + p.h8i7 { + padding-left: 7em; + text-indent: 1em; + } + p.h8i8 { + padding-left: 8em; + text-indent: 0em; + } + p.h8i9 { + padding-left: 9em; + text-indent: -1em; + } + p.h9i0 { + padding-left: 0em; + text-indent: 9em; + } + p.h9i1 { + padding-left: 1em; + text-indent: 8em; + } + p.h9i2 { + padding-left: 2em; + text-indent: 7em; + } + p.h9i3 { + padding-left: 3em; + text-indent: 6em; + } + p.h9i4 { + padding-left: 4em; + text-indent: 5em; + } + p.h9i5 { + padding-left: 5em; + text-indent: 4em; + } + p.h9i6 { + padding-left: 6em; + text-indent: 3em; + } + p.h9i7 { + padding-left: 7em; + text-indent: 2em; + } + p.h9i8 { + padding-left: 8em; + text-indent: 1em; + } + p.h9i9 { + padding-left: 9em; + text-indent: 0em; + } + p.it0 { + margin-left: 0em; + margin-top: 6px; + margin-bottom: 0px; + line-height: 100%; + } + p.it1 { + margin-left: 1em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it2 { + margin-left: 2em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it3 { + margin-left: 3em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it4 { + margin-left: 4em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it5 { + margin-left: 5em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it6 { + margin-left: 6em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it7 { + margin-left: 7em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it8 { + margin-left: 8em; + margin-top: 0px; + margin-bottom: 0px; + line-height: 100%; + } + p.it9 { + margin-left: 9em; + margin-bottom: 0px; + margin-top: 0px; + line-height: 100%; + } + p.block { } + p.group { } + p.alt { } + p.verse { + margin-bottom: 6px; + } + p.code { + font-family: inconsolata, andale mono, courier new, courier, monospace; + font-size: 90%; + text-align: left; + background-color: #eeeeee; + } + p.caption { + text-align: left; + font-size: 80%; + display: inline; + } + p.endnote { + font-size: 96%; + line-height: 120%; + text-align: left; + margin-right: 15mm; + } + p.endnote_indent { + font-size: 96%; + line-height: 120%; + text-align: left; + margin-left: 2em; + margin-right: 15mm; + } + p.center { + text-align: center; + } + p.bold { + font-weight: bold; + } + p.bold_left { + font-weight: bold; + text-align: left; + } + p.centerbold { + text-align: center; + font-weight: bold; + } + p.em { + font-weight: bold; + font-style: normal; + background: #fff3b6; + } + p.small { + font-size: 80%; + margin-top: 0px; + margin-bottom: 0px; + margin-right: 6px; + text-align: left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size: 10px; + margin-top: 0px; + margin-bottom: 0px; + color: #777777; + margin-right: 6px; + text-align: left; + } + p.tiny { } + p.tiny_left { + margin-left: 0px; + margin-right: 0px; + text-align: left; + } + p.tiny_right { + margin-right: 1em; + text-align: right; + } + p.tiny_center { + margin-left: 0px; + margin-right: 0px; + text-align: center; + } + p.pane, p.pane_title, p.pane_blurb, p.pane_link, p.pane_indent { + font-size: 80%; + margin-top: 0px; + margin-bottom: 0px; + margin-left: 2mm; + margin-right: 4px; + text-align: left; + } + p.pane { } + p.pane_title { + font-weight: bold; + margin-bottom: 0px; + } + p.pane_blurb { + font-size: 10px; + margin-bottom: 0px; + } + p.pane_link { + font-size: 10px; + margin-bottom: 0px; + margin-left: 4mm; + } + p.pane_indent { + font-size: 10px; + margin-bottom: 0px; + margin-left: 4mm; + } + p.concordance_word { + line-height: 150%; + font-weight: bold; + display: inline; + margin-top: 4px; + margin-bottom: 1px; + } + p.concordance_count { + font-size: 80%; + color: #777777; + display: inline; + margin-left: 0em; + } + p.concordance_object { + font-size: 80%; + line-height: 120%; + text-align: left; + margin-left: 3em; + margin-top: 1px; + margin-bottom: 3px; + } + p.book_index_lev1 { + line-height: 100%; + margin-top: 4px; + margin-bottom: 1px; + } + p.book_index_lev2 { + line-height: 100%; + text-align: left; + margin-left: 3em; + margin-top: 1px; + margin-bottom: 3px; + } + p.quickref { + font-size: 10px; + font-style: italic; + margin-top: 0px; + margin-bottom: 0px; + color: #777777; + margin-right: 5px; + text-align: left; + } + p.bigref { + font-size: 11px; + font-weight: bold; + margin-top: 0px; + margin-bottom: 0px; + color: #777777; + margin-right: 5px; + text-align: center; + } + p.letter { + font-weight: bold; + font-size: 80%; + margin-left: 0em; + margin-top: 2px; + margin-bottom: 2px; + margin-right: 6px; + text-align: left; + color: white; + background: #880000; + } + tt { + font-family: inconsolata, andale mono, courier new, courier, monospace; + background-color: #eeeeee; + } + label.ocn { + width: 2%; + float: right; + top: 0; + font-size: 10px; + margin-top: 0px; + margin-bottom: 5px; + color: #777777; + margin-right: 5px; + text-align: right; + background-color: #ffffff; + } + table { } + tr { } + th,td { + vertical-align: top; + text-align: left; + } + th { + font-weight: bold; + } + p.left,th.left,td.left { + text-align: left; + } + p.small_left,th.small_left,td.small_left { + text-align: left; + font-size: 80%; + } + p.right,th.right,td.right { + text-align: right; + } + #horizontal_links { + background: #eeeeee; + margin-left: 5%; + margin-right: 5%; + } + #horizontal { + margin: 0; + padding: 0 0 0 10px; + border-top: 1px solid #000077; + border-bottom: 1px solid #000077; + } + #horizontal li { + margin: 0 0 0 0; + padding: 0 16px 0 0; + display: inline; + list-style-type: none; + text-align: left; + background: none; + } + #horizontal a { + line-height: 12px; + margin: 0 0 0 0; + text-decoration: none; + color: #000077; + } + #horizontal a.active, #horizontal a:hover { + border-bottom: 2px solid #777777; + padding-bottom: 2px; + color: #000077; + } + #horizontal a:hover { + color: #000077; + } + #document_versions { + position: absolute; + top: 10mm; + right: 2%; + width: 12%; + float: right; + } + #vertical_links { + position: absolute; + top: 10mm; + right: 0px; + width: 20%; + background: #dddddd; + float: right; + } + #vertical { + padding: 0 12px 0px 0px; + margin-left: 2%; + margin-right: 2%; + } + #vertical li { + display: block; + list-style-type: none; + } + #vertical a { + line-height: 12px; + text-decoration: none; + color: #000077; + } + #vertical a.active, #vertical a:hover { + border-bottom: 2px solid #777777; + padding-bottom: 2px; + color: #000077; + } + ul, li { + list-style-type: none; + list-style: none; + padding-left: 20px; + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + font-weight: normal; + line-height: 150%; + text-align: left; + text-indent: 0mm; + margin-left: 1em; + margin-right: 2em; + margin-top: 3px; + margin-bottom: 3px; + } + li { + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; + } + ul { + } + li.bullet { margin-left: 1em; } + li.i1 { margin-left: 2em; } + li.i2 { margin-left: 3em; } + li.i3 { margin-left: 4em; } + li.i4 { margin-left: 5em; } + li.i5 { margin-left: 6em; } + li.i6 { margin-left: 7em; } + li.i7 { margin-left: 8em; } + li.i8 { margin-left: 9em; } + li.i9 { margin-left: 10em; } + li.doc, li.ref, li.refcenter { + margin-top: 0px; + margin-bottom: 0px; + margin-right: 0px; + font-size: 8px; + font-style: normal; + text-align: left; + } + li.doc { + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; + padding-left: 16px; + margin-left: 10px; + margin-right: 0px; + } + li.ref { + background: none; + padding-left: 0; + margin-left: 0; + color: #777777; + } + li.refcenter { + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; + padding-left: 20px; + margin-left: 10%; + font-size: 9px; + color: #777777; + text-align: center; + } + li.refbold { + list-style-type: none; + padding-left: 16px; + margin-left: 0; + margin-right: 10mm; + font-weight: bold; + } + h0, h1, h2, h3, h4, h5, h6, h7 { + font-weight: bold; + line-height: 120%; + text-align: left; + margin-top: 20px; + margin-bottom: 10px; + } + h4.norm, h5.norm, h6.norm, h7.norm { + margin-top: 10px; + margin-bottom: 0px; + } + h0.center, h1.center, h2.center, h3.center, h4.center, h5.center, h6.center, h7.center { + text-align: center; + } + h0 { font-size: 125%; } + h1 { font-size: 120%; } + h2 { font-size: 115%; } + h3 { font-size: 110%; } + h4 { font-size: 105%; } + h5 { font-size: 100%; } + h6 { font-size: 100%; } + h7 { font-size: 100%; } + h1.i {margin-left: 2em;} + h2.i {margin-left: 3em;} + h3.i {margin-left: 4em;} + h4.i {margin-left: 5em;} + h5.i {margin-left: 6em;} + h6.i {margin-left: 7em;} + h7.i {margin-left: 8em;} + h8.i {margin-left: 9em;} + h9.i {margin-left: 10em;} + h1.top_band { + display: inline; + text-align: left; + margin-top: 0; + margin-left: 4mm; + text-indent: 0mm; + font-weight: bold; + font-size: 120%; + } + h2.top_band_tiny { + font-size: 10px; + font-weight: normal; + margin-top: 0px; + margin-left: 4mm; + text-indent: 0mm; + margin-bottom: 0px; + color: #777777; + margin-left: 140px; + margin-right: 0px; + text-align: left; + } + p.top_band { + display: inline; + text-align: left; + margin-top: 0; + margin-left: 140px; + text-indent: 0mm; + font-weight: bold; + font-size: 120%; + } + p.top_band_tiny { + font-size: 10px; + margin-top: 0px; + margin-bottom: 0px; + color: #777777; + margin-left: 140px; + margin-right: 0px; + text-align: left; + } + p.top_band_image { + float: left; + display: inline; + text-align: left; + margin-top: 0; + margin-left: 1mm; + text-indent: 0mm; + margin-right: 1mm; + } + .banner, .subbanner { + font-weight: bold; + text-align: center; + margin-left: 10mm; + margin-right: 15mm; + margin-top: 20px; + margin-bottom: 10px; + } + h0.banner { + font-size: 125%; + } + h1.banner { + font-size: 120%; + } + h1.subbanner { + font-size: 115%; + } + h2.banner { + font-size: 110%; + } + h3.banner { + color: #990000; + font-size: 105%; + } + h4.banner { + color: #ff0000; + font-size: 100%; + } + h5.banner { + } + h6.banner { + } + h7.banner { + } + .toc { + font-weight: normal; + margin-top: 6px; + margin-bottom: 6px; + } + h0.toc { + margin-left: 1em; + font-size: 120%; + line-height: 150%; + } + h1.toc { + margin-left: 1em; + font-size: 115%; + line-height: 150%; + } + h2.toc { + margin-left: 2em; + font-size: 110%; + line-height: 140%; + } + h3.toc { + margin-left: 3em; + font-size: 105%; + line-height: 120%; + } + h4.toc { + margin-left: 4em; + font-size: 100%; + line-height: 120%; + } + h5.toc { + margin-left: 5em; + font-size: 95%; + line-height: 110%; + } + h6.toc { + margin-left: 6em; + font-size: 90%; + line-height: 110%; + } + h7.toc { + margin-left: 7em; + font-size: 85%; + line-height: 100%; + } + .microtoc { + margin-top: 2px; + margin-bottom: 2px; + } + h0.microtoc { + margin-left: 0mm; + font-size: 120%; + } + h1.microtoc { + margin-left: 0mm; + font-size: 115%; + } + h2.microtoc { + margin-left: 5mm; + font-size: 110%; + } + h3.microtoc { + margin-left: 10mm; + font-size: 105%; + } + h4.microtoc { + margin-left: 15mm; + font-weight: normal; + font-size: 100%; + } + h5.microtoc { + margin-left: 20mm; + font-weight: normal; + font-size: 95%; + } + h6.microtoc { + margin-left: 25mm; + font-weight: normal; + font-size: 90%; + } + h7.microtoc { + margin-left: 30mm; + font-weight: normal; + font-size: 85%; + } + .subtoc { + margin-right: 34%; + font-weight: normal; + } + h5.subtoc { + margin-left: 2em; + font-size: 80%; + margin-top: 2px; + margin-bottom: 2px; + } + h6.subtoc { + margin-left: 3em; + font-size: 75%; + margin-top: 0px; + margin-bottom: 0px; + } + h7.subtoc { + margin-left: 4em; + font-size: 70%; + margin-top: 0px; + margin-bottom: 0px; + } + div.substance { + width: 100%; + background-color: #ffffff; + } + div.ocn { + width: 5%; + float: right; + top: 0; + background-color: #ffffff; + } + div.endnote { + width: 95%; + background-color: #fffffff; + } + div.toc { + position: absolute; + float: left; + margin: 0; + padding: 0; + padding-top: 0.5em; + border: 0; + width: 13em; + background-color: #eeeeee; + margin-right:1em; + } + div.summary { + margin: 0; + padding: 0; + border-left: 13em solid #eeeeee; + padding-left: 1em; + background-color: #eeeeee; + } + div.content, div.main_column { + margin: 0; + padding: 0; + border-left: 13em solid #ffffff; + padding-left: 1em; + padding-right: 1em; + } + div.content0, div.main_column0 { + margin: 0; + padding: 0; + border-left: 0% solid #ffffff; + padding-left: 5%; + } + div.scroll { + margin: 0; + padding: 0; + padding-left: 1em; + padding-right: 1em; + } + div.content:after { + content:' '; + clear:both; + display:block; + height:0; + overflow:hidden + } + div.footer { + clear:left; + padding: 0.5em; + font-size: 80%; + margin: 0; + } + div.toc ul { + list-style: none; + padding: 0; + margin: 0; + } + div.toc li ul a, li ul span.currentlink + { + font-weight: normal; + font-size: 90%; + padding-left: 2em; + background-color: #eeeeee; + } + div.toc a, span.currentlink{ + display:block; + text-decoration: none; + padding-left: 0.5em; + color: #0000aa; + } + hr { + width: 90%; + } + span.currentlink { + text-decoration: none; + background-color: #aaaaf9; + } + div.toc a:visited { + color: #0000aa; + } + div.toc a:hover { + color: #000000; + background-color: #f9f9aa; + } + .minitoc { + font-weight: normal; + margin-top: 2px; + margin-bottom: 2px; + } + h1.minitoc, h2.minitoc, h3.minitoc { + margin-left: 0em; + font-weight: bold; + text-align: left; + font-size: 90%; + margin-top: 4px; + margin-bottom: 4px; + } + h4.minitoc { + margin-left: 0em; + font-size: 90%; + } + h5.minitoc { + margin-left: 1em; + font-size: 85%; + } + h6.minitoc { + margin-left: 2em; + font-size: 85%; + } + h7.minitoc { + margin-left: 3em; + font-size: 80%; + } + h0.minitoc { + margin-left: 0em; + font-size: 90%; + } + h0.c, h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, h7.c, p.c { + text-align: center + } + h1.red, h2.red, h3.red, h4.red, h5.red, h6.red, h7.red { + text-align: center; + color: #ff0000; + margin-left: 5mm; + text-indent: 5mm; + margin-top: 30px; + margin-bottom: 20px; + margin-right: 15mm; + } + h1.ruby, h2.ruby, h3.ruby, h4.ruby, h5.ruby, h6.ruby, h7.ruby { + text-align: center; + color: #990000; + margin-left: 5mm; + text-indent: 5mm; + margin-top: 30px; + margin-bottom: 20px; + margin-right: 15mm; + }"; + return css; + } + auto css_write() { + auto pth_css= "_sisu/css"; + auto pth_css_fn= pth_css ~ "/html.css"; + try { + mkdirRecurse(pth_css); + auto f = File(pth_css_fn, "w"); + f.writeln(html_css); + // foreach (o; doc) { + // f.writeln(o); + // } + } + catch (ErrnoException ex) { + // Handle error + } + } + auto html_toc(O)( + auto ref const O obj, + ) { + string o; + o = format(q"◎<h%s class="toc"><a href="#%s">%s</a></h%s>◎", + obj.heading_attrib.lev_markup_number, + obj.obj_cite_number, + obj.object, + obj.heading_attrib.lev_markup_number + ); + return o; + } + auto html_heading(O)( + auto ref const O obj, + ) { + string o; + o = format(q"◎<br><hr /><br> + <div class="substance"> + <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> + <h%s class="norm" id="%s"><a name="%s"></a> + %s + </h%s> + </div> + ◎", + obj.obj_cite_number, + obj.obj_cite_number, + obj.heading_attrib.lev_markup_number, + obj.obj_cite_number, + obj.obj_cite_number, + obj.object, + obj.heading_attrib.lev_markup_number + ); + return o; + } + auto html_para(O)( + auto ref const O obj, + ) { + string o; + o = format(q"◎<div class="substance"> + <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> + <p class="h%si%s" id="%s"> + %s + </p> + </div> + ◎", + obj.obj_cite_number, + obj.obj_cite_number, + obj.para_attrib.indent_first, + obj.para_attrib.indent_second, + obj.obj_cite_number, + obj.object + ); + return o; + } + auto scroll_head() { + string o; + o = format(q"◎ + <!DOCTYPE html> + <html> + <head> + <meta charset="utf-8"> + <title> + Title + </title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <meta name="dc.title" content="Title" /> + <meta name="dc.author" content="Author" /> + <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" /> + <meta name="dc.date" content="year" /> + <meta name="dc.date.created" content="year" /> + <meta name="dc.date.issued" content="year" /> + <meta name="dc.date.available" content="year" /> + <meta name="dc.date.valid" content="year" /> + <meta name="dc.date.modified" content="year" /> + <meta name="dc.language" content="US" /> + <meta name="dc.rights" content="Copyright: Copyright (C) year holder /> + <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" /> + <link rel="generator" href="http://www.sisudoc.org/" /> + <link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> + <link href="../../_sisu/css/html.css" rel="stylesheet"> + <link href="../../../_sisu/css/html.css" rel="stylesheet"> + </head> + <body lang="en"> + <a name="top" id="top"></a> + ◎"); + return o; + } + auto scroll_tail() { + string o; + o = format(q"◎ + <a name="bottom" id="bottom"></a> + <a name="end" id="end"></a> + </div> + </body> + </html> + ◎"); + return o; + } + auto scroll(C)( + auto ref const C contents, + string[][string][string] bookindex_unordered_hashes, + JSONValue[] biblio, + JSONValue[string] dochead_make, + JSONValue[string] dochead_meta, + string fn_src, + bool[string] opt_action_bool + ) { + mixin ScreenTxtColors; + mixin RgxInit; + auto rgx = Rgx(); + string[] toc; + string[] body_; + string[] doc; + foreach (obj; contents) { + if (obj.use == "content") { + switch (obj.is_a) { + case "heading": + toc ~= html_toc(obj); + body_ ~= html_heading(obj); + break; + case "para": + body_ ~= html_para(obj); + break; + case "verse": + body_ ~= html_para(obj); + // body_ ~= html_verse(obj); + break; + case "group": + body_ ~= html_para(obj); + // body_ ~= html_group(obj); + break; + case "block": + body_ ~= html_para(obj); + // body_ ~= html_block(obj); + break; + case "quote": + body_ ~= html_para(obj); + // body_ ~= html_quote(obj); + break; + case "table": + body_ ~= html_para(obj); + // body_ ~= html_table(obj); + break; + case "code": + body_ ~= html_para(obj); + // body_ ~= html_code(obj); + break; + default: + body_ ~= html_para(obj); + break; + } + } + } + doc = scroll_head ~ toc ~ body_ ~ scroll_tail; + auto m = matchFirst(fn_src, rgx.src_fn); + auto fn = m["fn_base"] ~ ".html"; + auto pth_html = "en/html"; + auto pth_seg = pth_html ~ "/" ~ m["fn_base"]; + auto pth_html_fn = pth_html ~ "/" ~ fn; + // auto pth_css= "_sisu/css"; + // auto pth_css_fn= pth_css ~ "/html.css"; + try { + mkdirRecurse(pth_seg); + auto f = File(pth_html_fn, "w"); + foreach (o; doc) { + f.writeln(o); + } + } + catch (ErrnoException ex) { + // Handle error + } + } + } +} |