diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-03-27 18:13:27 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 25ac32b30c6ba98b32006677e2633befaa69483a (patch) | |
tree | b759654c0763f6ede950274e54aa775fc9e8d9f6 | |
parent | 0.13.7 tables ao and html output, poem html output (diff) |
output, move stuff about
-rw-r--r-- | org/ao_doc_abstraction.org | 13 | ||||
-rw-r--r-- | org/output.org | 216 | ||||
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 6 | ||||
-rw-r--r-- | src/sdp/output_epub.d | 14 | ||||
-rw-r--r-- | src/sdp/output_html.d | 34 | ||||
-rw-r--r-- | src/sdp/output_xhtmls.d | 86 |
6 files changed, 188 insertions, 181 deletions
diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org index e527f8c..2f7672b 100644 --- a/org/ao_doc_abstraction.org +++ b/org/ao_doc_abstraction.org @@ -2768,6 +2768,9 @@ void _quote_block_(L,O,T)( ***** group block :group: +- apply inline markup +- discard leading and newline whitespace + #+name: abs_functions_block_group #+BEGIN_SRC d void _group_block_(L,O,T)( @@ -2815,6 +2818,10 @@ void _group_block_(L,O,T)( ***** block block :block: +- apply inline markup +- keep whitespace indentation +- keep newlines + #+name: abs_functions_block_block #+BEGIN_SRC d void _block_block_(L,O,T)( @@ -3273,7 +3280,7 @@ void _block_flag_line_empty_(B)( comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; type["blocks"] = TriState.off; - type["table"] = TriState.off; + type["quote"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3349,7 +3356,7 @@ void _block_flag_line_empty_(B)( cntr, heading_ptr-1, an_object["is"] - ); + ); auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; @@ -4755,7 +4762,7 @@ struct ObjInlineMarkup { break; default: /+ para, heading, group, block, verse +/ - obj_txt["munge"]=x[0]; + obj_txt["munge"] = x[0]; obj_notes_and_links["notes_reg"] = x[1]; obj_notes_and_links["notes_star"] = x[2]; obj_notes_and_links["links"] = x[3]; diff --git a/org/output.org b/org/output.org index 1b2ee5f..c59b037 100644 --- a/org/output.org +++ b/org/output.org @@ -776,99 +776,118 @@ auto para_seg(O)( } #+END_SRC -**** poem verse +**** nugget #+name: xhtml_format_objects #+BEGIN_SRC d -auto verse(O)( // using code from code block, review +auto nugget(O)( auto return ref const O obj, ) { - string _txt = obj.text; - _txt = (_txt) - .replaceAll(rgx.newline, "<br>\n") - .replaceAll(rgx.two_spaces, " " ~ " " ~ " " ~ " ") - .replaceAll(rgx.nbsp_and_space, " " ~ " "); string o; if (obj.obj_cite_number.empty) { - o = format(q"¶ <div class="substance"> - <p class="%s"> -%s - </p> - </div>¶", + o = format(q"¶ <div class="substance"> + <p class="%s"> + %s + </p> +</div>¶", obj.is_a, - _txt + obj.text ); } else { o = format(q"¶ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s"> -%s - </p> - </div>¶", + <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> + <p class="%s" id="%s"> + %s + </p> +</div>¶", obj.obj_cite_number, obj.obj_cite_number, obj.is_a, obj.obj_cite_number, - _txt + obj.text ); } return o; } #+END_SRC -**** nugget +**** poem verse #+name: xhtml_format_objects #+BEGIN_SRC d -auto nugget(O)( +auto verse(O)( // using code from code block, review auto return ref const O obj, ) { + string _txt = obj.text; + _txt = (_txt) + .replaceAll(rgx.newline, "<br>\n") + .replaceAll(rgx.two_spaces, " " ~ " " ~ " " ~ " ") + .replaceAll(rgx.nbsp_and_space, " " ~ " "); string o; if (obj.obj_cite_number.empty) { - o = format(q"¶ <div class="substance"> - <p class="%s"> - %s - </p> -</div>¶", + o = format(q"¶ <div class="substance"> + <p class="%s"> +%s + </p> + </div>¶", obj.is_a, - obj.text + _txt ); } else { o = format(q"¶ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s"> - %s - </p> -</div>¶", + <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> + <p class="%s" id="%s"> +%s + </p> + </div>¶", obj.obj_cite_number, obj.obj_cite_number, obj.is_a, obj.obj_cite_number, - obj.text + _txt ); } return o; } #+END_SRC -**** endnote +**** code -#+name: xhtml_format_objects +#+name: xhtml_format_objects_code #+BEGIN_SRC d -auto endnote(O)( - auto return ref const O obj, -) { - string o; - o = format(q"¶ <p class="%s" indent="h%si%s"> - %s -</p>¶", - obj.is_a, - obj.indent_hang, - obj.indent_base, - obj.text - ); - return o; -} + auto code(O)( + auto return ref const O obj, + ) { + string _txt = obj.text; + _txt = (_txt) + .replaceAll(rgx.newline, "<br>\n") + .replaceAll(rgx.nbsp_char, " "); + string o; + if (obj.obj_cite_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s"> +%s + </p> + </div>¶", + obj.is_a, + _txt + ); + } else { + o = format(q"¶ <div class="substance"> + <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> + <p class="%s" id="%s"> +%s + </p> + </div>¶", + obj.obj_cite_number, + obj.obj_cite_number, + obj.is_a, + obj.obj_cite_number, + _txt + ); + } + return o; + } #+END_SRC **** table @@ -955,43 +974,24 @@ auto table(O)( } #+END_SRC -**** code +**** endnote -#+name: xhtml_format_objects_code +#+name: xhtml_format_objects #+BEGIN_SRC d - auto code(O)( - auto return ref const O obj, - ) { - string _txt = obj.text; - _txt = (_txt) - .replaceAll(rgx.newline, "<br>\n") - .replaceAll(rgx.nbsp_char, " "); - string o; - if (obj.obj_cite_number.empty) { - o = format(q"¶ <div class="substance"> - <p class="%s"> -%s - </p> - </div>¶", - obj.is_a, - _txt - ); - } else { - o = format(q"¶ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s"> -%s - </p> - </div>¶", - obj.obj_cite_number, - obj.obj_cite_number, - obj.is_a, - obj.obj_cite_number, - _txt - ); - } - return o; - } +auto endnote(O)( + auto return ref const O obj, +) { + string o; + o = format(q"¶ <p class="%s" indent="h%si%s"> + %s +</p>¶", + obj.is_a, + obj.indent_hang, + obj.indent_base, + obj.text + ); + return o; +} #+END_SRC *** _html_ [#A] :html: @@ -1069,10 +1069,8 @@ void scroll(D,I)( break; case "block": switch (obj.is_a) { - case "poem": - break; - case "verse": - doc_html ~= xhtml_format.verse(obj); + case "quote": + doc_html ~= xhtml_format.nugget(obj); break; case "group": doc_html ~= xhtml_format.nugget(obj); @@ -1080,15 +1078,17 @@ void scroll(D,I)( case "block": doc_html ~= xhtml_format.nugget(obj); break; - case "quote": - doc_html ~= xhtml_format.nugget(obj); + case "poem": break; - case "table": - doc_html ~= xhtml_format.table(obj); + case "verse": + doc_html ~= xhtml_format.verse(obj); break; case "code": doc_html ~= xhtml_format.code(obj); break; + case "table": + doc_html ~= xhtml_format.table(obj); + break; default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); @@ -1303,10 +1303,8 @@ void seg(D,I)( break; case "block": switch (obj.is_a) { - case "poem": - break; - case "verse": - doc_html[segment_filename] ~= xhtml_format.verse(obj); + case "quote": + doc_html[segment_filename] ~= xhtml_format.nugget(obj); break; case "group": doc_html[segment_filename] ~= xhtml_format.nugget(obj); @@ -1314,16 +1312,18 @@ void seg(D,I)( case "block": doc_html[segment_filename] ~= xhtml_format.nugget(obj); break; - case "quote": - doc_html[segment_filename] ~= xhtml_format.nugget(obj); + case "poem": break; - case "table": - doc_html[segment_filename] ~= xhtml_format.table(obj); - doc_html_endnotes[segment_filename] ~= ""; + case "verse": + doc_html[segment_filename] ~= xhtml_format.verse(obj); break; case "code": doc_html[segment_filename] ~= xhtml_format.code(obj); break; + case "table": + doc_html[segment_filename] ~= xhtml_format.table(obj); + doc_html_endnotes[segment_filename] ~= ""; + break; default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); @@ -2587,9 +2587,7 @@ void outputEPub(D,I)( break; case "block": switch (obj.is_a) { - case "poem": // double check why both poem & verse - break; - case "verse": + case "quote": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); break; case "group": @@ -2598,17 +2596,19 @@ void outputEPub(D,I)( case "block": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); break; - case "quote": + case "poem": + break; + case "verse": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); break; + case "code": + doc_epub[segment_filename] ~= xhtml_format.code(obj); + break; case "table": auto t = xhtml_format.para_seg(obj, suffix); doc_epub[segment_filename] ~= t[0]; doc_epub_endnotes[segment_filename] ~= t[1]; break; - case "code": - doc_epub[segment_filename] ~= xhtml_format.code(obj); - break; default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index de3d575..4b3ea1f 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -2528,7 +2528,7 @@ template SiSUdocAbstraction() { comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; type["blocks"] = TriState.off; - type["table"] = TriState.off; + type["quote"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2592,7 +2592,7 @@ template SiSUdocAbstraction() { cntr, heading_ptr-1, an_object["is"] - ); + ); auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; @@ -3757,7 +3757,7 @@ template SiSUdocAbstraction() { break; default: /+ para, heading, group, block, verse +/ - obj_txt["munge"]=x[0]; + obj_txt["munge"] = x[0]; obj_notes_and_links["notes_reg"] = x[1]; obj_notes_and_links["notes_star"] = x[2]; obj_notes_and_links["links"] = x[3]; diff --git a/src/sdp/output_epub.d b/src/sdp/output_epub.d index 3724854..2cbe885 100644 --- a/src/sdp/output_epub.d +++ b/src/sdp/output_epub.d @@ -274,9 +274,7 @@ template outputEPub() { break; case "block": switch (obj.is_a) { - case "poem": // double check why both poem & verse - break; - case "verse": + case "quote": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); break; case "group": @@ -285,17 +283,19 @@ template outputEPub() { case "block": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); break; - case "quote": + case "poem": + break; + case "verse": doc_epub[segment_filename] ~= xhtml_format.nugget(obj); break; + case "code": + doc_epub[segment_filename] ~= xhtml_format.code(obj); + break; case "table": auto t = xhtml_format.para_seg(obj, suffix); doc_epub[segment_filename] ~= t[0]; doc_epub_endnotes[segment_filename] ~= t[1]; break; - case "code": - doc_epub[segment_filename] ~= xhtml_format.code(obj); - break; default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d index a05812f..9e66311 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -80,10 +80,8 @@ template outputHTML() { break; case "block": switch (obj.is_a) { - case "poem": - break; - case "verse": - doc_html ~= xhtml_format.verse(obj); + case "quote": + doc_html ~= xhtml_format.nugget(obj); break; case "group": doc_html ~= xhtml_format.nugget(obj); @@ -91,15 +89,17 @@ template outputHTML() { case "block": doc_html ~= xhtml_format.nugget(obj); break; - case "quote": - doc_html ~= xhtml_format.nugget(obj); + case "poem": break; - case "table": - doc_html ~= xhtml_format.table(obj); + case "verse": + doc_html ~= xhtml_format.verse(obj); break; case "code": doc_html ~= xhtml_format.code(obj); break; + case "table": + doc_html ~= xhtml_format.table(obj); + break; default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); @@ -301,10 +301,8 @@ template outputHTML() { break; case "block": switch (obj.is_a) { - case "poem": - break; - case "verse": - doc_html[segment_filename] ~= xhtml_format.verse(obj); + case "quote": + doc_html[segment_filename] ~= xhtml_format.nugget(obj); break; case "group": doc_html[segment_filename] ~= xhtml_format.nugget(obj); @@ -312,16 +310,18 @@ template outputHTML() { case "block": doc_html[segment_filename] ~= xhtml_format.nugget(obj); break; - case "quote": - doc_html[segment_filename] ~= xhtml_format.nugget(obj); + case "poem": break; - case "table": - doc_html[segment_filename] ~= xhtml_format.table(obj); - doc_html_endnotes[segment_filename] ~= ""; + case "verse": + doc_html[segment_filename] ~= xhtml_format.verse(obj); break; case "code": doc_html[segment_filename] ~= xhtml_format.code(obj); break; + case "table": + doc_html[segment_filename] ~= xhtml_format.table(obj); + doc_html_endnotes[segment_filename] ~= ""; + break; default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d index 971dd95..f371121 100644 --- a/src/sdp/output_xhtmls.d +++ b/src/sdp/output_xhtmls.d @@ -419,40 +419,6 @@ template outputXHTMLs() { ); return u; } - auto verse(O)( // using code from code block, review - auto return ref const O obj, - ) { - string _txt = obj.text; - _txt = (_txt) - .replaceAll(rgx.newline, "<br>\n") - .replaceAll(rgx.two_spaces, " " ~ " " ~ " " ~ " ") - .replaceAll(rgx.nbsp_and_space, " " ~ " "); - string o; - if (obj.obj_cite_number.empty) { - o = format(q"¶ <div class="substance"> - <p class="%s"> - %s - </p> - </div>¶", - obj.is_a, - _txt - ); - } else { - o = format(q"¶ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> - <p class="%s" id="%s"> - %s - </p> - </div>¶", - obj.obj_cite_number, - obj.obj_cite_number, - obj.is_a, - obj.obj_cite_number, - _txt - ); - } - return o; - } auto nugget(O)( auto return ref const O obj, ) { @@ -482,18 +448,38 @@ template outputXHTMLs() { } return o; } - auto endnote(O)( + auto verse(O)( // using code from code block, review auto return ref const O obj, ) { + string _txt = obj.text; + _txt = (_txt) + .replaceAll(rgx.newline, "<br>\n") + .replaceAll(rgx.two_spaces, " " ~ " " ~ " " ~ " ") + .replaceAll(rgx.nbsp_and_space, " " ~ " "); string o; - o = format(q"¶ <p class="%s" indent="h%si%s"> - %s - </p>¶", - obj.is_a, - obj.indent_hang, - obj.indent_base, - obj.text - ); + if (obj.obj_cite_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s"> + %s + </p> + </div>¶", + obj.is_a, + _txt + ); + } else { + o = format(q"¶ <div class="substance"> + <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> + <p class="%s" id="%s"> + %s + </p> + </div>¶", + obj.obj_cite_number, + obj.obj_cite_number, + obj.is_a, + obj.obj_cite_number, + _txt + ); + } return o; } auto tablarize(O)( @@ -558,6 +544,20 @@ template outputXHTMLs() { ); return o; } + auto endnote(O)( + auto return ref const O obj, + ) { + string o; + o = format(q"¶ <p class="%s" indent="h%si%s"> + %s + </p>¶", + obj.is_a, + obj.indent_hang, + obj.indent_base, + obj.text + ); + return o; + } auto code(O)( auto return ref const O obj, ) { |