From 6f27312b0e61932d820b991a15c44845ff2cee75 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 26 Feb 2017 18:27:08 -0500 Subject: 0.13.5 defaults regex reorganised; some work on (x)html output --- org/output.org | 606 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 450 insertions(+), 156 deletions(-) (limited to 'org/output.org') diff --git a/org/output.org b/org/output.org index b77449d..8ad43d9 100644 --- a/org/output.org +++ b/org/output.org @@ -45,10 +45,10 @@ template outputHub() { output_xhtmls, source_sisupod; import - ao_rgx, + output_rgx, output_xhtmls; void outputHub(D,I)(D doc_abstraction, I doc_matters) { - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto rgx = Rgx(); if ((doc_matters.opt_action_bool["verbose"])) { writeln(doc_matters.keys_seq_seg); @@ -131,9 +131,10 @@ private import std.typecons, std.uni, std.utf, - defaults; + std.conv : to; import - ao_rgx, + defaults, + output_rgx, output_xhtmls; #+END_SRC @@ -148,6 +149,7 @@ template SiSUpod() { try { <> <> + <> } catch (ErrnoException ex) { // Handle error @@ -163,7 +165,7 @@ template SiSUpod() { debug(asserts){ // static assert(is(typeof(doc_matters) == tuple)); } -mixin SiSUrgxInit; +mixin SiSUoutputRgxInit; mixin SiSUpaths; auto pth_sisupod = SiSUpodPaths(); mixin SiSUlanguageCodes; @@ -255,11 +257,14 @@ foreach (image; doc_matters.image_list) { ** text [#C] :text: ** xml offspring (xhtml html epub) :xml: *** format xhtml objects :format: -**** xhtml common template :template: +**** 0. xhtml common template :template: #+BEGIN_SRC d :tangle ../src/sdp/output_xhtmls.d template outputXHTMLs() { + <> + mixin SiSUoutputRgxInit; struct outputXHTMLs { + auto rgx = Rgx(); <> <> } @@ -390,6 +395,168 @@ auto tail() { } #+END_SRC +**** inline markup +***** links + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto inline_links(O)( + auto return ref const O obj, + string _txt, + string _suffix = ".html", + string seg_scroll = "seg", +) { + if (obj.inline_links) { + if ((seg_scroll == "scroll") + && match(_txt, rgx.mark_internal_site_lnk)) { + _txt = (_txt).replaceAll( + rgx.inline_seg_link, + "$1"); + } + _txt = (_txt).replaceAll( + rgx.inline_link_fn_suffix, + ("$1" ~ _suffix)); + _txt = (_txt).replaceAll( + rgx.inline_link, + ("$1")); + _txt = (_txt).replaceAll( + rgx.mark_internal_site_lnk, + "" + ); + } + debug(markup_links) { + if ( match(_txt, rgx.inline_link)) { + writeln(__LINE__, + " (missed) markup link identified (", + obj.inline_links, + "): ", obj.is_a, ": ", + obj.text + ); + } + } + debug(markup) { + if ( match(_txt, rgx.inline_link)) { + writeln(__LINE__, + " (missed) markup link identified (", + obj.inline_links, + "): ", obj.is_a, ": ", + obj.text + ); + } + } + return _txt; +} +#+END_SRC + +***** notes scroll + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto inline_notes_scroll(O)( + auto return ref const O obj, + string _txt, +) { + if (obj.inline_notes_reg) { + _txt = (_txt).replaceAll( + rgx.inline_notes_delimiter_al_regular_number_note, + (" $1 ") + ); + } + debug(markup_endnotes) { + if (match(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + writeln(__LINE__, " (missed) markup endnote: ", obj.is_a, ": ", obj.text); + } + } + debug(markup) { + if (match(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + writeln(__LINE__, " (missed) markup endnote: ", obj.is_a, ": ", obj.text); + } + } + // if (obj.inline_notes_star) { + // _txt = replaceAll( + // _txt, + // rgx.inline_notes_delimiter_al_regular_number_note, + // (" $1 ") + // ); + // } + return _txt; +} +#+END_SRC + +***** notes seg + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto inline_notes_seg(O)( + auto return ref const O obj, + string _txt, +) { + string[] _endnotes; + if (obj.inline_notes_reg) { + /+ need markup for text, and separated footnote +/ + foreach(m; matchAll(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + _endnotes ~= format( + "%s%s%s%s\n %s%s%s%s%s\n %s\n%s", + "

", + "", + " ", + m.captures[1], + ".", + m.captures[2], + "

" + ); + } + _txt = (_txt).replaceAll( + rgx.inline_notes_delimiter_al_regular_number_note, + (" $1 ") + ); + } else if (match(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + debug(markup) { + writeln(__LINE__, " endnote: ", obj.is_a, ": ", obj.text); + } + } + auto t = tuple( + _txt, + _endnotes, + ); + return t; +} +#+END_SRC + +***** inline markup scroll + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto inline_markup_scroll(O)( + auto return ref const O obj, + string _suffix = ".html", +) { + string _txt = obj.text; + _txt = inline_links(obj, _txt, _suffix, "scroll"); + _txt = inline_notes_scroll(obj, _txt); + return _txt; +} +#+END_SRC + +***** inline markup seg + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto inline_markup_seg(O)( + auto return ref const O obj, + string _suffix = ".html", +) { + string _txt = obj.text; + _txt = inline_links(obj, _txt, _suffix, "seg"); + auto t = inline_notes_seg(obj, _txt); + return t; +} +#+END_SRC + **** toc #+name: xhtml_format_objects @@ -413,11 +580,13 @@ auto toc(O)( #+END_SRC **** heading +***** heading #+name: xhtml_format_objects #+BEGIN_SRC d auto heading(O)( auto return ref const O obj, + string _txt, ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); string o; @@ -431,7 +600,7 @@ auto heading(O)( obj.heading_lev_markup, obj.is_a, tags, - obj.text, + _txt, obj.heading_lev_markup, ); } else { @@ -449,7 +618,7 @@ auto heading(O)( obj.obj_cite_number, obj.obj_cite_number, tags, - obj.text, + _txt, obj.heading_lev_markup, ); } @@ -457,12 +626,49 @@ auto heading(O)( } #+END_SRC +***** scroll + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto heading_scroll(O)( + auto return ref const O obj, + string _suffix = ".html", +) { + auto tags = _xhtml_anchor_tags(obj.anchor_tags); + string _txt = inline_markup_scroll(obj, _suffix); // issue + string o = heading(obj, _txt); + return o; +} +#+END_SRC + +***** seg + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto heading_seg(O)( + auto return ref const O obj, + string _suffix = ".html", +) { + auto t = inline_markup_seg(obj, _suffix); + string _txt = t[0]; + string[] _endnotes = t[1]; + string o = heading(obj, _txt); + auto u = tuple( + o, + _endnotes, + ); + return u; +} +#+END_SRC + **** para +***** para #+name: xhtml_format_objects #+BEGIN_SRC d auto para(O)( auto return ref const O obj, + string _txt, ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); string o; @@ -476,7 +682,7 @@ auto para(O)( obj.indent_hang, obj.indent_base, tags, - obj.text + _txt ); } else { o = format(q"ΒΆ
@@ -492,13 +698,48 @@ auto para(O)( obj.indent_base, obj.obj_cite_number, tags, - obj.text + _txt ); } return o; } #+END_SRC +***** scroll + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto para_scroll(O)( + auto return ref const O obj, + string _suffix = ".html", +) { + auto tags = _xhtml_anchor_tags(obj.anchor_tags); + string _txt = inline_markup_scroll(obj, _suffix); // issue + string o = para(obj, _txt); + return o; +} +#+END_SRC + +***** seg + +#+name: xhtml_format_objects +#+BEGIN_SRC d +auto para_seg(O)( + auto return ref const O obj, + string _suffix = ".html", +) { + auto t = inline_markup_seg(obj, _suffix); + string _txt = to!string(t[0]); + string[] _endnotes = t[1]; + string o = para(obj, _txt); + auto u = tuple( + o, + _endnotes, + ); + return u; +} +#+END_SRC + **** nugget #+name: xhtml_format_objects @@ -612,11 +853,12 @@ void scroll(D,I)( auto return ref const D doc_abstraction, auto return ref I doc_matters, ) { - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); string[] doc_html; string[] doc; + string suffix = ".html"; foreach (part; doc_matters.keys_seq_scroll) { foreach (obj; doc_abstraction[part]) { switch (obj.use) { @@ -625,10 +867,10 @@ void scroll(D,I)( case "para": switch (obj.is_a) { case "heading": - doc_html ~= xhtml_format.heading(obj); + doc_html ~= xhtml_format.heading_scroll(obj, suffix); break; case "toc": - doc_html ~= xhtml_format.toc(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -649,10 +891,10 @@ void scroll(D,I)( case "para": switch (obj.is_a) { case "heading": - doc_html ~= xhtml_format.heading(obj); + doc_html ~= xhtml_format.heading_scroll(obj, suffix); break; case "para": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -678,7 +920,7 @@ void scroll(D,I)( doc_html ~= xhtml_format.nugget(obj); break; case "table": - doc_html ~= xhtml_format.para(obj); // + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "code": doc_html ~= xhtml_format.code(obj); @@ -702,22 +944,22 @@ void scroll(D,I)( case "para": switch (obj.is_a) { case "heading": - doc_html ~= xhtml_format.heading(obj); + doc_html ~= xhtml_format.heading_scroll(obj, suffix); break; case "endnote": - doc_html ~= xhtml_format.endnote(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "glossary": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "bibliography": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "bookindex": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "blurb": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -738,6 +980,8 @@ void scroll(D,I)( default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); + writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; } @@ -786,13 +1030,15 @@ void seg(D,I)( auto return ref const D doc_abstraction, auto return ref I doc_matters, ) { - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto rgx = Rgx(); auto xhtml_format = outputXHTMLs(); string[][string] doc_html; + string[][string] doc_html_endnotes; string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; + string suffix = ".html"; foreach (part; doc_matters.keys_seq_seg) { foreach (obj; doc_abstraction[part]) { if (obj.is_a == "heading") { // all headings: frontmatter, body & backmatter @@ -819,7 +1065,8 @@ void seg(D,I)( top_level_headings[3] = ""; goto default; default: - top_level_headings[obj.heading_lev_markup] = xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + top_level_headings[obj.heading_lev_markup] = t[0]; break; } break; @@ -829,10 +1076,14 @@ void seg(D,I)( foreach (top_level_heading; top_level_headings) { doc_html[segment_filename] ~= top_level_heading; } - doc_html[segment_filename] ~= xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); + doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - doc_html[segment_filename] ~= xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); + doc_html_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: // unused numbers, if remain check if ((doc_matters.opt_action_bool["debug"])) { @@ -853,7 +1104,8 @@ void seg(D,I)( case "para": switch (obj.is_a) { case "toc": - doc_html[segment_filename] ~= xhtml_format.toc(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -874,7 +1126,9 @@ void seg(D,I)( case "para": switch (obj.is_a) { case "para": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); + doc_html_endnotes[segment_filename] ~= t[1]; break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -900,7 +1154,9 @@ void seg(D,I)( doc_html[segment_filename] ~= xhtml_format.nugget(obj); break; case "table": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "code": doc_html[segment_filename] ~= xhtml_format.code(obj); @@ -924,19 +1180,28 @@ void seg(D,I)( case "para": switch (obj.is_a) { case "endnote": - doc_html[segment_filename] ~= xhtml_format.endnote(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; break; case "glossary": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "bibliography": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "bookindex": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "blurb": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -963,7 +1228,7 @@ void seg(D,I)( } } } - seg_write_output(doc_matters, doc_html); + seg_write_output(doc_matters, doc_html, doc_html_endnotes); } #+END_SRC @@ -971,14 +1236,15 @@ void seg(D,I)( #+name: output_html_seg #+BEGIN_SRC d -void seg_write_output(M,C)( +void seg_write_output(M,D,E)( M doc_matters, - C doc_html, + D doc_html, + E doc_html_endnotes, ) { debug(asserts){ static assert(is(typeof(doc_html) == string[][string])); } - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto rgx = Rgx(); mixin SiSUpaths; auto pth_html = HtmlPaths(); @@ -993,6 +1259,9 @@ void seg_write_output(M,C)( foreach (docseg; doc_html[seg_filename]) { f.writeln(docseg); } + foreach (docseg; doc_html_endnotes[seg_filename]) { + f.writeln(docseg); + } f.writeln(xhtml_format.tail); // needed for each lev4 } } @@ -1127,403 +1396,403 @@ auto html_css() { p.i8 {padding-left: 8em;} p.i9 {padding-left: 9em;} /* hanging indent */ - p.h0i0 { + p[indent=\"h0i0\"] { padding-left: 0em; text-indent: 0em; } - p.h0i1 { + p[indent=\"h0i1\"] { padding-left: 1em; text-indent: -1em; } - p.h0i2 { + p[indent=\"h0i2\"] { padding-left: 2em; text-indent: -2em; } - p.h0i3 { + p[indent=\"h0i3\"] { padding-left: 3em; text-indent: -3em; } - p.h0i4 { + p[indent=\"h0i4\"] { padding-left: 4em; text-indent: -4em; } - p.h0i5 { + p[indent=\"h0i5\"] { padding-left: 5em; text-indent: -5em; } - p.h0i6 { + p[indent=\"h0i6\"] { padding-left: 6em; text-indent: -6em; } - p.h0i7 { + p[indent=\"h0i7\"] { padding-left: 7em; text-indent: -7em; } - p.h0i8 { + p[indent=\"h0i8\"] { padding-left: 8em; text-indent: -8em; } - p.h0i9 { + p[indent=\"h0i9\"] { padding-left: 9em; text-indent: -9em; } - p.h1i0 { + p[indent=\"h1i0\"] { padding-left: 0em; text-indent: 1em; } - p.h1i1 { + p[indent=\"h1i1\"] { padding-left: 1em; text-indent: 0em; } - p.h1i2 { + p[indent=\"h1i2\"] { padding-left: 2em; text-indent: -1em; } - p.h1i3 { + p[indent=\"h1i3\"] { padding-left: 3em; text-indent: -2em; } - p.h1i4 { + p[indent=\"h1i4\"] { padding-left: 4em; text-indent: -3em; } - p.h1i5 { + p[indent=\"h1i5\"] { padding-left: 5em; text-indent: -4em; } - p.h1i6 { + p[indent=\"h1i6\"] { padding-left: 6em; text-indent: -5em; } - p.h1i7 { + p[indent=\"h1i7\"] { padding-left: 7em; text-indent: -6em; } - p.h1i8 { + p[indent=\"h1i8\"] { padding-left: 8em; text-indent: -7em; } - p.h1i9 { + p[indent=\"h1i9\"] { padding-left: 9em; text-indent: -8em; } - p.h2i0 { + p[indent=\"h2i0\"] { padding-left: 0em; text-indent: 2em; } - p.h2i1 { + p[indent=\"h2i1\"] { padding-left: 1em; text-indent: 1em; } - p.h2i2 { + p[indent=\"h2i2\"] { padding-left: 2em; text-indent: 0em; } - p.h2i3 { + p[indent=\"h2i3\"] { padding-left: 3em; text-indent: -1em; } - p.h2i4 { + p[indent=\"h2i4\"] { padding-left: 4em; text-indent: -2em; } - p.h2i5 { + p[indent=\"h2i5\"] { padding-left: 5em; text-indent: -3em; } - p.h2i6 { + p[indent=\"h2i6\"] { padding-left: 6em; text-indent: -4em; } - p.h2i7 { + p[indent=\"h2i7\"] { padding-left: 7em; text-indent: -5em; } - p.h2i8 { + p[indent=\"h2i8\"] { padding-left: 8em; text-indent: -6em; } - p.h2i9 { + p[indent=\"h2i9\"] { padding-left: 9em; text-indent: -7em; } - p.h3i0 { + p[indent=\"h3i0\"] { padding-left: 0em; text-indent: 3em; } - p.h3i1 { + p[indent=\"h3i1\"] { padding-left: 1em; text-indent: 2em; } - p.h3i2 { + p[indent=\"h3i2\"] { padding-left: 2em; text-indent: 1em; } - p.h3i3 { + p[indent=\"h3i3\"] { padding-left: 3em; text-indent: 0em; } - p.h3i4 { + p[indent=\"h3i4\"] { padding-left: 4em; text-indent: -1em; } - p.h3i5 { + p[indent=\"h3i5\"] { padding-left: 5em; text-indent: -2em; } - p.h3i6 { + p[indent=\"h3i6\"] { padding-left: 6em; text-indent: -3em; } - p.h3i7 { + p[indent=\"h3i7\"] { padding-left: 7em; text-indent: -4em; } - p.h3i8 { + p[indent=\"h3i8\"] { padding-left: 8em; text-indent: -5em; } - p.h3i9 { + p[indent=\"h3i9\"] { padding-left: 9em; text-indent: -6em; } - p.h4i0 { + p[indent=\"h4i0\"] { padding-left: 0em; text-indent: 4em; } - p.h4i1 { + p[indent=\"h4i1\"] { padding-left: 1em; text-indent: 3em; } - p.h4i2 { + p[indent=\"h4i2\"] { padding-left: 2em; text-indent: 2em; } - p.h4i3 { + p[indent=\"h4i3\"] { padding-left: 3em; text-indent: 1em; } - p.h4i4 { + p[indent=\"h4i4\"] { padding-left: 4em; text-indent: 0em; } - p.h4i5 { + p[indent=\"h4i5\"] { padding-left: 5em; text-indent: -1em; } - p.h4i6 { + p[indent=\"h4i6\"] { padding-left: 6em; text-indent: -2em; } - p.h4i7 { + p[indent=\"h4i7\"] { padding-left: 7em; text-indent: -3em; } - p.h4i8 { + p[indent=\"h4i8\"] { padding-left: 8em; text-indent: -4em; } - p.h4i9 { + p[indent=\"h4i9\"] { padding-left: 9em; text-indent: -5em; } - p.h5i0 { + p[indent=\"h5i0\"] { padding-left: 0em; text-indent: 5em; } - p.h5i1 { + p[indent=\"h5i1\"] { padding-left: 1em; text-indent: 4em; } - p.h5i2 { + p[indent=\"h5i2\"] { padding-left: 2em; text-indent: 3em; } - p.h5i3 { + p[indent=\"h5i3\"] { padding-left: 3em; text-indent: 2em; } - p.h5i4 { + p[indent=\"h5i4\"] { padding-left: 4em; text-indent: 1em; } - p.h5i5 { + p[indent=\"h5i5\"] { padding-left: 5em; text-indent: 0em; } - p.h5i6 { + p[indent=\"h5i6\"] { padding-left: 6em; text-indent: -1em; } - p.h5i7 { + p[indent=\"h5i7\"] { padding-left: 7em; text-indent: -2em; } - p.h5i8 { + p[indent=\"h5i8\"] { padding-left: 8em; text-indent: -3em; } - p.h5i9 { + p[indent=\"h5i9\"] { padding-left: 9em; text-indent: -4em; } - p.h6i0 { + p[indent=\"h6i0\"] { padding-left: 0em; text-indent: 6em; } - p.h6i1 { + p[indent=\"h6i1\"] { padding-left: 1em; text-indent: 5em; } - p.h6i2 { + p[indent=\"h6i2\"] { padding-left: 2em; text-indent: 4em; } - p.h6i3 { + p[indent=\"h6i3\"] { padding-left: 3em; text-indent: 3em; } - p.h6i4 { + p[indent=\"h6i4\"] { padding-left: 4em; text-indent: 2em; } - p.h6i5 { + p[indent=\"h6i5\"] { padding-left: 5em; text-indent: 1em; } - p.h6i6 { + p[indent=\"h6i6\"] { padding-left: 6em; text-indent: 0em; } - p.h6i7 { + p[indent=\"h6i7\"] { padding-left: 7em; text-indent: -1em; } - p.h6i8 { + p[indent=\"h6i8\"] { padding-left: 8em; text-indent: -2em; } - p.h6i9 { + p[indent=\"h6i9\"] { padding-left: 9em; text-indent: -3em; } - p.h7i0 { + p[indent=\"h7i0\"] { padding-left: 0em; text-indent: 7em; } - p.h7i1 { + p[indent=\"h7i1\"] { padding-left: 1em; text-indent: 6em; } - p.h7i2 { + p[indent=\"h7i2\"] { padding-left: 2em; text-indent: 5em; } - p.h7i3 { + p[indent=\"h7i3\"] { padding-left: 3em; text-indent: 4em; } - p.h7i4 { + p[indent=\"h7i4\"] { padding-left: 4em; text-indent: 3em; } - p.h7i5 { + p[indent=\"h7i5\"] { padding-left: 5em; text-indent: 2em; } - p.h7i6 { + p[indent=\"h7i6\"] { padding-left: 6em; text-indent: 1em; } - p.h7i7 { + p[indent=\"h7i7\"] { padding-left: 7em; text-indent: 0em; } - p.h7i8 { + p[indent=\"h7i8\"] { padding-left: 8em; text-indent: -1em; } - p.h7i9 { + p[indent=\"h7i9\"] { padding-left: 9em; text-indent: -2em; } - p.h8i0 { + p[indent=\"h8i0\"] { padding-left: 0em; text-indent: 8em; } - p.h8i1 { + p[indent=\"h8i1\"] { padding-left: 1em; text-indent: 7em; } - p.h8i2 { + p[indent=\"h8i2\"] { padding-left: 2em; text-indent: 6em; } - p.h8i3 { + p[indent=\"h8i3\"] { padding-left: 3em; text-indent: 5em; } - p.h8i4 { + p[indent=\"h8i4\"] { padding-left: 4em; text-indent: 4em; } - p.h8i5 { + p[indent=\"h8i5\"] { padding-left: 5em; text-indent: 3em; } - p.h8i6 { + p[indent=\"h8i6\"] { padding-left: 6em; text-indent: 2em; } - p.h8i7 { + p[indent=\"h8i7\"] { padding-left: 7em; text-indent: 1em; } - p.h8i8 { + p[indent=\"h8i8\"] { padding-left: 8em; text-indent: 0em; } - p.h8i9 { + p[indent=\"h8i9\"] { padding-left: 9em; text-indent: -1em; } - p.h9i0 { + p[indent=\"h9i0\"] { padding-left: 0em; text-indent: 9em; } - p.h9i1 { + p[indent=\"h9i1\"] { padding-left: 1em; text-indent: 8em; } - p.h9i2 { + p[indent=\"h9i2\"] { padding-left: 2em; text-indent: 7em; } - p.h9i3 { + p[indent=\"h9i3\"] { padding-left: 3em; text-indent: 6em; } - p.h9i4 { + p[indent=\"h9i4\"] { padding-left: 4em; text-indent: 5em; } - p.h9i5 { + p[indent=\"h9i5\"] { padding-left: 5em; text-indent: 4em; } - p.h9i6 { + p[indent=\"h9i6\"] { padding-left: 6em; text-indent: 3em; } - p.h9i7 { + p[indent=\"h9i7\"] { padding-left: 7em; text-indent: 2em; } - p.h9i8 { + p[indent=\"h9i8\"] { padding-left: 8em; text-indent: 1em; } - p.h9i9 { + p[indent=\"h9i9\"] { padding-left: 9em; text-indent: 0em; } @@ -2498,11 +2767,12 @@ void outputEPub(D,I)( auto return ref const D doc_abstraction, auto return ref I doc_matters, ) { - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); // string[] toc; string[][string] doc_epub; + string[][string] doc_epub_endnotes; string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; @@ -2510,6 +2780,7 @@ void outputEPub(D,I)( auto meta_inf_container_xml = epub_container_xml; auto oebps_toc_ncx = epub_oebps_toc(doc_abstraction, doc_matters); auto oebps_content_opf = epub_oebps_content(doc_abstraction, doc_matters); + string suffix = ".xhtml"; foreach (part; doc_matters.keys_seq_seg) { foreach (obj; doc_abstraction[part]) { if (obj.is_a == "heading") { @@ -2536,7 +2807,8 @@ void outputEPub(D,I)( top_level_headings[3] = ""; goto default; default: - top_level_headings[obj.heading_lev_markup] = xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + top_level_headings[obj.heading_lev_markup] = t[0]; break; } break; @@ -2546,10 +2818,14 @@ void outputEPub(D,I)( foreach (top_level_heading; top_level_headings) { doc_epub[segment_filename] ~= top_level_heading; } - doc_epub[segment_filename] ~= xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; + doc_epub_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - doc_epub[segment_filename] ~= xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; + doc_epub_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: // unused numbers, if remain check if ((doc_matters.opt_action_bool["debug"])) { @@ -2591,7 +2867,9 @@ void outputEPub(D,I)( case "para": switch (obj.is_a) { case "para": - doc_epub[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; + doc_epub_endnotes[segment_filename] ~= t[1]; break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -2617,7 +2895,9 @@ void outputEPub(D,I)( doc_epub[segment_filename] ~= xhtml_format.nugget(obj); break; case "table": - doc_epub[segment_filename] ~= xhtml_format.para(obj); // + 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); @@ -2641,19 +2921,28 @@ void outputEPub(D,I)( case "para": switch (obj.is_a) { case "endnote": - doc_epub[segment_filename] ~= xhtml_format.endnote(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; break; case "glossary": - doc_epub[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; + doc_epub_endnotes[segment_filename] ~= t[1]; break; case "bibliography": - doc_epub[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; + doc_epub_endnotes[segment_filename] ~= t[1]; break; case "bookindex": - doc_epub[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; + doc_epub_endnotes[segment_filename] ~= t[1]; break; case "blurb": - doc_epub[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_epub[segment_filename] ~= t[0]; + doc_epub_endnotes[segment_filename] ~= t[1]; break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -2683,6 +2972,7 @@ void outputEPub(D,I)( epub_write_output_files( doc_matters, doc_epub, + doc_epub_endnotes, mimetypes, meta_inf_container_xml, oebps_toc_ncx, @@ -2695,13 +2985,14 @@ void outputEPub(D,I)( #+name: output_epub_xhtml_seg #+BEGIN_SRC d -void epub_write_output_files(C,EpD,Mt,Mic,Ot,Oc)( - C doc_matters, - EpD doc_epub, - Mt mimetypes, - Mic meta_inf_container_xml, - Ot oebps_toc_ncx, - Oc oebps_content_opf, +void epub_write_output_files(M,D,E,Mt,Mic,Ot,Oc)( + M doc_matters, + D doc_epub, + E doc_epub_endnotes, + Mt mimetypes, + Mic meta_inf_container_xml, + Ot oebps_toc_ncx, + Oc oebps_content_opf, ) { debug(asserts){ static assert(is(typeof(doc_epub) == string[][string])); @@ -2730,6 +3021,9 @@ void epub_write_output_files(C,EpD,Mt,Mic,Ot,Oc)( foreach (docseg; doc_epub[seg_filename]) { f.writeln(docseg); } + foreach (docseg; doc_epub_endnotes[seg_filename]) { + f.writeln(docseg); + } f.writeln(xhtml_format.tail); // needed for each lev4 } /+ mimetypes +/ -- cgit v1.2.3