diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-12-29 20:36:41 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 249e8d2d61f3650d934582b65200ca8fa0b47495 (patch) | |
tree | 0d03750aa9a4897c0277d85f49a9505f03b1d1c3 /org/output.org | |
parent | naming (diff) |
dom structure, levels marked up & collapsed (use e.g. in epub toc)doc-reform_v0.0.10
Diffstat (limited to 'org/output.org')
-rw-r--r-- | org/output.org | 96 |
1 files changed, 72 insertions, 24 deletions
diff --git a/org/output.org b/org/output.org index eae453a..e9253dc 100644 --- a/org/output.org +++ b/org/output.org @@ -117,23 +117,38 @@ auto html_heading(O)( ) { auto tags = _html_anchor_tags(obj.anchor_tags); string o; - o = format(q"¶<br><hr /><br> + if (obj.obj_cite_number.empty) { + o = format(q"¶<br><hr /><br> + <div class="substance"> + <h%s class="%s">%s + %s + </h%s> + </div>¶", + obj.heading_lev_markup, + obj.is_a, + tags, + obj.text, + obj.heading_lev_markup, + ); + } else { + o = format(q"¶<br><hr /><br> <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <h%s class="%s" id="%s"><a name="%s"></a>%s %s </h%s> </div>¶", - obj.obj_cite_number, - obj.obj_cite_number, - obj.heading_lev_markup, - obj.is_a, - obj.obj_cite_number, - obj.obj_cite_number, - tags, - obj.text, - obj.heading_lev_markup, - ); + obj.obj_cite_number, + obj.obj_cite_number, + obj.heading_lev_markup, + obj.is_a, + obj.obj_cite_number, + obj.obj_cite_number, + tags, + obj.text, + obj.heading_lev_markup, + ); + } return o; } #+END_SRC @@ -149,13 +164,10 @@ auto html_para(O)( string o; if (obj.obj_cite_number.empty) { o = format(q"¶ <div class="substance"> - <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" indent="h%si%s">%s %s </p> </div>¶", - obj.obj_cite_number, - obj.obj_cite_number, obj.is_a, obj.indent_hang, obj.indent_base, @@ -191,18 +203,29 @@ auto html_nugget(O)( auto ref const O obj, ) { string o; - o = format(q"¶ <div class="substance"> + if (obj.obj_cite_number.empty) { + o = format(q"¶ <div class="substance"> + <p class="%s"> + %s + </p> +</div>¶", + obj.is_a, + obj.text + ); + } else { + o = format(q"¶ <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <p class="%s" id="%s"> %s </p> </div>¶", - obj.obj_cite_number, - obj.obj_cite_number, - obj.is_a, - obj.obj_cite_number, - obj.text - ); + obj.obj_cite_number, + obj.obj_cite_number, + obj.is_a, + obj.obj_cite_number, + obj.text + ); + } return o; } #+END_SRC @@ -218,7 +241,7 @@ auto scroll_head_html() { <head> <meta charset="utf-8"> <title> - Title + %s%s </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta name="dc.title" content="Title" /> @@ -239,7 +262,10 @@ auto scroll_head_html() { <link href="../../../_sisu/css/html.css" rel="stylesheet"> </head> <body lang="en"> -<a name="top" id="top"></a>¶"); +<a name="top" id="top"></a>¶", +dochead_meta["title"]["full"], +(dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"], +); return o; } #+END_SRC @@ -319,7 +345,7 @@ void scroll(C)( string[] doc; foreach (part; document_section_keys_sequenced["scroll"]) { foreach (obj; contents[part]) { - if (obj.use == "body") { + if (obj.use == "frontmatter") { switch (obj.is_of) { case "para": switch (obj.is_a) { @@ -329,6 +355,22 @@ void scroll(C)( case "toc": body_html ~= html_toc(obj); break; + default: + writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + break; + } + break; + default: + writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + break; + } + } else if (obj.use == "body") { + switch (obj.is_of) { + case "para": + switch (obj.is_a) { + case "heading": + body_html ~= html_heading(obj); + break; case "para": body_html ~= html_para(obj); break; @@ -402,6 +444,12 @@ void scroll(C)( } } } +#+END_SRC + +**** scroll output file + +#+name: output_html +#+BEGIN_SRC d doc = scroll_head_html ~ body_html ~ scroll_tail_html; auto m = matchFirst(fn_src, rgx.src_fn); auto fn = m["fn_base"] ~ ".html"; |