diff options
Diffstat (limited to 'org')
| -rw-r--r-- | org/output.org | 398 | ||||
| -rw-r--r-- | org/sdp.org | 59 | 
2 files changed, 238 insertions, 219 deletions
| diff --git a/org/output.org b/org/output.org index 6e50fbc..8f221bc 100644 --- a/org/output.org +++ b/org/output.org @@ -16,7 +16,210 @@  * output                                                             :output:  ** text                                                                :text:  ** html [#A]                                                           :html: -*** css +*** html +**** html functions + +***** html + +#+name: output_html +#+BEGIN_SRC d +auto html_toc(O)( +  auto ref const O         obj, +) { +  string o; +  o = format(q"◎<h%s class="toc"><a href="#%s">%s</a></h%s>◎", +  obj.heading_attrib.lev_markup_number, +  obj.obj_cite_number, +  obj.object, +  obj.heading_attrib.lev_markup_number +  ); +  return o; +} +#+END_SRC + +***** heading + +#+name: output_html +#+BEGIN_SRC d +auto html_heading(O)( +  auto ref const O         obj, +) { +  string o; +  o = format(q"◎<br><hr /><br> +  <div class="substance"> +    <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> +    <h%s class="norm" id="%s"><a name="%s"></a> +      %s +    </h%s> +  </div> +  ◎", +  obj.obj_cite_number, +  obj.obj_cite_number, +  obj.heading_attrib.lev_markup_number, +  obj.obj_cite_number, +  obj.obj_cite_number, +  obj.object, +  obj.heading_attrib.lev_markup_number +  ); +  return o; +} +#+END_SRC + +***** para + +#+name: output_html +#+BEGIN_SRC d +auto html_para(O)( +  auto ref const O         obj, +) { +  string o; +  o = format(q"◎<div class="substance"> +    <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> +    <p class="h%si%s" id="%s"> +      %s +    </p> +  </div> +  ◎", +  obj.obj_cite_number, +  obj.obj_cite_number, +  obj.para_attrib.indent_first, +  obj.para_attrib.indent_second, +  obj.obj_cite_number, +  obj.object +  ); +  return o; +} +#+END_SRC + +**** html scroll head & tail + +#+name: output_html +#+BEGIN_SRC d +auto scroll_head() { +  string o; +  o = format(q"◎ +<!DOCTYPE html> +<html> +<head> +  <meta charset="utf-8"> +  <title> +    Title +  </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="../_sisu/image/rb7.ico" /> +  <link href="../../_sisu/css/html.css" rel="stylesheet"> +  <link href="../../../_sisu/css/html.css" rel="stylesheet"> +</head> +<body lang="en"> +<a name="top" id="top"></a> +◎"); +  return o; +} +auto scroll_tail() { +  string o; +  o = format(q"◎ +<a name="bottom" id="bottom"></a> +<a name="end" id="end"></a> +</div> +</body> +</html> +◎"); +  return o; +} +#+END_SRC + +**** html scroll + +#+name: output_html +#+BEGIN_SRC d +void scroll(C)( +  auto ref const C         contents, +  string[][string][string] bookindex_unordered_hashes, +  JSONValue[]              biblio, +  string[string][string]   dochead_make, +  string[string][string]   dochead_meta, +  string                   fn_src, +  bool[string]             opt_action_bool +) { +  auto rgx = Rgx(); +  string[] toc; +  string[] body_; +  string[] doc; +  foreach (obj; contents) { +    if (obj.use == "content") { +      switch (obj.is_a) { +      case "heading": +        toc ~= html_toc(obj); +        body_ ~= html_heading(obj); +        break; +      case "para": +        body_ ~= html_para(obj); +        break; +      case "verse": +        body_ ~= html_para(obj); +        // body_ ~= html_verse(obj); +        break; +      case "group": +        body_ ~= html_para(obj); +        // body_ ~= html_group(obj); +        break; +      case "block": +        body_ ~= html_para(obj); +        // body_ ~= html_block(obj); +        break; +      case "quote": +        body_ ~= html_para(obj); +        // body_ ~= html_quote(obj); +        break; +      case "table": +        body_ ~= html_para(obj); +        // body_ ~= html_table(obj); +        break; +      case "code": +        body_ ~= html_para(obj); +        // body_ ~= html_code(obj); +        break; +      default: +        body_ ~= html_para(obj); +        break; +      } +    } +  } +  doc = scroll_head ~ toc ~ body_ ~ scroll_tail; +  auto m = matchFirst(fn_src, rgx.src_fn); +  auto fn = m["fn_base"] ~ ".html"; +  auto pth_html = "en/html"; +  auto pth_seg = pth_html ~ "/" ~ m["fn_base"]; +  auto pth_html_fn = pth_html ~ "/" ~ fn; +  // auto pth_css= "_sisu/css"; +  // auto pth_css_fn= pth_css ~ "/html.css"; +  try { +    mkdirRecurse(pth_seg); +    auto f = File(pth_html_fn, "w"); +    foreach (o; doc) { +      f.writeln(o); +    } +  } +  catch (ErrnoException ex) { +    // Handle error +  } +} +#+END_SRC + +*** css                                                                 :css:  #+name: output_html_css  #+BEGIN_SRC d @@ -1326,195 +1529,6 @@ auto css_write() {  }  #+END_SRC -*** html -**** html functions - -#+name: output_html -#+BEGIN_SRC d -auto html_toc(O)( -  auto ref const O         obj, -) { -  string o; -  o = format(q"◎<h%s class="toc"><a href="#%s">%s</a></h%s>◎", -  obj.heading_attrib.lev_markup_number, -  obj.obj_cite_number, -  obj.object, -  obj.heading_attrib.lev_markup_number -  ); -  return o; -} -auto html_heading(O)( -  auto ref const O         obj, -) { -  string o; -  o = format(q"◎<br><hr /><br> -  <div class="substance"> -    <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> -    <h%s class="norm" id="%s"><a name="%s"></a> -      %s -    </h%s> -  </div> -  ◎", -  obj.obj_cite_number, -  obj.obj_cite_number, -  obj.heading_attrib.lev_markup_number, -  obj.obj_cite_number, -  obj.obj_cite_number, -  obj.object, -  obj.heading_attrib.lev_markup_number -  ); -  return o; -} -auto html_para(O)( -  auto ref const O         obj, -) { -  string o; -  o = format(q"◎<div class="substance"> -    <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> -    <p class="h%si%s" id="%s"> -      %s -    </p> -  </div> -  ◎", -  obj.obj_cite_number, -  obj.obj_cite_number, -  obj.para_attrib.indent_first, -  obj.para_attrib.indent_second, -  obj.obj_cite_number, -  obj.object -  ); -  return o; -} -#+END_SRC - -**** html scroll head & tail - -#+name: output_html -#+BEGIN_SRC d -auto scroll_head() { -  string o; -  o = format(q"◎ -<!DOCTYPE html> -<html> -<head> -  <meta charset="utf-8"> -  <title> -    Title -  </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="../_sisu/image/rb7.ico" /> -  <link href="../../_sisu/css/html.css" rel="stylesheet"> -  <link href="../../../_sisu/css/html.css" rel="stylesheet"> -</head> -<body lang="en"> -<a name="top" id="top"></a> -◎"); -  return o; -} -auto scroll_tail() { -  string o; -  o = format(q"◎ -<a name="bottom" id="bottom"></a> -<a name="end" id="end"></a> -</div> -</body> -</html> -◎"); -  return o; -} -#+END_SRC - -**** html scroll - -#+name: output_html -#+BEGIN_SRC d -void scroll(C)( -  auto ref const C         contents, -  string[][string][string] bookindex_unordered_hashes, -  JSONValue[]              biblio, -  string[string][string]   dochead_make, -  string[string][string]   dochead_meta, -  string                   fn_src, -  bool[string]             opt_action_bool -) { -  auto rgx = Rgx(); -  string[] toc; -  string[] body_; -  string[] doc; -  foreach (obj; contents) { -    if (obj.use == "content") { -      switch (obj.is_a) { -      case "heading": -        toc ~= html_toc(obj); -        body_ ~= html_heading(obj); -        break; -      case "para": -        body_ ~= html_para(obj); -        break; -      case "verse": -        body_ ~= html_para(obj); -        // body_ ~= html_verse(obj); -        break; -      case "group": -        body_ ~= html_para(obj); -        // body_ ~= html_group(obj); -        break; -      case "block": -        body_ ~= html_para(obj); -        // body_ ~= html_block(obj); -        break; -      case "quote": -        body_ ~= html_para(obj); -        // body_ ~= html_quote(obj); -        break; -      case "table": -        body_ ~= html_para(obj); -        // body_ ~= html_table(obj); -        break; -      case "code": -        body_ ~= html_para(obj); -        // body_ ~= html_code(obj); -        break; -      default: -        body_ ~= html_para(obj); -        break; -      } -    } -  } -  doc = scroll_head ~ toc ~ body_ ~ scroll_tail; -  auto m = matchFirst(fn_src, rgx.src_fn); -  auto fn = m["fn_base"] ~ ".html"; -  auto pth_html = "en/html"; -  auto pth_seg = pth_html ~ "/" ~ m["fn_base"]; -  auto pth_html_fn = pth_html ~ "/" ~ fn; -  // auto pth_css= "_sisu/css"; -  // auto pth_css_fn= pth_css ~ "/html.css"; -  try { -    mkdirRecurse(pth_seg); -    auto f = File(pth_html_fn, "w"); -    foreach (o; doc) { -      f.writeln(o); -    } -  } -  catch (ErrnoException ex) { -    // Handle error -  } -} -#+END_SRC -  ** epub [#B]                                                           :epub:  ** pdf                                                                  :pdf:  ** odt                                                                  :odt: @@ -1527,8 +1541,8 @@ void scroll(C)(  #+BEGIN_SRC d :tangle ../src/sdp/output_hub.d  /+ -  output hub    output_hub.d +  output_html.d  +/  template SiSUoutputHub() {    struct SDPoutput { @@ -1584,8 +1598,8 @@ template SiSUoutputHub() {  #+BEGIN_SRC d :tangle ../src/sdp/output_html.d  template SiSUoutputHTML() {    struct SDPoutputHTML { -    <<output_html_css>>      <<output_html>> +    <<output_html_css>>    }  }  #+END_SRC diff --git a/org/sdp.org b/org/sdp.org index d5a8410..2c28c18 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -476,33 +476,38 @@ figure out best program dir structure for dub and compilers, issue with rdmd  ** sisu document structure -|---------------------+------------------------------------------+------------------------+--------| -| header              | sisu /header markup/                       | markup                 |        | -| - metadata          |                                          |                        |        | -| - make instructions |                                          |                        |        | -|---------------------+------------------------------------------+------------------------+--------| -| table of contents   | markup of headings                       | (regular content)      | output | -|---------------------+------------------------------------------+------------------------+--------| -| substantive content | sisu /content markup/                      | markup                 | output | -|                     | headings (providing document structure), | (regular content)      |        | -|                     | paragraphs, blocks                       |                        |        | -|                     | blocks (code, poem, group, table)        |                        |        | -|---------------------+------------------------------------------+------------------------+--------| -| endnotes            | markup within substantive content        | markup                 | output | -|                     | (extracted from sisu /content markup/)     | (from regular content) |        | -|---------------------+------------------------------------------+------------------------+--------| -| glossary            | identify special section                 | markup                 | output | -|                     | regular /content markup/                   |                        |        | -|---------------------+------------------------------------------+------------------------+--------| -| bibliography        | identify section,                        | markup (special)       | output | -|                     | special /bibliography markup/              |                        |        | -|---------------------+------------------------------------------+------------------------+--------| -| book index          | extracted from markup attached to        | markup                 | output | -|                     | related substantive content objects      |                        |        | -|                     | (special tags in sisu /content markup/)    | (from regular content) |        | -|---------------------+------------------------------------------+------------------------+--------| -| metadata            |                                          | (from regular header)  | output | -|---------------------+------------------------------------------+------------------------+--------| +|---------------------+------------------------------------------+------------------------+------------------------+--------| +|                     |                                          |                        | links                  |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| header              | sisu /header markup/                       | markup                 |                        |        | +| - metadata          |                                          |                        |                        |        | +| - make instructions |                                          |                        |                        |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| table of contents   | markup of headings                       | (regular content)      | scroll  #[ocn]         | output | +|                     |                                          |                        | seg     ../[fn]/#[ocn] |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| substantive content | sisu /content markup/                      | markup                 | internal               | output | +|                     | headings (providing document structure), |                        | scroll  #[ocn]         |        | +|                     | paragraphs, blocks                       | (regular content)      | seg     ../[fn]/#[ocn] |        | +|                     | blocks (code, poem, group, table)        |                        | footnotes              |        | +|                     |                                          |                        | seg     #[ocn]         |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| endnotes            | markup within substantive content        | markup                 | scroll  #[ocn]         | output | +|                     | (extracted from sisu /content markup/)     | (from regular content) | seg     ../[fn]/#[ocn] |        | +|                     |                                          |                        | crosslinks             |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| glossary            | identify special section                 | markup                 |                        | output | +|                     | regular /content markup/                   |                        |                        |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| bibliography        | identify section,                        | markup (special)       |                        | output | +|                     | special /bibliography markup/              |                        |                        |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| book index          | extracted from markup attached to        | markup                 | scroll  #[ocn]         | output | +|                     | related substantive content objects      |                        | seg     ../[fn]/#[ocn] |        | +|                     | (special tags in sisu /content markup/)    | (from regular content) |                        |        | +|---------------------+------------------------------------------+------------------------+------------------------+--------| +| metadata            |                                          | (from regular header)  |                        | output | +|---------------------+------------------------------------------+------------------------+------------------------+--------|  ** config                                                            :config:  using sdlang in sdp | 
