diff options
Diffstat (limited to 'org/out_xmls.org')
| -rw-r--r-- | org/out_xmls.org | 138 | 
1 files changed, 89 insertions, 49 deletions
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) {  | 
