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_curate_metadata.org | 14 ++--- org/out_metadata.org | 52 +++++++++++------ org/out_xmls.org | 138 ++++++++++++++++++++++++++++---------------- 3 files changed, 130 insertions(+), 74 deletions(-) (limited to 'org') diff --git a/org/out_curate_metadata.org b/org/out_curate_metadata.org index e06ea5c..0dd74cd 100644 --- a/org/out_curate_metadata.org +++ b/org/out_curate_metadata.org @@ -218,7 +218,7 @@ foreach(k, doc_curate; hvst.curates) { -⌘ Curated metadata - Topics +⌘ Curated metadata - ⌘ Topics #+END_SRC *** curated topics html head @@ -230,11 +230,11 @@ foreach(k, doc_curate; hvst.curates) { -

⌘ Curated metadata - Topics (output organised by language & filetype)

+

⌘ Curated metadata - ⌘ Topics (output organised by language & filetype)

%s @@ -513,7 +513,7 @@ template spineMetaDocCuratesAuthors() { -⌘ Curated metadata - Authors +⌘ Curated metadata - 🖋 Authors #+END_SRC *** curated authors html head @@ -525,11 +525,11 @@ template spineMetaDocCuratesAuthors() { -

⌘ Curated metadata - Authors (output organised by language & filetype)

+

⌘ Curated metadata - 🖋 Authors (output organised by language & filetype)

diff --git a/org/out_metadata.org b/org/out_metadata.org index 84c374c..5990f16 100644 --- a/org/out_metadata.org +++ b/org/out_metadata.org @@ -59,13 +59,15 @@ string[] metadata_; #+NAME: output_metadata #+BEGIN_SRC d static auto mkup = InlineMarkup(); +import doc_reform.io_out.html_snippet; +mixin htmlSnippet; if (doc_matters.opt.action.debug_do) { writeln(doc_matters.src.filename_base); writeln("Title: ", doc_matters.conf_make_meta.meta.title_full); writeln(" Author: ", doc_matters.conf_make_meta.meta.creator_author); writeln(" Published: ", doc_matters.conf_make_meta.meta.date_published); writeln(" Copyright: ", doc_matters.conf_make_meta.meta.rights_copyright); - writeln(" License: ", doc_matters.conf_make_meta.meta.rights_license); + writeln(" License: ", special_characters_text(doc_matters.conf_make_meta.meta.rights_license)); if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr.sort!("toUpper(a) < toUpper(b)", SwapStrategy.unstable)) { string[] subject_tree = topic.split(mkup.sep); @@ -120,44 +122,52 @@ if (!(doc_matters.conf_make_meta.meta.creator_author.empty)) { } metadata_ ~= "

Published: " ~ doc_matters.conf_make_meta.meta.date_published ~ "

"; if (!(doc_matters.conf_make_meta.meta.rights_copyright.empty)) { - metadata_ ~= "

Copyright: " ~ doc_matters.conf_make_meta.meta.rights_copyright ~ "

"; + metadata_ ~= "

Copyright: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright) ~ "

"; } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt2) { writeln("WARNING no Copyright information provided in document header ", doc_matters.src.filename_base); } if (!(doc_matters.conf_make_meta.meta.rights_license.empty)) { - metadata_ ~= "

License: " ~ doc_matters.conf_make_meta.meta.rights_license ~ "

"; + metadata_ ~= "

License: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_license) ~ "

"; } else if (doc_matters.opt.action.debug_do || doc_matters.opt.action.vox_gt2) { writeln("WARNING no License information provided in document header ", doc_matters.src.filename_base); } if (!(doc_matters.conf_make_meta.meta.notes_summary.empty)) { - metadata_ ~= "

Summary:

" ~ doc_matters.conf_make_meta.meta.notes_summary ~ "

"; + metadata_ ~= "

Summary:

" ~ special_characters_text(doc_matters.conf_make_meta.meta.notes_summary) ~ "

"; } else if (doc_matters.opt.action.debug_do) { writeln("WARNING no summary of text provided in document header ", doc_matters.src.filename_base); } metadata_ ~= "

source: " ~ doc_matters.src.filename_base ~ "

"; if (doc_matters.opt.action.html_link_markup_source) { - metadata_ ~= "

● markup source: [" - ~ " zipped pod ] " - ~ "[" - ~ " pod tree ]"; + metadata_ ~= "

●  markup source:  the pod [" + ~ " 🫛 zipped | " + ~ "" + ~ " 🫛 tree ] "; } -metadata_ ~= "

● outputs: [" - ~ " ▤ html scroll ] " - ~ "[" - ~ " ※ html seg ]" +metadata_ ~= "

●  outputs:  [ html: " + ~ " ▤ scroll  " + ~ "|" + ~ " ※ seg ]   " ~ "[" - ~ " ◆ epub ]"; + ~ " ◆ epub ]   "; if ((doc_matters.opt.action.html_link_pdf) || (doc_matters.opt.action.html_link_pdf_a4)) { + metadata_ ~= "[ pdf: " + ~ " □ a4  " + ~ "|" + ~ " □ U.S. letter ] "; +} else if (doc_matters.opt.action.html_link_pdf_a4) { metadata_ ~= "[" - ~ " □ pdf (a4) ]"; -} -if ((doc_matters.opt.action.html_link_pdf) || (doc_matters.opt.action.html_link_pdf_letter)) { + ~ " □ pdf (a4) ] "; +} else if (doc_matters.opt.action.html_link_pdf_letter) { metadata_ ~= "[" - ~ " □ pdf (U.S. letter) ]"; + ~ " □ pdf (U.S. letter) ] "; } metadata_ ~= "

"; if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { @@ -277,8 +287,14 @@ metadata_write_output(doc_matters, metadata_); } } 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 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