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/default_regex.org | 1 + org/output_xmls.org | 139 ++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 107 insertions(+), 33 deletions(-) (limited to 'org') diff --git a/org/default_regex.org b/org/default_regex.org index dc9c4ab..b6173cf 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -440,6 +440,7 @@ static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+] /+ inline markup footnotes endnotes +/ static inline_link = ctRegex!(`┥(.+?)┝┤(.+?)├`, "mg"); static inline_a_url = ctRegex!(`(┤)(\S+?)(├)`, "mg"); +static inline_link_subtoc = ctRegex!(`^(?P[5-7])~ ┥(?P.+?)┝┤(?P.+?)├`, "mg"); static fn_suffix = ctRegex!(`\.fnSuffix`, "mg"); static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.fnSuffix`, "mg"); 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