From 64922b57604c8e0c29a1dcd3ae313d243bf6b46d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 6 Jun 2017 17:52:38 -0400 Subject: html seg, work on subtoc & on nav pre-next --- org/output_xmls.org | 139 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 106 insertions(+), 33 deletions(-) (limited to 'org/output_xmls.org') diff --git a/org/output_xmls.org b/org/output_xmls.org index 2e9e72c..b826a12 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -137,28 +137,25 @@ auto html_scroll_head(Dm)( o = format(q"¶ - - - %s%s - - - - - - - - - - - - - - + + %s%s + + + + + + + + + + + + + - ¶", @@ -200,8 +197,7 @@ auto html_seg_head(Dm)( - - + @@ -449,23 +445,98 @@ auto inline_markup_seg(O)( #+END_SRC *** toc +**** subtoc #+name: xhtml_format_objects #+BEGIN_SRC d -auto toc_seg(O)( +string lev4_heading_subtoc(O)( auto return ref const O obj, - string _txt, ) { - string o; - o = format(q"¶
-

- %s -

-
¶", - obj.is_a, - obj.indent_hang, - obj.indent_base, - _txt, + char[] lev4_subtoc; + lev4_subtoc ~= "
\n"; + foreach (subtoc; obj.lev4_subtoc) { + if (auto m = subtoc.match(rgx.inline_link_subtoc)) { + auto indent = to!string(m.captures[1]); + auto text = to!string(m.captures[2]); + text = font_face(text); + auto link = to!string(m.captures[3]); + lev4_subtoc ~= subtoc.replaceFirst(rgx.inline_link_subtoc, + format(q"¶

+ %s +

+¶", + indent, + indent, + link, + text, + )); + } + } + lev4_subtoc ~= "
\n"; + return lev4_subtoc.to!string; +} +#+END_SRC + +**** navigation pre next + +#+name: xhtml_format_objects +#+BEGIN_SRC d +string nav_pre_next_table(O)( + auto return ref const O obj, +) { + string prev, next, toc; + if (obj.segname_prev == "") { + prev = ""; + } else { + prev = format(q"¶ + + +  << [ prev ] + + +¶", + obj.segname_prev, + ); + } + if (obj.segname_next == "") { + next = ""; + } else { + next = format(q"¶ + + +  [ next ] >> + + +¶", + obj.segname_next, + ); + } + if (obj.segment_anchor_tag == "toc") { + toc = ""; + prev = ""; + } else { + toc = format(q"¶ + + +  [ toc ] + + +¶", + ); + } + string o = format(q"¶ +¶", + prev, + toc, + next, ); return o; } @@ -1333,6 +1404,8 @@ void seg(D,I)( } auto t = xhtml_format.heading_seg(obj, _txt, suffix); doc_html[segment_filename] ~= to!string(t[0]); + doc_html[segment_filename] ~= xhtml_format.nav_pre_next_table(obj); + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj); doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: -- cgit v1.2.3