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 /org | |
parent | config rearranged, more put in maker.org (diff) |
step4 some additional work
Diffstat (limited to 'org')
-rw-r--r-- | org/ao_abstract_doc_source.org | 228 | ||||
-rw-r--r-- | org/ao_defaults.org | 5 | ||||
-rw-r--r-- | org/ao_output_debugs.org | 48 | ||||
-rw-r--r-- | org/ao_read_source_files.org | 30 | ||||
-rw-r--r-- | org/output.org | 1601 | ||||
-rw-r--r-- | org/sdp.org | 233 |
6 files changed, 1934 insertions, 211 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index d8f2637..3c82dba 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -17,7 +17,7 @@ * document abstraction :abstract:process: Process markup document, create document abstraction. -** pre loop processing :pre: +** 1. pre loop processing :pre: *** imports :imports: [[./ao_defaults.org][ao_defaults]] @@ -159,7 +159,7 @@ scope(exit) { } 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( @@ -226,7 +226,7 @@ auto heading_match_rgx = [ ]; #+END_SRC -** loop: process document body [+6] :loop: +** 2. loop: process document body [+6] :loop: *** loop scope :scope: #+name: abs_in_loop_body_00 @@ -279,11 +279,12 @@ if (type["code"] == TriState.on) { code_block(line, an_object, type); continue; #+END_SRC + **** non code objects (other blocks or regular text) [+4] :non_code: #+name: abs_in_loop_body_00 #+BEGIN_SRC d -} 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) +/ #+END_SRC @@ -292,10 +293,10 @@ if (type["code"] == TriState.on) { #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -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; @@ -352,12 +353,12 @@ if (((match(line, rgx.heading_biblio) continue; #+END_SRC -***** not (yet) identified as being within block group [+3] +***** not identified as being within block group (could still be, or not) [+3] #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d } else { -/+ not within a block group +/ + /+ not within a block group +/ #+END_SRC ****** assert @@ -376,8 +377,8 @@ assertions_flag_types_block_status_none_or_closed(type); #+name: abs_in_loop_body_open_block_obj #+BEGIN_SRC d -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"); @@ -415,8 +416,8 @@ if (match(line, rgx.block_open)) { 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 ); } @@ -424,8 +425,8 @@ if (match(line, rgx.block_open)) { ******* book index :bookindex: #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d - 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); @@ -440,7 +441,7 @@ if (match(line, rgx.block_open)) { ******** matched: comment :comment:match: #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d - if (auto m = match(line, rgx.comment)) { + if (auto m = matchFirst(line, rgx.comment)) { /+ matched comment +/ debug(comment) { tell_l("blue", line); @@ -457,8 +458,8 @@ if (match(line, rgx.block_open)) { ******** matched: header make :header: #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d - } 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 @@ -489,9 +490,9 @@ if (match(line, rgx.block_open)) { /+ 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); @@ -585,9 +586,9 @@ if ((type["header_make"] == State.on) && (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"); @@ -601,9 +602,9 @@ if ((type["header_make"] == State.on) && (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; @@ -752,7 +753,7 @@ if (((contents_the_objects[$-1].is_a == "para") } #+END_SRC -** post loop processing :post: +** 3. post loop processing :post: *** misc @@ -923,7 +924,7 @@ auto t = tuple( document_the, dochead_make, - dochead_metadata, + dochead_meta, bookindex_unordered_hashes, biblio_ordered ); @@ -977,15 +978,15 @@ auto header_set_common( 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); @@ -993,9 +994,9 @@ auto check_obj_cite_number_status(char[] line, ref int[string] type) { } } 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; @@ -1007,7 +1008,7 @@ auto check_obj_cite_number_status(char[] line, ref int[string] type) { } } } 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) { @@ -1036,7 +1037,7 @@ auto start_block( #+name: abs_functions #+BEGIN_SRC d - 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( @@ -1049,7 +1050,7 @@ auto start_block( 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( @@ -1065,7 +1066,7 @@ auto start_block( 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( @@ -1078,7 +1079,7 @@ auto start_block( 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( @@ -1091,7 +1092,7 @@ auto start_block( 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( @@ -1104,7 +1105,7 @@ auto start_block( 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( @@ -1123,7 +1124,7 @@ auto start_block( #+name: abs_functions #+BEGIN_SRC d - } 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( @@ -1136,7 +1137,7 @@ auto start_block( 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( @@ -1151,7 +1152,7 @@ auto start_block( 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( @@ -1164,7 +1165,7 @@ auto start_block( 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( @@ -1177,7 +1178,7 @@ auto start_block( 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( @@ -1190,7 +1191,7 @@ auto start_block( 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( @@ -1225,7 +1226,7 @@ auto code_block( 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); } @@ -1236,10 +1237,10 @@ auto code_block( 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); } @@ -1250,7 +1251,7 @@ auto code_block( 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; @@ -1351,7 +1352,7 @@ auto biblio_block( 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)) { @@ -1366,7 +1367,7 @@ auto biblio_block( 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]); @@ -1448,7 +1449,7 @@ auto poem_block( 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( @@ -1507,7 +1508,7 @@ auto poem_block( 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; } @@ -1548,7 +1549,7 @@ auto poem_block( } } } 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( @@ -1593,7 +1594,7 @@ auto poem_block( 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; } @@ -1649,7 +1650,7 @@ auto group_block( 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); } @@ -1663,7 +1664,7 @@ auto group_block( 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); } @@ -1691,7 +1692,7 @@ auto block_block( 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); } @@ -1705,7 +1706,7 @@ auto block_block( 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); } @@ -1729,7 +1730,7 @@ auto block_block( #+BEGIN_SRC d 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); } @@ -1743,7 +1744,7 @@ auto quote_block(char[] line, ref string[string] an_object, ref int[string] type 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); } @@ -1767,7 +1768,7 @@ auto quote_block(char[] line, ref string[string] an_object, ref int[string] type #+BEGIN_SRC d 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); } @@ -1781,7 +1782,7 @@ auto table_block(char[] line, ref string[string] an_object, ref int[string] type 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); } @@ -2083,7 +2084,7 @@ auto header_extract( 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); @@ -2095,7 +2096,7 @@ auto header_extract( 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); @@ -2110,7 +2111,7 @@ auto header_extract( } 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); @@ -2122,7 +2123,7 @@ auto header_extract( } 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); @@ -2246,43 +2247,43 @@ auto heading_make_set( && ((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); @@ -2302,7 +2303,8 @@ auto heading_match( 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 +/ @@ -2318,6 +2320,8 @@ auto heading_match( 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"]); @@ -2451,7 +2455,7 @@ auto para_match( /+ 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); } @@ -2460,7 +2464,7 @@ auto para_match( 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); } @@ -2469,7 +2473,7 @@ auto para_match( 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); } @@ -2478,7 +2482,7 @@ auto para_match( 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); } @@ -2537,19 +2541,19 @@ struct ObjAttributes { 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]) ~ ","; @@ -3048,14 +3052,14 @@ struct HeaderDocMetadataMakeJson { 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)) { @@ -3069,13 +3073,13 @@ struct HeaderDocMetadataMakeJson { 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]); } } @@ -3099,12 +3103,12 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3116,11 +3120,11 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3131,8 +3135,8 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3143,8 +3147,8 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3155,8 +3159,8 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3167,8 +3171,8 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3179,8 +3183,8 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3191,8 +3195,8 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3203,8 +3207,8 @@ struct HeaderDocMetadataMakeJson { 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 { @@ -3217,8 +3221,8 @@ struct HeaderDocMetadataMakeJson { 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); @@ -3237,7 +3241,7 @@ struct HeaderDocMetadataMakeJson { 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/org/ao_defaults.org b/org/ao_defaults.org index 9d5eb00..00fce41 100644 --- a/org/ao_defaults.org +++ b/org/ao_defaults.org @@ -349,7 +349,8 @@ template InternalMarkup() { 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$`); @@ -394,6 +395,8 @@ static header_metadata = ctRegex!(`^@([a-z_]+):(?:\s|$)`); 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`); #+END_SRC ** header & paragraph operators :paragraph:operator: #+name: ao_rgx diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org index 51054b7..6f6a6c8 100644 --- a/org/ao_output_debugs.org +++ b/org/ao_output_debugs.org @@ -93,19 +93,19 @@ debug(headermakejson) { 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] ); } } @@ -123,115 +123,115 @@ debug(headermetadatajson) { 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] ); } } @@ -458,10 +458,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 ) { diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index 3609fb5..26f25fb 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -106,7 +106,7 @@ final char[][] markupSourceContentRawLineArray(in string fn_src, Regex!(char) rg } #+END_SRC -* inserts :inserts: +* get markup source, master file & inserts :inserts: [[./sdp.org][sdp]] [[./][org/]] ** scan inserts (sub-document) source :scan_insert_src: @@ -130,11 +130,11 @@ auto markup_src_file_path = fn_pth_full.captures[1]; 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; @@ -142,25 +142,25 @@ if (type1["curly_code"] == 1) { } 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; @@ -227,11 +227,11 @@ auto markup_src_file_path = fn_pth_full.captures[1]; 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; @@ -239,30 +239,30 @@ if (type["curly_code"] == 1) { } 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/org/output.org b/org/output.org new file mode 100644 index 0000000..fa16447 --- /dev/null +++ b/org/output.org @@ -0,0 +1,1601 @@ +#+TITLE: sdp output html +#+AUTHOR: Ralph Amissah +#+EMAIL: ralph.amissah@gmail.com +#+STARTUP: indent +#+LANGUAGE: en +#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t +#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc +#+OPTIONS: author:nil email:nil creator:nil timestamp:nil +#+PROPERTY: header-args :padline no :exports code :noweb yes +#+EXPORT_SELECT_TAGS: export +#+EXPORT_EXCLUDE_TAGS: noexport +#+FILETAGS: :sdp:rel:output: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) + +[[./sdp.org][sdp]] [[./][org/]] +* output :output: +** text :text: +** html :html: + +#+name: output_html +#+BEGIN_SRC d +struct SDPoutputHTML { +#+END_SRC + +*** css +#+name: output_html +#+BEGIN_SRC d + 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 + } + } +#+END_SRC + +*** html +**** html functions +#+name: output_html +#+BEGIN_SRC d + 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; + } +#+END_SRC + +**** html scroll head & tail +#+name: output_html +#+BEGIN_SRC d + 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; + } +#+END_SRC + +**** html scroll +#+name: output_html +#+BEGIN_SRC d + 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 + } + } +} +#+END_SRC + +** epub :epub: +** pdf :pdf: +** odt :odt: +** sqlite :sqlite: +** pgsql :pgsql: +* tangles :tangle: +** code structure: :output.d: +#+BEGIN_SRC d :tangle ../src/sdp/output_hub.d +/+ + output hub + output_hub.d ++/ +template SiSUoutputHub() { + <<output_html>> +} +#+END_SRC + +** dump + +template SiSUoutput() { + struct SDPoutput { + auto html(S)( + auto ref const S contents, + JSONValue[string] dochead_make, + JSONValue[string] dochead_meta, + string[][string][string] bookindex_unordered_hashes, + JSONValue[] biblio, + string fn_src, + bool[string] opt_action_bool + ) { + mixin RgxInit; + mixin ScreenTxtColors; + auto rgx = Rgx(); + <<ao_output_html>> + <<ao_output_html_summary>> + } + } + } +} + +** head +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title> + Democratizing Innovation + </title> +<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <meta name="dc.title" content="Democratizing Innovation" /> + <meta name="dc.author" content="Eric von Hippel" /> + <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" /> + <meta name="dc.date" content="2005" /> + <meta name="dc.date.created" content="2005" /> + <meta name="dc.date.issued" content="2005" /> + <meta name="dc.date.available" content="2005" /> + <meta name="dc.date.valid" content="2005" /> + <meta name="dc.date.modified" content="2005" /> + <meta name="dc.language" content="US" /> + <meta name="dc.rights" content="Copyright: Copyright (C) 2005 Eric von Hippel. Exclusive rights to publish and sell this book in print form in English are licensed to The MIT Press. All other rights are reserved by the author. An electronic version of this book is available under a Creative Commons license. \\ License: Creative Commons US Attribution-NonCommercial-NoDerivs license 2.0. http://creativecommons.org/licenses/by-nc-nd/2.0/legalcode Some Rights Reserved. You are free to copy, distribute, display and perform the work, under the following conditions: Attribution, you must give the original author credit; you may not use this work for commercial purposes; No Derivative Works, you may not alter, transform, or build-upon this work. For reuse or distribution you must make clear to others the license terms of this work. Any conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above." /> + + <meta name="generator" content="SiSU 7.1.8 of 2016w08/5 (2016-02-26) (n*x and Ruby!)" /> + <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> + + + +<a name="bottom" id="bottom"></a> +<a name="end" id="end"></a> +</div> + +</body> +</html> diff --git a/org/sdp.org b/org/sdp.org index dc56e8e..0b2fc53 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -39,6 +39,34 @@ enum ver = Version(0, 4, 0); [[./ao_defaults.org][ao_defaults]] [[./ao_output_debugs.org][ao_output_debugs]] [[./ao_read_source_files.org][ao_read_source_files]] +[[./output_hub.org][output hub]] + +**** sdp :import:sdp: +***** TODO src/sdp.d + +├── src +│ ├── sdp.d +│ └── sdp +│ ├── ao_abstract_doc_source.d +│ ├── ... +│ └── compile_time_info.d +└── views + └── version.txt + +#+NAME: sdp_imports_use +#+BEGIN_SRC 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; +#+END_SRC **** std :import:std: #+NAME: sdp_imports @@ -52,6 +80,7 @@ private import std.array, std.container, std.exception, + std.file, std.json, // std.path, std.range, @@ -65,32 +94,6 @@ private import std.conv : to; #+END_SRC -**** sdp :import:sdp: -***** TODO src/sdp.d - -├── src -│ ├── sdp.d -│ └── sdp -│ ├── ao_abstract_doc_source.d -│ ├── ... -│ └── compile_time_info.d -└── views - └── version.txt - -#+NAME: sdp_imports_use -#+BEGIN_SRC d -/+ 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; -#+END_SRC - **** version.txt :version: #+NAME: sdp_version_mixin @@ -108,9 +111,67 @@ mixin SiSUrgxInitFlags; mixin SiSUmarkupRaw; mixin SiSUdocAbstraction; mixin SiSUoutputDebugs; +mixin SiSUoutputHub; mixin ScreenTxtColors; #+END_SRC +*** sdp output :output: +#+NAME: sdp_args +#+BEGIN_SRC d +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_; + } +} +#+END_SRC + *** init :init: #+NAME: sdp_args @@ -118,6 +179,7 @@ mixin ScreenTxtColors; auto raw = MarkupRaw(); auto abs = Abstraction(); auto dbg = SDPoutputDebugs(); +auto output = SDPoutput(); /+ struct DocumentParts { string[string][] contents; @@ -169,17 +231,52 @@ look into using getopt #+BEGIN_SRC d 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); @@ -195,7 +292,7 @@ foreach(arg; args) { } #+END_SRC -** loop each file [+2] :loop:files: +** each file (loop) [+2] :loop:files: *** filename provided [+1] :file:process: **** loop scope :scope: #+NAME: sdp_each_file_do @@ -240,8 +337,7 @@ auto sourcefile_content = #+NAME: sdp_each_file_do #+BEGIN_SRC d /+ ↓ 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)); @@ -260,16 +356,32 @@ auto doc_ao_biblio = t[4]; 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 ); } #+END_SRC +**** TODO process outputs :outputs: +***** [#A] html :html: +#+NAME: sdp_each_file_do +#+BEGIN_SRC d +/+ ↓ 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 +); +#+END_SRC + **** on exit :scope:exit: #+NAME: sdp_each_file_do #+BEGIN_SRC d @@ -304,31 +416,13 @@ break; ** sdp :sdp.d: *** TODO src/sdp.d -├── src -│ ├── sdp.d -│ └── sdp -│ ├── ao_abstract_doc_source.d -│ ├── ... -│ └── compile_time_info.d -├── views -│ └── version.txt - -├── src -│ ├── sdp -│ │ ├── ao_abstract_doc_source.d -│ │ ├── ... -│ │ └── compile_time_info.d -│ └── sdp.d -├── views -│ └── version.txt - #+BEGIN_SRC d :tangle ../src/sdp.d :shebang #!/usr/bin/env rdmd /+ sdp sdp.d +/ -<<sdp_imports>> <<sdp_imports_use>> +<<sdp_imports>> <<sdp_version_mixin>> mixin CompileTimeInfo; mixin RgxInit; @@ -346,8 +440,29 @@ void main(string[] args) { } #+END_SRC +├── src +│ ├── sdp.d +│ └── sdp +│ ├── ao_abstract_doc_source.d +│ ├── ... +│ └── compile_time_info.d +├── views +│ └── version.txt + +├── src +│ ├── sdp +│ │ ├── ao_abstract_doc_source.d +│ │ ├── ... +│ │ └── compile_time_info.d +│ └── sdp.d +├── views +│ └── version.txt + * TODO work on -- figure out best program dir structure, issue with rdmd +** program dir structure +figure out best program dir structure for dub and compilers, issue with rdmd + +** sisu file structure |---------------------+------------------------------------------+------------------------+--------| | header | sisu /header markup/ | markup | | |