From 2ae1cd2773a8659b3ce06d26aba9e804d77f8260 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 1 Sep 2016 13:57:10 -0400 Subject: minor shuffling --- src/sdp/output_html.d | 340 +++++++++++++++++++++++++------------------------- src/sdp/output_hub.d | 2 +- 2 files changed, 171 insertions(+), 171 deletions(-) (limited to 'src/sdp') diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d index 6e4aecf..057ee8c 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -1,5 +1,175 @@ template SiSUoutputHTML() { struct SDPoutputHTML { + auto html_toc(O)( + auto ref const O obj, + ) { + string o; + o = format(q"◎%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"◎


+
+ + + %s + +
+ ◎", + 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"◎
+ +

+ %s +

+
+ ◎", + 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; + } + auto scroll_head() { + string o; + o = format(q"◎ + + + + + + Title + + + + + + + + + + + + + + + + + + + + + ◎"); + return o; + } + auto scroll_tail() { + string o; + o = format(q"◎ + + + + + + ◎"); + return o; + } + 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 + } + } auto html_css() { string css; css="/* SiSU css default stylesheet */ @@ -1304,175 +1474,5 @@ template SiSUoutputHTML() { // Handle error } } - auto html_toc(O)( - auto ref const O obj, - ) { - string o; - o = format(q"◎%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"◎


-
- - - %s - -
- ◎", - 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"◎
- -

- %s -

-
- ◎", - 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; - } - auto scroll_head() { - string o; - o = format(q"◎ - - - - - - Title - - - - - - - - - - - - - - - - - - - - - ◎"); - return o; - } - auto scroll_tail() { - string o; - o = format(q"◎ - - - - - - ◎"); - return o; - } - 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 - } - } } } diff --git a/src/sdp/output_hub.d b/src/sdp/output_hub.d index 8c21fa9..0206bf5 100644 --- a/src/sdp/output_hub.d +++ b/src/sdp/output_hub.d @@ -1,6 +1,6 @@ /+ - output hub output_hub.d + output_html.d +/ template SiSUoutputHub() { struct SDPoutput { -- cgit v1.2.3