diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2018-09-28 17:05:34 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-04-10 15:14:15 -0400 |
commit | 08a374929fdfd11b2546636a9151518491457f18 (patch) | |
tree | 31b97119fcd3d3e37a94cee5becdc841745ba693 /src/doc_reform/output/xmls.d | |
parent | doc_abstraction provide object with segment it occurs in (diff) |
output xmls & sqlite, make doc_matter available
Diffstat (limited to 'src/doc_reform/output/xmls.d')
-rw-r--r-- | src/doc_reform/output/xmls.d | 324 |
1 files changed, 177 insertions, 147 deletions
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index f2f09fa..e68a22d 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -311,11 +311,12 @@ template outputXHTMLs() { </html>¶"); return o; } - auto inline_images(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "seg", + auto inline_images(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", ) { string _img_pth; if (_xml_type == "epub") { @@ -334,11 +335,12 @@ template outputXHTMLs() { } return _txt; } - auto inline_links(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "seg", + auto inline_links(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", ) { if (obj.has.inline_links) { if ((_txt.match(rgx.mark_internal_site_lnk)) @@ -380,8 +382,9 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_scroll(O)( - const O obj, + auto inline_notes_scroll(M,O)( + M doc_matters, + const O obj, string _txt, ) { if (obj.has.inline_notes_reg) { @@ -403,9 +406,10 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_seg(O)( - const O obj, - string _txt, + auto inline_notes_seg(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string[] _endnotes; if (obj.has.inline_notes_reg) { @@ -442,29 +446,32 @@ template outputXHTMLs() { ); return t; } - auto inline_markup_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto inline_markup_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { - _txt = inline_images(obj, _txt, _suffix, "scroll"); - _txt = inline_links(obj, _txt, _suffix, "scroll"); - _txt = inline_notes_scroll(obj, _txt); + _txt = inline_images(doc_matters, obj, _txt, _suffix, "scroll"); + _txt = inline_links(doc_matters, obj, _txt, _suffix, "scroll"); + _txt = inline_notes_scroll(doc_matters, obj, _txt); return _txt; } - auto inline_markup_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "seg", + auto inline_markup_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", ) { - _txt = inline_images(obj, _txt, _suffix, _xml_type); - _txt = inline_links(obj, _txt, _suffix, _xml_type); - auto t = inline_notes_seg(obj, _txt); + _txt = inline_images(doc_matters, obj, _txt, _suffix, _xml_type); // TODO + _txt = inline_links(doc_matters, obj, _txt, _suffix, _xml_type); // TODO + auto t = inline_notes_seg(doc_matters, obj, _txt); return t; } - string lev4_heading_subtoc(O)( - const O obj, + string lev4_heading_subtoc(M,O)( + M doc_matters, + const O obj, ) { char[] lev4_subtoc; lev4_subtoc ~= " <div class=\"nav\">\n"; @@ -489,8 +496,9 @@ template outputXHTMLs() { lev4_subtoc ~= " </div>\n"; return lev4_subtoc.to!string; } - auto nav_pre_next_svg(O)( - const O obj, + auto nav_pre_next_svg(M,O)( + M doc_matters, + const O obj, ) { string prev, next, toc; if (obj.tags.segment_anchor_tag == "toc") { @@ -566,10 +574,11 @@ template outputXHTMLs() { } return bar(); } - auto heading(O)( - const O obj, - string _txt, - string _xml_type = "html", + auto heading(M,O)( + M doc_matters, + const O obj, + string _txt, + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); string _horizontal_rule = "<hr />"; @@ -615,35 +624,38 @@ template outputXHTMLs() { } return o; } - auto heading_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto heading_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = heading(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = heading(doc_matters, obj, _txt); return o; } - auto heading_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto heading_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html" ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0]; string[] _endnotes = t[1]; - string o = heading(obj, _txt, _xml_type); + string o = heading(doc_matters, obj, _txt, _xml_type); auto u = tuple( o, _endnotes, ); return u; } - auto para(O)( - const O obj, - string _txt, + auto para(M,O)( + M doc_matters, + const O obj, + string _txt, ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); _txt = font_face(_txt); @@ -680,35 +692,38 @@ template outputXHTMLs() { } return o; } - auto para_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto para_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = para(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = para(doc_matters, obj, _txt); return o; } - auto para_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto para_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = para(obj, _txt); + string o = para(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto quote(O)( - const O obj, - string _txt, + auto quote(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -737,35 +752,38 @@ template outputXHTMLs() { } return o; } - auto quote_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto quote_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = quote(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = quote(doc_matters, obj, _txt); return o; } - auto quote_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto quote_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = quote(obj, _txt); + string o = quote(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto group(O)( - const O obj, - string _txt, + auto group(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -794,36 +812,39 @@ template outputXHTMLs() { } return o; } - auto group_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = group(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = group(doc_matters, obj, _txt); return o; } - auto group_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = group(obj, _txt); + string o = group(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto block(O)( - const O obj, - string _txt, + auto block(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -848,36 +869,39 @@ template outputXHTMLs() { } return o; } - auto block_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = block(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = block(doc_matters, obj, _txt); return o; } - auto block_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = block(obj, _txt); + string o = block(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto verse(O)( - const O obj, - string _txt, + auto verse(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -902,36 +926,39 @@ template outputXHTMLs() { } return o; } - auto verse_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = verse(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = verse(doc_matters, obj, _txt); return o; } - auto verse_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = verse(obj, _txt); + string o = verse(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto tablarize(O)( - const O obj, - string _txt, + auto tablarize(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; @@ -962,13 +989,14 @@ template outputXHTMLs() { ); return t; } - auto table(O)( - const O obj, - string _txt, + auto table(M,O)( + M doc_matters, + const O obj, + string _txt, ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); _txt = font_face(_txt); - auto t = tablarize(obj, _txt); + auto t = tablarize(doc_matters, obj, _txt); _txt = t[0]; string _note = t[1]; string o; @@ -991,9 +1019,10 @@ template outputXHTMLs() { ); return o; } - auto endnote(O)( - const O obj, - string _txt, + auto endnote(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string o; o = format(q"¶ <p class="%s" indent="h%si%s"> @@ -1006,9 +1035,10 @@ template outputXHTMLs() { ); return o; } - auto code(O)( - const O obj, - string _txt, + auto code(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string o; if (obj.metainfo.object_number.empty) { |