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 /src/sdp | |
| parent | output xmls, minor asserts (diff) | |
html seg, work on subtoc & on nav pre-next
Diffstat (limited to 'src/sdp')
| -rw-r--r-- | src/sdp/ao/rgx.d | 1 | ||||
| -rw-r--r-- | src/sdp/output/html.d | 2 | ||||
| -rw-r--r-- | src/sdp/output/rgx.d | 1 | ||||
| -rw-r--r-- | src/sdp/output/xmls.d | 130 | 
4 files changed, 101 insertions, 33 deletions
| diff --git a/src/sdp/ao/rgx.d b/src/sdp/ao/rgx.d index d0d42df..aeab6e9 100644 --- a/src/sdp/ao/rgx.d +++ b/src/sdp/ao/rgx.d @@ -218,6 +218,7 @@ template SiSUrgxInit() {      /+ inline markup footnotes endnotes +/      static inline_link                                    = ctRegex!(`┥(.+?)┝┤(.+?)├`, "mg");      static inline_a_url                                   = ctRegex!(`(┤)(\S+?)(├)`, "mg"); +    static inline_link_subtoc                             = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "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/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<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "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"¶<!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>¶", @@ -128,8 +125,7 @@ template outputXHTMLs() {          <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"> @@ -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"¶  <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; +    } +    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;      } | 
