From 61180130e90b43f057369878d2d53605f41f8374 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 26 Jun 2023 16:30:25 -0400 Subject: html links and metadata, fixes & cosmetic work --- org/out_xmls.org | 138 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 49 deletions(-) (limited to 'org/out_xmls.org') diff --git a/org/out_xmls.org b/org/out_xmls.org index 33f2213..943d588 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -66,6 +66,22 @@ template htmlSnippet() { ); return html_blank_default; } + @safe string special_characters_text(string _txt) { + mixin spineRgxOut; + mixin spineRgxXHTML; + static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); + _txt = _txt + .replaceAll(rgx_xhtml.ampersand, "&") // "&" + .replaceAll(rgx_xhtml.quotation, """) // """ + .replaceAll(rgx_xhtml.less_than, "<") // "<" + .replaceAll(rgx_xhtml.greater_than, ">") // ">" + .replaceAll(rgx.br_line, "
") + .replaceAll(rgx.br_line_inline, "
") + .replaceAll(rgx.br_line_spaced, "
\n
") + .replaceAll(rgx.nbsp_char, " "); + return _txt; + } } #+END_SRC @@ -485,7 +501,7 @@ import ) { string o; string metadata_links = ((doc_matters.opt.action.html_link_curate) - ? format(q"┃

⟰  [ %s  ◆ %s%s ⌘• ]   ≅ | 🖋 | ⌘ |

┃", + ? format(q"┃

⟰  [ %s  ◆ %s%s ℹ ]   ≅ | 🖋 | ⌘ |

┃", (doc_matters.opt.action.webserver_url_doc_root.length > 0) ? doc_matters.opt.action.webserver_url_doc_root : doc_matters.conf_make_meta.conf.w_srv_data_root_url @@ -1810,21 +1826,31 @@ module doc_reform.io_out.html; template outputHTML() { <> mixin outputXHTMLs; - <> + @safe void scroll(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + <> <> <> <> <> - <> + <> + } <> - <> + @safe void seg(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + <> <> <> <> <> <> <> - <> + <> + } <> <> <> @@ -1836,20 +1862,16 @@ template outputHTML() { #+NAME: output_html_scroll_0 #+BEGIN_SRC d -@safe void scroll(D,M)( - const D doc_abstraction, - M doc_matters, -) { - mixin spineRgxOut; - mixin spineRgxXHTML; - auto xhtml_format = outputXHTMLs(); - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - string[] doc_html; - string[] doc; - string suffix = ".html"; - string previous_section = ""; - string delimit = ""; +mixin spineRgxOut; +mixin spineRgxXHTML; +auto xhtml_format = outputXHTMLs(); +static auto rgx = RgxO(); +static auto rgx_xhtml = RgxXHTML(); +string[] doc_html; +string[] doc; +string suffix = ".html"; +string previous_section = ""; +string delimit = ""; #+END_SRC **** ↻ the loops & outer switch (sections & objects) format output @@ -2027,15 +2049,14 @@ default: #+NAME: output_html_scroll_close_is_case #+BEGIN_SRC d - } } } - doc = xhtml_format.html_head(doc_matters, "scroll") - ~ doc_html - ~ xhtml_format.dom_close - ~ xhtml_format.tail(doc_matters); - scroll_write_output(doc, doc_matters); } +doc = xhtml_format.html_head(doc_matters, "scroll") +~ doc_html +~ xhtml_format.dom_close +~ xhtml_format.tail(doc_matters); +scroll_write_output(doc, doc_matters); #+END_SRC *** write output file @@ -2061,8 +2082,14 @@ default: } } if (!exists(pth_html.base ~ "/index.html")) { + import doc_reform.io_out.html_snippet; + mixin htmlSnippet; auto f = File(pth_html.base ~"/index.html", "w"); - f.writeln(""); + f.writeln(format_html_blank_page_guide_home( + "../../css/html_scroll.css", + "https://sisudoc.org", + "../../index.html", + )); } } catch (ErrnoException ex) { // Handle error @@ -2078,24 +2105,20 @@ default: #+NAME: output_html_seg_0 #+BEGIN_SRC d -@safe void seg(D,M)( - const D doc_abstraction, - M doc_matters, -) { - mixin spineRgxOut; - mixin spineRgxXHTML; - static auto rgx = RgxO(); - static auto rgx_xhtml = RgxXHTML(); - auto xhtml_format = outputXHTMLs(); - string[][string] doc_html; - string[][string] doc_html_endnotes; - string[] doc; - string segment_filename; - string[] top_level_headings = ["","","",""]; - string previous_seg_filename = ""; - string suffix = ".html"; - string previous_section = ""; - string delimit = ""; +mixin spineRgxOut; +mixin spineRgxXHTML; +static auto rgx = RgxO(); +static auto rgx_xhtml = RgxXHTML(); +auto xhtml_format = outputXHTMLs(); +string[][string] doc_html; +string[][string] doc_html_endnotes; +string[] doc; +string segment_filename; +string[] top_level_headings = ["","","",""]; +string previous_seg_filename = ""; +string suffix = ".html"; +string previous_section = ""; +string delimit = ""; #+END_SRC **** ↻ the loop (sections & objects) format output @@ -2365,11 +2388,10 @@ default: #+NAME: output_html_seg_close_is_case #+BEGIN_SRC d - } } } - seg_write_output(doc_html, doc_html_endnotes, doc_matters); } +seg_write_output(doc_html, doc_html_endnotes, doc_matters); #+END_SRC *** write output files @@ -2433,8 +2455,14 @@ default: f.writeln(css.html_scroll); } if (!exists(pth_html.css ~ "/index.html")) { + import doc_reform.io_out.html_snippet; + mixin htmlSnippet; auto f = File(pth_html.css ~"/index.html", "w"); - f.writeln(""); + f.writeln(format_html_blank_page_guide_home( + "./css/html_scroll.css", + "https://sisudoc.org", + "../index.html", + )); } } catch (ErrnoException ex) { // Handle error @@ -2469,8 +2497,14 @@ default: } } if (!exists(pth_html.image ~ "/index.html")) { + import doc_reform.io_out.html_snippet; + mixin htmlSnippet; auto f = File(pth_html.image ~"/index.html", "w"); - f.writeln(""); + f.writeln(format_html_blank_page_guide_home( + "../css/html_scroll.css", + "https://sisudoc.org", + "../index.html", + )); } } } @@ -3204,8 +3238,14 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS pth_epub3.base.mkdirRecurse; } if (!exists(pth_epub3.base ~ "/index.html")) { + import doc_reform.io_out.html_snippet; + mixin htmlSnippet; auto f = File(pth_epub3.base ~"/index.html", "w"); - f.writeln(""); + f.writeln(format_html_blank_page_guide_home( + "../../css/html_scroll.css", + "https://sisudoc.org", + "../../index.html", + )); } { /+ debug +/ if (doc_matters.opt.action.debug_do_epub) { -- cgit v1.2.3