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 --- src/sdp/output/html.d | 2 + src/sdp/output/rgx.d | 1 + src/sdp/output/xmls.d | 130 +++++++++++++++++++++++++++++++++++++------------- 3 files changed, 100 insertions(+), 33 deletions(-) (limited to 'src/sdp/output') diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d index 1b984fe..f620498 100644 --- a/src/sdp/output/html.d +++ b/src/sdp/output/html.d @@ -237,6 +237,8 @@ template outputHTML() { } 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: diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d index ae7599f..4a9e33e 100644 --- a/src/sdp/output/rgx.d +++ b/src/sdp/output/rgx.d @@ -40,6 +40,7 @@ template SiSUoutputRgxInit() { /+ 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/src/sdp/output/xmls.d b/src/sdp/output/xmls.d index 2482f28..c7dd552 100644 --- a/src/sdp/output/xmls.d +++ b/src/sdp/output/xmls.d @@ -71,28 +71,25 @@ template outputXHTMLs() { o = format(q"¶ - - - %s%s - - - - - - - - - - - - - - + + %s%s + + + + + + + + + + + + + - ¶", @@ -128,8 +125,7 @@ template outputXHTMLs() { - - + @@ -331,20 +327,88 @@ template outputXHTMLs() { auto t = inline_notes_seg(obj, _txt); return t; } - 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; + } + 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; } -- cgit v1.2.3