diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2023-06-26 16:30:25 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2023-06-27 17:12:48 -0400 |
commit | 61180130e90b43f057369878d2d53605f41f8374 (patch) | |
tree | 96a5d8a33b69818b43c7d47d191cf17a4d797be5 /org | |
parent | replace some instances of dir listing, index.html (diff) |
html links and metadata, fixes & cosmetic work
Diffstat (limited to 'org')
-rw-r--r-- | org/out_curate_metadata.org | 14 | ||||
-rw-r--r-- | org/out_metadata.org | 52 | ||||
-rw-r--r-- | org/out_xmls.org | 138 |
3 files changed, 130 insertions, 74 deletions
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) { <html> <head> <meta charset="utf-8"> -<title>⌘ Curated metadata - Topics</title> +<title>⌘ Curated metadata - ⌘ Topics</title> #+END_SRC *** curated topics html head @@ -230,11 +230,11 @@ foreach(k, doc_curate; hvst.curates) { <a name="top" id="top"></a> <a name="up" id="up"></a> <a name="start" id="start"></a> -<h1>⌘ Curated metadata - Topics (output organised by language & filetype)</h1> +<h1>⌘ Curated metadata - ⌘ Topics (output organised by language & filetype)</h1> <div class="flex-menu-bar"> <div class="flex-menu-option"> -<p>[<a href="../../index.html"> ≅ HOME </a>] - [<a href="authors.html"> ⌘ Curated metadata - Authors </a>] +<p>[<a href="../../index.html"> ⟰ HOME </a> | <a href="../index.html"> ≅ Collection </a>] + [<a href="authors.html"> ⌘ Curated metadata - 🖋 Authors </a>] </p> </div> %s @@ -513,7 +513,7 @@ template spineMetaDocCuratesAuthors() { <html> <head> <meta charset="utf-8"> -<title>⌘ Curated metadata - Authors</title> +<title>⌘ Curated metadata - 🖋 Authors</title> #+END_SRC *** curated authors html head @@ -525,11 +525,11 @@ template spineMetaDocCuratesAuthors() { <a name="top" id="top"></a> <a name="up" id="up"></a> <a name="start" id="start"></a> -<h1>⌘ Curated metadata - Authors (output organised by language & filetype)</h1> +<h1>⌘ Curated metadata - 🖋 Authors (output organised by language & filetype)</h1> <div class="flex-menu-bar"> <div class="flex-menu-option"> <p>[<a href="../../index.html"> ⟰ HOME </a> | <a href="../index.html"> ≅ Collection </a>] - [<a href="topics.html"> ⌘ Curated metadata - Topics </a>] </p> + [<a href="topics.html"> ⌘ Curated metadata - ⌘ Topics </a>] </p> </div> %s </div> 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_ ~= "<p class=\"lev1\">Published: " ~ doc_matters.conf_make_meta.meta.date_published ~ "</p>"; if (!(doc_matters.conf_make_meta.meta.rights_copyright.empty)) { - metadata_ ~= "<p class=\"lev1\">Copyright: " ~ doc_matters.conf_make_meta.meta.rights_copyright ~ "</p>"; + metadata_ ~= "<p class=\"lev1\">Copyright: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright) ~ "</p>"; } 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_ ~= "<p class=\"lev1\">License: " ~ doc_matters.conf_make_meta.meta.rights_license ~ "</p>"; + metadata_ ~= "<p class=\"lev1\">License: " ~ special_characters_text(doc_matters.conf_make_meta.meta.rights_license) ~ "</p>"; } 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_ ~= "<hr /><p class=\"lev0\">Summary:</p><p class=\"lev1\">" ~ doc_matters.conf_make_meta.meta.notes_summary ~ "</p>"; + metadata_ ~= "<hr /><p class=\"lev0\">Summary:</p><p class=\"lev1\">" ~ special_characters_text(doc_matters.conf_make_meta.meta.notes_summary) ~ "</p>"; } else if (doc_matters.opt.action.debug_do) { writeln("WARNING no summary of text provided in document header ", doc_matters.src.filename_base); } metadata_ ~= "<hr /><p class=\"lev1\">source: " ~ doc_matters.src.filename_base ~ "</p>"; if (doc_matters.opt.action.html_link_markup_source) { - metadata_ ~= "<p class=\"lev1\">● markup source: [<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ ".zip\">" - ~ " zipped pod </a>] " - ~ "[<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "/\">" - ~ " pod tree </a>]"; + metadata_ ~= "<p class=\"lev1\">● markup source: the pod [<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ ".zip\">" + ~ " 🫛 zipped </a>| " + ~ "<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "/\">" + ~ " 🫛 tree </a>] "; } -metadata_ ~= "<p class=\"lev1\">● outputs: [<a href=\"" ~ doc_matters.src.filename_base ~ ".html\">" - ~ " ▤ html scroll </a>] " - ~ "[<a href=\"" ~ doc_matters.src.filename_base ~ "/toc.html\">" - ~ " ※ html seg </a>]" +metadata_ ~= "<p class=\"lev1\">● outputs: [ html: <a href=\"" ~ doc_matters.src.filename_base ~ ".html\">" + ~ " ▤ scroll </a> " + ~ "|<a href=\"" ~ doc_matters.src.filename_base ~ "/toc.html\">" + ~ " ※ seg </a>] " ~ "[<a href=\"../../" ~ pth_epub.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "." ~ doc_matters.src.language ~ ".epub\">" - ~ " ◆ epub </a>]"; + ~ " ◆ epub </a>] "; if ((doc_matters.opt.action.html_link_pdf) || (doc_matters.opt.action.html_link_pdf_a4)) { + metadata_ ~= "[ pdf: <a href=\"../../pdf/" + ~ doc_matters.src.filename_base + ~ "." ~ doc_matters.src.language ~ ".a4.portrait.pdf\">" + ~ " □ a4 </a> " + ~ "|<a href=\"../../pdf/" + ~ doc_matters.src.filename_base + ~ "." ~ doc_matters.src.language ~ ".letter.portrait.pdf\">" + ~ " □ U.S. letter </a>] "; +} else if (doc_matters.opt.action.html_link_pdf_a4) { metadata_ ~= "[<a href=\"../../pdf/" ~ doc_matters.src.filename_base ~ "." ~ doc_matters.src.language ~ ".a4.portrait.pdf\">" - ~ " □ pdf (a4) </a>]"; -} -if ((doc_matters.opt.action.html_link_pdf) || (doc_matters.opt.action.html_link_pdf_letter)) { + ~ " □ pdf (a4) </a>] "; +} else if (doc_matters.opt.action.html_link_pdf_letter) { metadata_ ~= "[<a href=\"../../pdf/" ~ doc_matters.src.filename_base ~ "." ~ doc_matters.src.language ~ ".letter.portrait.pdf\">" - ~ " □ pdf (U.S. letter) </a>]"; + ~ " □ pdf (U.S. letter) </a>] "; } metadata_ ~= "</p>"; 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, "<br />") + .replaceAll(rgx.br_line_inline, "<br />") + .replaceAll(rgx.br_line_spaced, "<br />\n<br />") + .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"┃<p class="small"><a href="%s">⟰ </a> [<a href="%s"> %s </a><a href="%sepub/%s.%s.epub"> ◆ </a>%s%s<a href="%smetadata.%s.html"> ⌘• </a>] <a href="%s../../index.html"> ≅ </a>|<a href="%s../../authors.html"> 🖋 </a>|<a href="%s../../topics.html"> ⌘ </a>|</p>┃", + ? format(q"┃<p class="small"><a href="%s">⟰ </a> [<a href="%s"> %s </a><a href="%sepub/%s.%s.epub"> ◆ </a>%s%s<a href="%smetadata.%s.html"> ℹ </a>] <a href="%s../../index.html"> ≅ </a>|<a href="%s../../authors.html"> 🖋 </a>|<a href="%s../../topics.html"> ⌘ </a>|</p>┃", (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() { <<output_imports_xml>> mixin outputXHTMLs; - <<output_html_scroll_0>> + @safe void scroll(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + <<output_html_scroll_0>> <<output_html_scroll_loop_parts>> <<output_html_scroll_is_frontmatter>> <<output_html_scroll_is_body>> <<output_html_scroll_is_backmatter>> - <<output_html_scroll_close_is_case>> + <<output_html_scroll_close_is_case>> + } <<output_html_scroll_scroll_write_output>> - <<output_html_seg_0>> + @safe void seg(D,M)( + const D doc_abstraction, + M doc_matters, + ) { + <<output_html_seg_0>> <<output_html_seg_loop_parts>> <<output_html_seg_is_heading>> <<output_html_seg_is_not_heading_switch>> <<output_html_seg_is_frontmatter>> <<output_html_seg_is_body>> <<output_html_seg_is_backmatter>> - <<output_html_seg_close_is_case>> + <<output_html_seg_close_is_case>> + } <<output_html_seg_write_output>> <<output_html_css>> <<copy_html_images>> @@ -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) { |