From 0c693b23c4ff8f98a151884a24f150a5ff746dd4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 16 Oct 2020 19:16:18 -0400 Subject: org mode, unique code-block names & adjust headers - avoid org-mode undefined behavior, provide unique code-block names --- org/out_xmls.org | 217 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 141 insertions(+), 76 deletions(-) (limited to 'org/out_xmls.org') diff --git a/org/out_xmls.org b/org/out_xmls.org index c76e44b..eb83196 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -7,6 +7,7 @@ #+COPYRIGHT: Copyright (C) 2015 - 2020 Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty +#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t #+PROPERTY: header-args :exports code #+PROPERTY: header-args+ :noweb yes #+PROPERTY: header-args+ :eval no @@ -28,7 +29,45 @@ template outputXHTMLs() { mixin spineRgxOut; struct outputXHTMLs { static auto rgx = RgxO(); - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> } } @@ -71,7 +110,7 @@ import *** misc **** div delimiter -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_0 #+BEGIN_SRC d @safe string div_delimit( string part, @@ -107,7 +146,7 @@ import **** special characters text -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_1 #+BEGIN_SRC d @safe string special_characters_text(string _txt) { _txt = _txt @@ -122,7 +161,7 @@ import **** special characters -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_2 #+BEGIN_SRC d @safe string special_characters(O)( const O obj, @@ -138,7 +177,7 @@ import **** font_face -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_3 #+BEGIN_SRC d @safe string font_face(string _txt) { _txt = _txt @@ -158,7 +197,7 @@ import **** anchor tags -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_4 #+BEGIN_SRC d @safe string _xhtml_anchor_tags(O)(O obj) { const(string[]) anchor_tags = obj.tags.anchor_tags; @@ -177,7 +216,7 @@ import **** doc head & tails ***** metadata -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_5 #+BEGIN_SRC d @safe string header_metadata(M)( M doc_matters, @@ -220,7 +259,7 @@ import ***** site info button -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_6 #+BEGIN_SRC d @safe string site_info_button(M)( M doc_matters, @@ -250,7 +289,7 @@ import ***** search form -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_7 #+BEGIN_SRC d @safe string inline_search_form(M)( M doc_matters, @@ -289,7 +328,7 @@ import ***** html head & head banner -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_8 #+BEGIN_SRC d @safe string html_head(M)( M doc_matters, @@ -346,7 +385,7 @@ import ***** epub seg head -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_9 #+BEGIN_SRC d @safe string epub3_seg_head(M)( M doc_matters, @@ -420,7 +459,7 @@ import ***** xhtml tail -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_10 #+BEGIN_SRC d @safe string tail() { string o; @@ -436,7 +475,7 @@ import *** inline markup **** images -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_11 #+BEGIN_SRC d @safe string inline_images(O,M)( string _txt, @@ -469,7 +508,7 @@ import **** links ***** scroll, seg, epub -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_12 #+BEGIN_SRC d @safe string inline_links(O,M)( string _txt, @@ -567,7 +606,7 @@ import **** notes ***** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_13 #+BEGIN_SRC d @safe string inline_notes_scroll(O,M)( string _txt, @@ -604,7 +643,7 @@ import ***** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_14 #+BEGIN_SRC d @safe Tuple!(string, string[]) inline_notes_seg(O,M)( string _txt, @@ -675,7 +714,7 @@ import **** inline markup ***** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_15 #+BEGIN_SRC d @safe string inline_markup_scroll(O,M)( string _txt, @@ -697,7 +736,7 @@ import ***** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_16 #+BEGIN_SRC d @safe auto inline_markup_seg(O,M)( string _txt, @@ -724,7 +763,7 @@ import *** toc **** subtoc -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_17 #+BEGIN_SRC d @safe string lev4_heading_subtoc(O,M)( const O obj, @@ -757,7 +796,7 @@ import **** navigation pre next svg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_18 #+BEGIN_SRC d @safe auto nav_pre_next_svg(O,M)( const O obj, @@ -838,7 +877,7 @@ import *** heading **** heading -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_19 #+BEGIN_SRC d @safe string heading(O,M)( string _txt, @@ -909,7 +948,7 @@ import **** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_20 #+BEGIN_SRC d @safe string heading_scroll(O,M)( string _txt, @@ -925,7 +964,7 @@ import **** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_21 #+BEGIN_SRC d @safe Tuple!(string, string[]) heading_seg(O,M)( string _txt, @@ -949,7 +988,7 @@ import *** para **** para -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_22 #+BEGIN_SRC d @safe string para(O,M)( string _txt, @@ -1005,7 +1044,7 @@ import **** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_23 #+BEGIN_SRC d @safe string para_scroll(O,M)( string _txt, @@ -1024,7 +1063,7 @@ import **** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_24 #+BEGIN_SRC d @safe Tuple!(string, string[]) para_seg(O,M)( string _txt, @@ -1048,7 +1087,7 @@ import *** quote **** quote -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_25 #+BEGIN_SRC d @safe string quote(O,M)( string _txt, @@ -1090,7 +1129,7 @@ import **** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_26 #+BEGIN_SRC d @safe string quote_scroll(O,M)( string _txt, @@ -1106,7 +1145,7 @@ import **** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_27 #+BEGIN_SRC d @safe Tuple!(string, string[]) quote_seg(O,M)( string _txt, @@ -1130,7 +1169,7 @@ import *** group **** group -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_28 #+BEGIN_SRC d @safe string group(O,M)( string _txt, @@ -1174,7 +1213,7 @@ import **** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_29 #+BEGIN_SRC d @safe string group_scroll(O,M)( string _txt, @@ -1191,7 +1230,7 @@ import **** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_30 #+BEGIN_SRC d @safe Tuple!(string, string[]) group_seg(O,M)( string _txt, @@ -1215,7 +1254,7 @@ import *** block **** block -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_31 #+BEGIN_SRC d @safe string block(O,M)( string _txt, @@ -1255,7 +1294,7 @@ import **** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_32 #+BEGIN_SRC d @safe string block_scroll(O,M)( string _txt, @@ -1272,7 +1311,7 @@ import **** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_33 #+BEGIN_SRC d @safe Tuple!(string, string[]) block_seg(O,M)( string _txt, @@ -1296,7 +1335,7 @@ import *** poem verse **** verse -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_34 #+BEGIN_SRC d @safe string verse(O,M)( string _txt, @@ -1334,7 +1373,7 @@ import **** scroll -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_35 #+BEGIN_SRC d @safe string verse_scroll(O,M)( string _txt, @@ -1351,7 +1390,7 @@ import **** seg -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_36 #+BEGIN_SRC d @safe Tuple!(string, string[]) verse_seg(O,M)( string _txt, @@ -1446,7 +1485,7 @@ align="left|right|center" "style=\"text-align:" ~ "right\"" -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_37 #+BEGIN_SRC d @safe Tuple!(string, string) tablarize(O)( string _txt, @@ -1485,7 +1524,7 @@ align="left|right|center" **** table -#+NAME: xhtml_format_objects +#+NAME: xhtml_format_objects_38 #+BEGIN_SRC d @safe string table(O,M)( string _txt, @@ -1531,8 +1570,22 @@ module doc_reform.io_out.html; template outputHTML() { <> mixin outputXHTMLs; - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> <> } @@ -1541,7 +1594,7 @@ template outputHTML() { ** scroll :scroll: *** ↻ loop & switch (sections & objects) format html output -#+NAME: output_html_scroll +#+NAME: output_html_scroll_0 #+BEGIN_SRC d @safe void scroll(D,M)( const D doc_abstraction, @@ -1559,7 +1612,7 @@ template outputHTML() { **** ↻ the loops & outer switch (sections & objects) format output -#+NAME: output_html_scroll +#+NAME: output_html_scroll_1 #+BEGIN_SRC d foreach (part; doc_matters.has.keys_seq.scroll) { foreach (obj; doc_abstraction[part]) { @@ -1570,7 +1623,7 @@ template outputHTML() { ***** frontmatter -#+NAME: output_html_scroll +#+NAME: output_html_scroll_2 #+BEGIN_SRC d case "frontmatter": assert(part == "head" || "toc"); switch (obj.metainfo.is_of_type) { @@ -1606,7 +1659,7 @@ template outputHTML() { ***** body -#+NAME: output_html_scroll +#+NAME: output_html_scroll_3 #+BEGIN_SRC d case "body": assert(part == "body" || "head"); switch (obj.metainfo.is_of_type) { @@ -1674,7 +1727,7 @@ template outputHTML() { ***** backmatter -#+NAME: output_html_scroll +#+NAME: output_html_scroll_4 #+BEGIN_SRC d case "backmatter": assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -1735,7 +1788,7 @@ template outputHTML() { ***** closings & post loop -#+NAME: output_html_scroll +#+NAME: output_html_scroll_5 #+BEGIN_SRC d } } @@ -1747,7 +1800,7 @@ template outputHTML() { *** write output file -#+NAME: output_html_scroll +#+NAME: output_html_scroll_6 #+BEGIN_SRC d @trusted void scroll_write_output(D,M)( D doc, @@ -1777,7 +1830,7 @@ template outputHTML() { ** seg :seg: *** ↻ loop & switch (sections & objects) format html output -#+NAME: output_html_seg +#+NAME: output_html_seg_0 #+BEGIN_SRC d @safe void seg(D,M)( const D doc_abstraction, @@ -1799,7 +1852,7 @@ template outputHTML() { **** ↻ the loop (sections & objects) format output -#+NAME: output_html_seg +#+NAME: output_html_seg_1 #+BEGIN_SRC d foreach (part; doc_matters.has.keys_seq.seg) { foreach (obj; doc_abstraction[part]) { @@ -1809,7 +1862,7 @@ template outputHTML() { ***** all headings -#+NAME: output_html_seg +#+NAME: output_html_seg_2 #+BEGIN_SRC d if (obj.metainfo.is_a == "heading") { assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -1882,7 +1935,7 @@ template outputHTML() { ***** non-heading -#+NAME: output_html_seg +#+NAME: output_html_seg_3 #+BEGIN_SRC d } else { assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -1891,7 +1944,7 @@ template outputHTML() { ****** frontmatter -#+NAME: output_html_seg +#+NAME: output_html_seg_4 #+BEGIN_SRC d case "frontmatter": assert(part == "head" || "toc"); switch (obj.metainfo.is_of_type) { @@ -1925,7 +1978,7 @@ template outputHTML() { ****** body -#+NAME: output_html_seg +#+NAME: output_html_seg_5 #+BEGIN_SRC d case "body": assert(part == "body"); switch (obj.metainfo.is_of_type) { @@ -2001,7 +2054,7 @@ template outputHTML() { ****** backmatter -#+NAME: output_html_seg +#+NAME: output_html_seg_6 #+BEGIN_SRC d case "backmatter": assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -2067,7 +2120,7 @@ template outputHTML() { ***** closings & post loop -#+NAME: output_html_seg +#+NAME: output_html_seg_7 #+BEGIN_SRC d } } @@ -2078,7 +2131,7 @@ template outputHTML() { *** write output files -#+NAME: output_html_seg +#+NAME: output_html_seg_8 #+BEGIN_SRC d @trusted void seg_write_output(D,E,M)( // @system? D doc_html, @@ -2194,10 +2247,22 @@ template outputEPub3() { <> mixin InternalMarkup; mixin outputXHTMLs; - <> - <> + <> + <> + <> + <> + <> <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> } #+END_SRC @@ -2208,7 +2273,7 @@ template outputEPub3() { - mimetype file indicating that zip file contains an EPUB -#+NAME: output_epub3_fixed +#+NAME: output_epub3_fixed_0 #+BEGIN_SRC d @safe string epub3_mimetypes() { string o; @@ -2221,7 +2286,7 @@ template outputEPub3() { - identifies the root package document (so systems can find it), [unchanged from epub2] -#+NAME: output_epub3_fixed +#+NAME: output_epub3_fixed_1 #+BEGIN_SRC d @safe string epub3_container_xml() { string o; @@ -2243,7 +2308,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> - provides the default reading order - identifies the navigation document -#+NAME: output_epub3_constructs +#+NAME: output_epub3_constructs_0 #+BEGIN_SRC d @safe string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { auto xhtml_format = outputXHTMLs(); @@ -2349,7 +2414,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> - toc_nav.xhtml declared as nav file in content.opf (epub3 navigation document) -#+NAME: output_epub3_constructs +#+NAME: output_epub3_constructs_1 #+BEGIN_SRC d @safe string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { enum DomTags { none, open, close, close_and_open, open_still, } @@ -2437,7 +2502,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> - toc.ncx (epub2 navigation document) - (replaced in epub3 by a declared xhtml nav file, in our case toc_nav.xhtml) -#+NAME: output_epub3_constructs +#+NAME: output_epub3_constructs_2 #+BEGIN_SRC d @safe string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { int counter = 0; @@ -2533,7 +2598,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ** the document contents :seg: *** ↻ loop & switch (sections & objects) format epub3 xhtml output -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_0 #+BEGIN_SRC d @system void outputEPub3(D,I)( const D doc_abstraction, @@ -2564,7 +2629,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> **** ↻ the loop (sections & objects) format output -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_1 #+BEGIN_SRC d foreach (part; doc_matters.has.keys_seq.seg) { foreach (obj; doc_abstraction[part]) { @@ -2573,7 +2638,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ***** all headings -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_2 #+BEGIN_SRC d if (obj.metainfo.is_a == "heading") { assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -2642,7 +2707,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ***** non-heading -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_3 #+BEGIN_SRC d } else { assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -2651,7 +2716,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ****** frontmatter -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_4 #+BEGIN_SRC d case "frontmatter": assert(part == "head" || "toc"); switch (obj.metainfo.is_of_type) { @@ -2686,7 +2751,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ****** body -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_5 #+BEGIN_SRC d case "body": assert(part == "body"); switch (obj.metainfo.is_of_type) { @@ -2762,7 +2827,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ****** backmatter -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_6 #+BEGIN_SRC d case "backmatter": assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); @@ -2873,7 +2938,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ***** closings & post loop -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_7 #+BEGIN_SRC d } } @@ -2890,7 +2955,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ** write output files :write:zip: -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_8 #+BEGIN_SRC d @system void epub3_write_output_files(W,M)( W epub_write, @@ -3086,7 +3151,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> ** zip debug, read zip archive :zip: -#+NAME: output_epub3_xhtml_seg +#+NAME: output_epub3_xhtml_seg_9 #+BEGIN_SRC d debug(epub_archive) { if (exists(fn_epub)) { -- cgit v1.2.3