diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-06-06 17:52:38 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 64922b57604c8e0c29a1dcd3ae313d243bf6b46d (patch) | |
tree | 3434a32c04b884449ab20df1f7e59cf4cd31a670 /org/output_xmls.org | |
parent | output xmls, minor asserts (diff) |
html seg, work on subtoc & on nav pre-next
Diffstat (limited to 'org/output_xmls.org')
-rw-r--r-- | org/output_xmls.org | 139 |
1 files changed, 106 insertions, 33 deletions
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"¶<!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <title> - %s%s - </title> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> - <meta name="dc.title" content="Title" /> - <meta name="dc.author" content="Author" /> - <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" /> - <meta name="dc.date" content="year" /> - <meta name="dc.date.created" content="year" /> - <meta name="dc.date.issued" content="year" /> - <meta name="dc.date.available" content="year" /> - <meta name="dc.date.valid" content="year" /> - <meta name="dc.date.modified" content="year" /> - <meta name="dc.language" content="US" /> - <meta name="dc.rights" content="Copyright: Copyright (C) year holder /> - <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" /> - </meta> + <title> + %s%s + </title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <meta name="dc.title" content="Title" /> + <meta name="dc.author" content="Author" /> + <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" /> + <meta name="dc.date" content="year" /> + <meta name="dc.date.created" content="year" /> + <meta name="dc.date.issued" content="year" /> + <meta name="dc.date.available" content="year" /> + <meta name="dc.date.valid" content="year" /> + <meta name="dc.date.modified" content="year" /> + <meta name="dc.language" content="US" /> + <meta name="dc.rights" content="Copyright: Copyright (C) year holder /> + <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" /> <link rel="generator" href="http://www.sisudoc.org/" /> <link rel="shortcut icon" href="../../image/rb7.ico" /> <link href="../../css/html.css" rel="stylesheet" /> - <link href="../../../css/html.css" rel="stylesheet" /> </head> <body lang="%s"> <a name="top" id="top"></a>¶", @@ -200,8 +197,7 @@ auto html_seg_head(Dm)( <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" /> </meta> <link rel="generator" href="http://www.sisudoc.org/" /> - <link rel="shortcut icon" href="../../image/rb7.ico" /> - <link href="../../css/html.css" rel="stylesheet" /> + <link rel="shortcut icon" href="../../../image/rb7.ico" /> <link href="../../../css/html.css" rel="stylesheet" /> </head> <body lang="%s"> @@ -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"¶ <div class="substance"> - <p class="%s" indent="h%si%s"> - %s - </p> -</div>¶", - obj.is_a, - obj.indent_hang, - obj.indent_base, - _txt, + char[] lev4_subtoc; + lev4_subtoc ~= " <div class=\"nav\">\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"¶ <p class="minitoc" indent="h%si%s"> + <a href="%s">%s</a> + </p> +¶", + indent, + indent, + link, + text, + )); + } + } + lev4_subtoc ~= " </div>\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"¶ + <td align="center" bgcolor="#ffffff"> + <a href="%s.html" target="_top"> + <img border="0" width="22" height="22" src="../../../image/arrow_prev_red.png" alt=" << [ prev ] " /> + </a> + </td> +¶", + obj.segname_prev, + ); + } + if (obj.segname_next == "") { + next = ""; + } else { + next = format(q"¶ + <td align="center" bgcolor="#ffffff"> + <a href="%s.html" target="_top"> + <img border="0" width="22" height="22" src="../../../image/arrow_next_red.png" alt=" [ next ] >> " /> + </a> + </td> +¶", + obj.segname_next, + ); + } + if (obj.segment_anchor_tag == "toc") { + toc = ""; + prev = ""; + } else { + toc = format(q"¶ + <td align="center" bgcolor="#ffffff"> + <a href="toc.html" target="_top"> + <img border="0" width="22" height="22" src="../../../image/arrow_up_red.png" alt=" [ toc ] " /> + </a> + </td> +¶", + ); + } + string o = format(q"¶<div class="nav"> + <table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0"> + <tr> + %s + %s + %s + </tr> + </table> +</div> +¶", + 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: |