\n" ;
          break;
        }
        if (previous_part.length > 0) {
          delimit ~= "\n
";
        }
        previous_part = part;
        delimit ~=  delimit_;
      }
      // you also need to close the last div, introduce a footer?
      return delimit;
    }
    string special_characters_text(string _txt) @safe {
      _txt = _txt
        .replaceAll(rgx.xhtml_ampersand,    "&")
        .replaceAll(rgx.xhtml_quotation,    """)
        .replaceAll(rgx.xhtml_less_than,    "<")
        .replaceAll(rgx.xhtml_greater_than, ">")
        .replaceAll(rgx.nbsp_char,          " ");
      return _txt;
    }
    string special_characters(O)(
      const  O         obj,
    ) @safe {
      string _txt = special_characters_text(obj.text);
      if (!(obj.metainfo.is_a == "code")) {
        _txt = (_txt)
          .replaceAll(rgx.xhtml_line_break,   "
");
      }
      return _txt;
    }
    string font_face(string _txt) @safe {
      _txt = _txt
        .replaceAll(rgx.inline_emphasis,    ("
"));
      return _txt;
    }
    string _xhtml_anchor_tags(O)(O obj) @safe {
      const(string[]) anchor_tags = obj.tags.anchor_tags;
      string tags="";
      if (anchor_tags.length > 0) {
        foreach (tag; anchor_tags) {
          if (!(tag.empty)) {
            tags ~= "
";
          }
        }
      }
      return tags;
    }
    string header_metadata(M)(
      M  doc_matters,
    ) @safe {
      string _publisher="Publisher"; // TODO
      string o;
      o = format(q"┃
    
    ┃",
        doc_matters.conf_make_meta.meta.title_full,
        doc_matters.conf_make_meta.meta.creator_author,
        _publisher,
        doc_matters.conf_make_meta.meta.date_published,
        doc_matters.conf_make_meta.meta.date_created,
        doc_matters.conf_make_meta.meta.date_issued,
        doc_matters.conf_make_meta.meta.date_available,
        doc_matters.conf_make_meta.meta.date_valid,
        doc_matters.conf_make_meta.meta.date_modified,
        doc_matters.src.language,
        doc_matters.conf_make_meta.meta.rights_copyright,
        doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version,
        doc_matters.generator_program.url_home,
      );
      return o;
    }
    string site_info_button(M)(
      M  doc_matters,
    ) @safe {
      string _locations;
      if (doc_matters.conf_make_meta.make.home_button_text.length > 0) {
        _locations = (doc_matters.conf_make_meta.make.home_button_text)
          .replaceAll(
            rgx.inline_link,
            ("
"))
          .replaceAll(
            rgx.br_line, "")
          .replaceAll(
            rgx.br_nl, "");
      } else {
         _locations = "
";
      }
      string o;
      o = format(q"┃┃",
        _locations,
      );
      return o;
    }
    string inline_search_form(M)(
      M  doc_matters,
    ) @safe {
      string _action="http://www.sisudoc.org/cgi-bin/search.cgi";
      string _db="spine.7a.manual";
      string o;
      string _form;
      if (doc_matters.opt.action.workon) {
        _form = format(q"┃
    
          ┃",
        _action,
        _db,
        );
      } else {
        _form = format(q"┃%s┃", "");
      }
      o = format(q"┃┃",
        _form,
      );
      return o;
    }
    string html_head(M)(
      M  doc_matters,
      string type,
    ) @safe {
    string _manifest = "";
    if (doc_matters.opt.action.workon) {
      _manifest = format(q"┃
         
         ┃",
      );
    }
      string o;
      o = format(q"┃
    
    
      
      "),
      );
      return o;
    }
    string epub3_seg_head(M)(
      M  doc_matters,
    ) @safe {
      string html_base = format(q"┃
    ┃",
    );
      string html_simple = format(q"┃
    ┃",
        doc_matters.src.language,
        doc_matters.src.language,
      );
      string html_strict = format(q"┃
    ┃",
        doc_matters.src.language,
        doc_matters.src.language,
      );
      string o;
      o = format(q"┃%s
    
      
        %s%s
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
    
    
    ┃",
        html_simple,
        doc_matters.conf_make_meta.meta.title_full,
        (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
          : ", " ~ doc_matters.conf_make_meta.meta.creator_author,
        doc_matters.conf_make_meta.meta.title_full,
        (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
          : ", " ~ doc_matters.conf_make_meta.meta.creator_author,
        doc_matters.conf_make_meta.meta.date_published,
        doc_matters.conf_make_meta.meta.date_created,
        doc_matters.conf_make_meta.meta.date_issued,
        doc_matters.conf_make_meta.meta.date_available,
        doc_matters.conf_make_meta.meta.date_valid,
        doc_matters.conf_make_meta.meta.date_modified,
        doc_matters.src.language,
        doc_matters.conf_make_meta.meta.rights_copyright,
        doc_matters.generator_program.name_and_version,
        doc_matters.generator_program.url_home,
        doc_matters.src.language,
      );
      return o;
    }
    string tail() @safe {
      string o;
      o = format(q"┃
      
 
      
    
    ┃");
      return o;
    }
    string inline_images(O,M)(
      string          _txt,
      const        O  obj,
                   M  doc_matters,
      string          _suffix    = ".html",
      string          _xml_type = "seg",
    ) @safe {
      string _img_pth;
      if (_xml_type == "epub") {
        _img_pth = "image/";
      } else if (_xml_type == "scroll") {
        _img_pth = "../../image/";
      } else if (_xml_type == "seg") {
        _img_pth = "../../../image/";
      }
      if (_txt.match(rgx.inline_image)) {
        _txt = _txt
          .replaceAll(rgx.inline_image,
            ("$1
 $6"))
          .replaceAll(
            rgx.inline_link_empty,
            ("$1"));
      }
      return _txt;
    }
    string inline_links(O,M)(
      string          _txt,
      const        O  obj,
                   M  doc_matters,
      string         _suffix   = ".html",
      string         _xml_type = "seg",
    ) @safe {
      string seg_lvs;
      if (obj.has.inline_links) {
        if  (obj.metainfo.is_a != "code") {
          _txt = replaceAll!(m =>
              m[1] ~ "┤"
              ~ (replaceAll!(n =>
                  n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
                )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
              ~ "├"
            )(_txt, rgx.inline_link_number_only);
        }
        if ((_txt.match(rgx.mark_internal_site_lnk))
        && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
          _txt = _txt.replaceAll(
            rgx.inline_seg_link,
            "$1");
        }
        if (_xml_type == "seg" || _xml_type == "epub") {
          seg_lvs = (_xml_type == "epub") ? "seg_lv1_to_4" : "seg_lv4";
          foreach (m; _txt.match(rgx.inline_link_hash)) {
            if (m.captures[3] in doc_matters.has.tag_associations) {
              if (
                m.captures[3]
                == doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]
              ) {
                _txt = _txt.replaceFirst(
                  rgx.inline_link_hash,
                  "┥$1┝┤$3" ~ _suffix ~ "├"
                );
              } else {
                _txt = _txt.replaceFirst(
                  rgx.inline_link_hash,
                  "┥$1┝┤"
                  ~ doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]
                  ~ _suffix ~ "#" ~ "$3"
                  ~ "├"
                );
              }
            } else {
              if (!(doc_matters.opt.action.quiet)) {
                writeln(
                  "WARNING on internal document links, anchor to link <<"
                   ~ m.captures[3]
                   ~ ">> not found in document, "
                   ~ "anchor: " ~ m.captures[3]
                   ~ " document: " ~ doc_matters.src.filename
                );
              }
            }
          }
        }
        _txt = _txt
          .replaceAll(
            rgx.inline_link_fn_suffix,
            ("$1" ~ _suffix))
          .replaceAll(
            rgx.inline_link,
            ("
$1 "))
          .replaceAll(
            rgx.mark_internal_site_lnk,
            "");
      }
      debug(markup_links) {
        if (_txt.match(rgx.inline_link)) {
          writeln(__LINE__,
            " (missed) markup link identified (",
            obj.has.inline_links,
            "): ", obj.metainfo.is_a, ": ",
            obj.text
          );
        }
      }
      debug(markup) {
        if (_txt.match(rgx.inline_link)) {
          writeln(__LINE__,
            " (missed) markup link identified (",
            obj.has.inline_links,
            "): ", obj.metainfo.is_a, ": ",
            obj.text
          );
        }
      }
      return _txt;
    }
    string inline_notes_scroll(O,M)(
      string          _txt,
      const        O  obj,
                   M  doc_matters,
    ) @safe {
      if (obj.has.inline_notes_reg) {
        _txt = font_face(_txt);
        _txt = _txt.replaceAll(
          rgx.inline_notes_al_regular_number_note,
          ("
 $1   ")
        );
      }
      if (obj.has.inline_notes_star) {
        _txt = font_face(_txt);
        _txt = _txt.replaceAll(
          rgx.inline_notes_al_special_char_note,
          ("
 $1   ")
        );
      }
      debug(markup_endnotes) {
        if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
          writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
        }
      }
      debug(markup) {
        if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
          writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
        }
      }
      return _txt;
    }
    Tuple!(string, string[]) inline_notes_seg(O,M)(
      string          _txt,
      const        O  obj,
                   M  doc_matters,
    ) @safe {
      string[] _endnotes;
      if (obj.has.inline_notes_star) {
        _txt = font_face(_txt);
        /+ need markup for text, and separated footnote +/
        foreach(m; _txt.matchAll(rgx.inline_notes_al_special_char_note)) {
          _endnotes ~= format(
            "%s%s%s%s\n  %s%s%s%s%s\n  %s\n%s",
            "
",
            "",
            " ",
            m.captures[1],
            ".   ",
            m.captures[2],
            "
"
          );
        }
        _txt = _txt.replaceAll(
          rgx.inline_notes_al_special_char_note,
          ("
 $1   ")
        );
      }
      if (obj.has.inline_notes_reg) {
        _txt = font_face(_txt);
        /+ need markup for text, and separated footnote +/
        foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) {
          _endnotes ~= format(
            "%s%s%s%s\n  %s%s%s%s%s\n  %s\n%s",
            "
",
            "",
            " ",
            m.captures[1],
            ".   ",
            m.captures[2],
            "
"
          );
        }
        _txt = _txt.replaceAll(
          rgx.inline_notes_al_regular_number_note,
          ("
 $1   ")
        );
      } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
        debug(markup) {
          writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
        }
      }
      Tuple!(string, string[]) t = tuple(
        _txt,
        _endnotes,
      );
      return t;
    }
    string inline_markup_scroll(O,M)(
      string          _txt,
      const        O  obj,
                   M  doc_matters,
      string          _suffix = ".html",
    ) @safe {
      if (obj.metainfo.dummy_heading
        && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
        _txt = "";
      } else {
        _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll");
        _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll");
        _txt = inline_notes_scroll(_txt, obj, doc_matters);
      }
      return _txt;
    }
    auto inline_markup_seg(O,M)(
      string          _txt,
      const        O  obj,
                   M  doc_matters,
      string          _suffix = ".html",
      string          _xml_type = "seg",
    ) @safe {
      if (obj.metainfo.dummy_heading
        && ((_xml_type == "epub"
        && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading"))
        || obj.metainfo.is_a == "heading")
      ) {
        _txt = "";
      } else {
        _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
        _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
      }
      auto t = inline_notes_seg(_txt, obj, doc_matters);
      return t;
    }
    string lev4_heading_subtoc(O,M)(
      const        O  obj,
                   M  doc_matters,
    ) @safe {
      char[] lev4_subtoc;
      lev4_subtoc ~= "  
\n";
      foreach (subtoc; obj.tags.lev4_subtoc) {
        if (auto m = subtoc.match(rgx.inline_link_subtoc)) {
          auto indent = (m.captures[1].to!int - 3).to!string; // css assumptions based on use of em for left margin & indent
          auto text = m.captures[2].to!string;
          text = font_face(text);
          auto link = m.captures[3].to!string;
          lev4_subtoc ~= subtoc.replaceFirst(rgx.inline_link_subtoc,
            format(q"┃    
          ۰ %s 
        
    ┃",
              indent,
              indent,
              link,
              text,
          ));
        }
      }
      lev4_subtoc ~= "  
\n";
      return lev4_subtoc.to!string;
    }
    auto nav_pre_next_svg(O,M)(
      const        O  obj,
                   M  doc_matters,
    ) @safe {
      string prev, next, toc;
      string harvest_link = (doc_matters.opt.action.harvest_link)
      ? format(q"┃
[ m  | A  | T  ]
┃", doc_matters.src.filename_base)
      : "";
      if (obj.tags.segment_anchor_tag_epub == "toc") {
        toc = "";
        prev = "";
      } else {
        toc = format(q"┃
              
             ┃",
        );
      }
      if (obj.tags.segname_prev == "") {
        prev = "";
      } else {
        prev = format(q"┃
              
             ┃",
          obj.tags.segname_prev,
        );
      }
      if (obj.tags.segname_next == "") {
        next = "";
      } else {
        next = format(q"┃
              
             ┃",
          obj.tags.segname_next,
        );
      }
      string _toc_pre_next = format(q"┃