aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/ao_abstract_doc_source.org680
-rw-r--r--org/ao_defaults.org211
-rw-r--r--org/ao_output_debugs.org126
-rw-r--r--org/ao_read_source_files.org20
-rw-r--r--org/output.org1082
-rw-r--r--org/sdp.org786
6 files changed, 2088 insertions, 817 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org
index 49f3016..4aa20be 100644
--- a/org/ao_abstract_doc_source.org
+++ b/org/ao_abstract_doc_source.org
@@ -178,7 +178,9 @@ ObjGenericComposite[] the_dom_tail_section;
string[string] an_object, processing;
string an_object_key;
string[] anchor_tags;
+string anchor_tag_;
string segment_anchor_tag_that_object_belongs_to;
+string segment_anchor_tag_that_object_belongs_to_uri;
auto note_section = NotesSection();
/+ enum +/
enum State { off, on }
@@ -223,6 +225,58 @@ int[] dom_markedup_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];
int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];
int[] dom_collapsed_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];
enum DomTags { none, open, close, close_and_open, open_still, }
+void heading_ancestors(O)(
+ auto ref O obj,
+ ref string[] lv_ancestors,
+) {
+ switch (obj.heading_lev_markup) {
+ case 0:
+ lv_ancestors[0] = to!string(obj.text);
+ foreach(k; 1..8) { // 1 .. 7 ?
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 1:
+ lv_ancestors[1] = to!string(obj.text);
+ foreach(k; 2..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 2:
+ lv_ancestors[2] = to!string(obj.text);
+ foreach(k; 3..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 3:
+ lv_ancestors[3] = to!string(obj.text);
+ foreach(k; 4..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 4:
+ lv_ancestors[4] = to!string(obj.text);
+ foreach(k; 5..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 5:
+ lv_ancestors[5] = to!string(obj.text);
+ foreach(k; 6..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 6:
+ lv_ancestors[6] = to!string(obj.text);
+ lv_ancestors[7] = "";
+ goto default;
+ case 7:
+ lv_ancestors[7] = to!string(obj.text);
+ goto default;
+ default:
+ obj.heading_ancestors_text = lv_ancestors.dup;
+ }
+}
auto dom_set_markup_tags(int[] dom, int lev) {
foreach (i; 0 .. 8) {
if (i < lev) {
@@ -356,6 +410,7 @@ string[string] obj_cite_number_poem = [
"start" : "",
"end" : ""
];
+string[] lv_ancestors = [ "", "", "", "", "", "", "", "", ];
int[string] lv = [
"lv" : State.off,
"h0" : State.off,
@@ -955,9 +1010,16 @@ if ((type["heading"] == State.on)
anchor_tags = substantive_object_and_anchor_tags_tuple[1];
if (to!int(an_object["lev_markup_number"]) == 4) {
segment_anchor_tag_that_object_belongs_to = anchor_tags[0];
+ segment_anchor_tag_that_object_belongs_to_uri = anchor_tags[0] ~ ".fnSuffix";
+ anchor_tag_ = anchor_tags[0];
+ } else if (to!int(an_object["lev_markup_number"]) > 4) {
+ segment_anchor_tag_that_object_belongs_to = anchor_tag_;
+ segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ to!string(obj_cite_number);
} else if (to!int(an_object["lev_markup_number"]) < 4) {
segment_anchor_tag_that_object_belongs_to = "";
+ segment_anchor_tag_that_object_belongs_to_uri = "";
}
+ /+ (incrementally build toc) table of contents here! +/
_anchor_tag=to!string(obj_cite_number);
the_table_of_contents_section = obj_im.table_of_contents_gather_headings(
an_object,
@@ -982,6 +1044,7 @@ if ((type["heading"] == State.on)
obj_cite_number, // int
cntr, // int
heading_ptr, // int
+ lv_ancestors, // string[]
an_object["is"], // string
html_segnames_ptr, // int
);
@@ -1125,9 +1188,9 @@ debug(endnotes) {
writefln(
"%s %s",
__LINE__,
- the_endnotes_section["seg"].length
+ the_endnotes_section.length
);
- foreach (o; the_endnotes_section["seg"]) {
+ foreach (o; the_endnotes_section) {
writeln(o);
}
}
@@ -1365,9 +1428,9 @@ comp_obj_toc.obj_cite_number = "";
comp_obj_toc.indent_hang = indent["hang_position"];
comp_obj_toc.indent_base = indent["base_position"];
comp_obj_toc.bullet = false;
-if (the_endnotes_section["seg"].length > 1) {
+if (the_endnotes_section.length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Endnotes",
"endnotes", // segment_anchor_tag_that_object_belongs_to
);
@@ -1375,19 +1438,9 @@ if (the_endnotes_section["seg"].length > 1) {
comp_obj_toc.text = to!string(toc_txt_).strip;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
}
-if (the_endnotes_section["scroll"].length > 1) {
- toc_txt_ = format(
- "{ %s }#%s",
- "Endnotes",
- "endnotes", // _anchor_tag
- );
- toc_txt_= munge.url_links(toc_txt_);
- comp_obj_toc.text = to!string(toc_txt_).strip;
- the_table_of_contents_section["scroll"] ~= comp_obj_toc;
-}
if (the_glossary_section.length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffixs",
+ "{ %s }../%s.fnSuffixs",
"Glossary",
"glossary", // segment_anchor_tag_that_object_belongs_to
);
@@ -1405,7 +1458,7 @@ if (the_glossary_section.length > 1) {
}
if (the_bibliography_section.length > 1){
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Bibliography",
"bibliography", // segment_anchor_tag_that_object_belongs_to
);
@@ -1424,7 +1477,7 @@ if (the_bibliography_section.length > 1){
}
if (the_bookindex_section["seg"].length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Book Index",
"bookindex", // segment_anchor_tag_that_object_belongs_to
);
@@ -1444,7 +1497,7 @@ if (the_bookindex_section["scroll"].length > 1) {
}
if (the_blurb_section.length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Blurb",
"blurb", // segment_anchor_tag_that_object_belongs_to
);
@@ -1470,6 +1523,16 @@ debug(toc) {
writeln(mkup.indent_by_spaces_provided(toc_linked_heading.indent_hang), toc_linked_heading.text);
}
}
+debug(tocscroll) {
+ writefln(
+ "%s %s",
+ __LINE__,
+ the_table_of_contents_section["seg"].length
+ );
+ foreach (toc_linked_heading; the_table_of_contents_section["scroll"]) {
+ writeln(mkup.indent_by_spaces_provided(toc_linked_heading.indent_hang), toc_linked_heading.text);
+ }
+}
#+END_SRC
**** doc head (separate document head from body, make space for toc)
@@ -1492,16 +1555,10 @@ it is quite neat to have all in one place as we have here:
#+name: abs_post
#+BEGIN_SRC d
-if (the_endnotes_section["scroll"].length > 1) {
+if (the_endnotes_section.length > 1) {
html_segnames ~= "endnotes";
html_segnames_ptr = html_segnames_ptr_cntr;
- foreach (ref section; the_endnotes_section["scroll"]) {
- if (section.heading_lev_markup == 4) {
- section.ptr_html_segnames = html_segnames_ptr;
- break;
- }
- }
- foreach (ref section; the_endnotes_section["seg"]) {
+ foreach (ref section; the_endnotes_section) {
if (section.heading_lev_markup == 4) {
section.ptr_html_segnames = html_segnames_ptr;
break;
@@ -1561,237 +1618,273 @@ if (the_blurb_section.length > 1) {
}
#+END_SRC
-**** loop: all segments (as needed) up to document heading 1~, lev4 html: segnames & subtoc, backmatter pointers
+**** loop: all objects structural relationships (sections, segments, objects)
-could optimise by
-- skipping second and third pass unless the output html seg or epub is being made!
+needed for DOM structure, segnames & subtoc, backmatter pointers
+
+if used minimally only for DOM structure, segnames, subtoc, could optimise by
+- skipping second and third pass unless the output html seg or epub is being
+ made!
+
+or could conveniently be used more extensively for ancestors as well (though
+this can be extracted earlier)
+
+Build here:
+- DOM structure
+- ancestors and decendants
+
+(as needed) up to document heading 1~, lev4 html:
during the third pass all previous and next segment names are known
next are not yet known for backmatter during the second pass
#+name: abs_post
#+BEGIN_SRC d
-if ((opt_action_bool["html"])
-|| (opt_action_bool["html_scroll"])
-|| (opt_action_bool["html_seg"])
-|| (opt_action_bool["epub"])) {
- foreach (ref obj; the_document_head_section) {
+foreach (ref obj; the_document_head_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
+ }
+}
+if (the_table_of_contents_section["scroll"].length > 1) {
+ dom_markedup_buffer = dom_markedup.dup;
+ dom_collapsed_buffer = dom_collapsed.dup;
+ foreach (ref obj; the_table_of_contents_section["scroll"]) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ // writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
+ }
+ }
+ dom_markedup = dom_markedup_buffer.dup;
+ dom_collapsed = dom_collapsed_buffer.dup;
+ foreach (ref obj; the_table_of_contents_section["seg"]) {
if (obj.is_a == "heading") {
debug(dom) {
writeln(obj.text);
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- if (the_table_of_contents_section["scroll"].length > 1) {
- dom_markedup_buffer = dom_markedup.dup;
- dom_collapsed_buffer = dom_collapsed.dup;
- foreach (ref obj; the_table_of_contents_section["scroll"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- // writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
- }
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
- }
- }
- dom_markedup = dom_markedup_buffer.dup;
- dom_collapsed = dom_collapsed_buffer.dup;
- foreach (ref obj; the_table_of_contents_section["seg"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
+}
+/+ multiple 1~ levels, loop through document body +/
+if (the_document_body_section.length > 1) {
+ foreach (ref obj; the_document_body_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.lev4_subtoc = lev4_subtoc[obj.segment_anchor_tag];
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ multiple 1~ levels, loop through document body +/
- if (the_document_body_section.length > 1) {
- foreach (ref obj; the_document_body_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.lev4_subtoc = lev4_subtoc[obj.segment_anchor_tag];
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+}
+/+ optional only one 1~ level +/
+if (the_endnotes_section.length > 1) {
+ dom_markedup_buffer = dom_markedup.dup;
+ dom_collapsed_buffer = dom_collapsed.dup;
+ dom_markedup = dom_markedup_buffer.dup;
+ dom_collapsed = dom_collapsed_buffer.dup;
+ foreach (ref obj; the_endnotes_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_endnotes_section["scroll"].length > 1) {
- dom_markedup_buffer = dom_markedup.dup;
- dom_collapsed_buffer = dom_collapsed.dup;
- foreach (ref obj; the_endnotes_section["scroll"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
- }
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
- }
- }
- dom_markedup = dom_markedup_buffer.dup;
- dom_collapsed = dom_collapsed_buffer.dup;
- foreach (ref obj; the_endnotes_section["seg"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+}
+/+ optional only one 1~ level +/
+if (the_glossary_section.length > 1) {
+ foreach (ref obj; the_glossary_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_glossary_section.length > 1) {
- foreach (ref obj; the_glossary_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+}
+/+ optional only one 1~ level +/
+if (the_bibliography_section.length > 1) {
+ foreach (ref obj; the_bibliography_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_bibliography_section.length > 1) {
- foreach (ref obj; the_bibliography_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+}
+/+ optional only one 1~ level +/
+if (the_bookindex_section["scroll"].length > 1) {
+ dom_markedup_buffer = dom_markedup.dup;
+ dom_collapsed_buffer = dom_collapsed.dup;
+ foreach (ref obj; the_bookindex_section["scroll"]) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ // writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_bookindex_section["scroll"].length > 1) {
- dom_markedup_buffer = dom_markedup.dup;
- dom_collapsed_buffer = dom_collapsed.dup;
- foreach (ref obj; the_bookindex_section["scroll"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- // writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
- }
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
- }
- }
- dom_markedup = dom_markedup_buffer.dup;
- dom_collapsed = dom_collapsed_buffer.dup;
- foreach (ref obj; the_bookindex_section["seg"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ dom_markedup = dom_markedup_buffer.dup;
+ dom_collapsed = dom_collapsed_buffer.dup;
+ foreach (ref obj; the_bookindex_section["seg"]) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_blurb_section.length > 1) {
- foreach (ref obj; the_blurb_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+}
+/+ optional only one 1~ level +/
+if (the_blurb_section.length > 1) {
+ foreach (ref obj; the_blurb_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
+ /+ TODO
+ - note create/insert heading object sole purpose eof close all open tags
+ sort out:
+ - obj.dom_markedup = dom_markedup;
+ - obj.dom_collapsed = dom_collapsed;
+ +/
dom_markedup = dom_set_markup_tags(dom_markedup, 0);
dom_collapsed = dom_set_collapsed_tags(dom_collapsed, 0);
comp_obj_heading_ = comp_obj_heading_.init;
@@ -1824,8 +1917,7 @@ auto document_the = [
/+ substantive/body: +/
"body": the_document_body_section,
/+ backmatter: +/
- "endnotes_seg": the_endnotes_section["seg"],
- "endnotes_scroll": the_endnotes_section["scroll"],
+ "endnotes": the_endnotes_section,
"glossary": the_glossary_section,
"bibliography": the_bibliography_section,
"bookindex_scroll": the_bookindex_section["scroll"],
@@ -3792,7 +3884,7 @@ struct ObjInlineMarkup {
"hang_position" : 0,
"base_position" : 0,
];
- toc_txt_ = "{ Table of Contents }../toc.fn_suffix";
+ toc_txt_ = "{ Table of Contents }../toc.fnSuffix";
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.indent_hang = indent["hang_position"];
comp_obj_toc.indent_base = indent["base_position"];
@@ -3816,7 +3908,7 @@ struct ObjInlineMarkup {
break;
case 4:
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
heading_toc_,
segment_anchor_tag_that_object_belongs_to,
);
@@ -3833,12 +3925,12 @@ struct ObjInlineMarkup {
break;
case 5: .. case 7:
toc_txt_ = format(
- "{ %s }../%s.fn_suffix#%s",
+ "{ %s }../%s.fnSuffix#%s",
heading_toc_,
segment_anchor_tag_that_object_belongs_to,
_anchor_tag,
);
- subtoc_txt_ = format( // 5 .. 7
+ subtoc_txt_ = format(
"{ %s }#%s",
heading_toc_,
_anchor_tag,
@@ -4609,7 +4701,7 @@ struct BookIndexReportSection {
bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ");
bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty)
? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ")
- : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
+ : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", ");
}
bi_tmp_scroll ~= " \\\\\n ";
bi_tmp_seg ~= " \\\\\n ";
@@ -4626,7 +4718,7 @@ struct BookIndexReportSection {
bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ");
bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty)
? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ")
- : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
+ : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", ");
}
bi_tmp_scroll ~= " \\\\\n ";
bi_tmp_seg ~= " \\\\\n ";
@@ -4721,25 +4813,21 @@ struct NotesSection {
) {
debug(endnotes_build) {
writeln(
- "{^{", m.captures[1], ".}^}../", segment_anchor_tag_that_object_belongs_to, ".fn_suffix#noteref_\n ", m.captures[1], " ",
+ "{^{", m.captures[1], ".}^}../", segment_anchor_tag_that_object_belongs_to, ".fnSuffix#noteref_\n ", m.captures[1], " ",
m.captures[2]); // sometimes need segment name (segmented html & epub)
}
// TODO NEXT you need anchor for segments at this point ->
object_notes["anchor"] ~= "#note_" ~ m.captures[1] ~ "』";
- object_notes["seg"] ~= (segment_anchor_tag_that_object_belongs_to.empty)
+ object_notes["notes"] ~= (segment_anchor_tag_that_object_belongs_to.empty)
? (munge.url_links(
"{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
m.captures[1]) ~ " " ~ m.captures[2] ~ "』"
)
: (munge.url_links(
- "{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#noteref_" ~
+ "{^{" ~ m.captures[1] ~ ".}^}../" ~
+ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#noteref_" ~
m.captures[1]) ~ " " ~ m.captures[2] ~ "』"
);
- object_notes["scroll"] ~=
- munge.url_links(
- "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
- m.captures[1]
- ) ~ " " ~ m.captures[2] ~ "』";
}
return object_notes;
}
@@ -4755,12 +4843,10 @@ struct NotesSection {
body {
string[][string] endnotes_;
if (object_notes.length > 1) {
- endnotes_["seg"] = (split(object_notes["seg"], rgx.break_string))[0..$-1];
- endnotes_["scroll"] = (split(object_notes["scroll"], rgx.break_string))[0..$-1];
+ endnotes_["notes"] = (split(object_notes["notes"], rgx.break_string))[0..$-1];
endnotes_["anchor"] = (split(object_notes["anchor"], rgx.break_string))[0..$-1];
} else {
- endnotes_["seg"] = [];
- endnotes_["scroll"] = [];
+ endnotes_["notes"] = [];
endnotes_["anchor"] = [];
}
return endnotes_;
@@ -4779,14 +4865,14 @@ struct NotesSection {
}
body {
mixin SiSUnode;
- ObjGenericComposite[][string] the_endnotes_section;
+ ObjGenericComposite[] the_endnotes_section;
auto endnotes_ = gathered_notes();
string type_is;
string lev, lev_markup_number, lev_collapsed_number;
string attrib;
int[string] indent;
ObjGenericComposite comp_obj_heading_;
- if ((endnotes_["seg"].length > 0)
+ if ((endnotes_["notes"].length > 0)
&& (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) {
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.use = "backmatter";
@@ -4800,8 +4886,7 @@ struct NotesSection {
comp_obj_heading_.heading_lev_collapsed = 1;
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
- the_endnotes_section["seg"] ~= comp_obj_heading_;
- the_endnotes_section["scroll"] ~= comp_obj_heading_;
+ the_endnotes_section ~= comp_obj_heading_;
++obj_cite_number;
++mkn;
comp_obj_heading_ = comp_obj_heading_.init;
@@ -4818,8 +4903,7 @@ struct NotesSection {
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
comp_obj_heading_.anchor_tags = ["endnotes"];
- the_endnotes_section["seg"] ~= comp_obj_heading_;
- the_endnotes_section["scroll"] ~= comp_obj_heading_;
+ the_endnotes_section ~= comp_obj_heading_;
++obj_cite_number;
++mkn;
} else {
@@ -4835,8 +4919,7 @@ struct NotesSection {
comp_obj_heading_.heading_lev_collapsed = 1;
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
- the_endnotes_section["seg"] ~= comp_obj_heading_;
- the_endnotes_section["scroll"] ~= comp_obj_heading_;
+ the_endnotes_section ~= comp_obj_heading_;
}
if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) {
ObjGenericComposite comp_obj_endnote_;
@@ -4849,21 +4932,13 @@ struct NotesSection {
comp_obj_endnote_.indent_hang = 0;
comp_obj_endnote_.indent_base = 0;
comp_obj_endnote_.bullet = false;
- foreach (i, endnote; endnotes_["seg"]) {
+ foreach (i, endnote; endnotes_["notes"]) {
auto m = (matchFirst(endnote, rgx.note_ref));
string notenumber = to!string(m.captures[1]);
string anchor_tag = "note_" ~ notenumber;
comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix
comp_obj_endnote_.text = endnote.strip;
- the_endnotes_section["seg"] ~= comp_obj_endnote_;
- }
- foreach (i, endnote; endnotes_["scroll"]) {
- auto m = (matchFirst(endnote, rgx.note_ref));
- string notenumber = to!string(m.captures[1]);
- string anchor_tag = "note_" ~ notenumber;
- comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix
- comp_obj_endnote_.text = endnote.strip;
- the_endnotes_section["scroll"] ~= comp_obj_endnote_;
+ the_endnotes_section ~= comp_obj_endnote_;
}
}
auto t = tuple(the_endnotes_section, obj_cite_number);
@@ -5076,6 +5151,7 @@ struct NodeStructureMetadata {
int obj_cite_number_,
int cntr_,
int ptr_,
+ string[] lv_ancestors,
string is_,
int html_segnames_ptr,
)
@@ -5177,22 +5253,23 @@ struct NodeStructureMetadata {
break;
}
ObjGenericComposite _comp_obj_heading_;
- _comp_obj_heading_ = _comp_obj_heading_.init;
- _comp_obj_heading_.use = "body";
- _comp_obj_heading_.is_of = "para";
- _comp_obj_heading_.is_a = "heading";
- _comp_obj_heading_.text = to!string(_text).strip;
- _comp_obj_heading_.ocn = obj_cite_number_;
- _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
- _comp_obj_heading_.segment_anchor_tag = to!string(segment_anchor_tag);
- _comp_obj_heading_.marked_up_level = lev;
- _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0);
- _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0);
- _comp_obj_heading_.parent_ocn = p_["obj_cite_number"];
- _comp_obj_heading_.parent_lev_markup = p_["lev_markup_number"];
- _comp_obj_heading_.ptr_doc_object = cntr_;
- _comp_obj_heading_.ptr_html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0);
- _comp_obj_heading_.ptr_heading = ptr_;
+ _comp_obj_heading_ = _comp_obj_heading_.init;
+ _comp_obj_heading_.use = "body";
+ _comp_obj_heading_.is_of = "para";
+ _comp_obj_heading_.is_a = "heading"; // _node_heading_.is_a = is_; // check whether needed, constant???
+ _comp_obj_heading_.text = to!string(_text).strip;
+ _comp_obj_heading_.ocn = obj_cite_number_;
+ _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
+ _comp_obj_heading_.segment_anchor_tag = to!string(segment_anchor_tag);
+ _comp_obj_heading_.marked_up_level = lev;
+ _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0);
+ _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0);
+ _comp_obj_heading_.parent_ocn = p_["obj_cite_number"];
+ _comp_obj_heading_.parent_lev_markup = p_["lev_markup_number"];
+ _comp_obj_heading_.heading_ancestors_text = lv_ancestors;
+ _comp_obj_heading_.ptr_doc_object = cntr_;
+ _comp_obj_heading_.ptr_html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0);
+ _comp_obj_heading_.ptr_heading = ptr_;
debug(node) {
if (match(lev_markup_number, rgx.levels_numbered_headings)) {
writeln("* ", to!string(_node));
@@ -5506,6 +5583,7 @@ struct ObjGenericComposite {
int heading_lev_collapsed = 9;
int[] heading_closes_lev_collapsed = [];
int[] heading_closes_lev_markup = [];
+ string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ];
int heading_array_ptr = 0;
int ptr_doc_object = 0;
int ptr_html_segnames = 0;
@@ -5514,8 +5592,8 @@ struct ObjGenericComposite {
int heading_array_ptr_segments = 0;
string[] lev4_subtoc = [];
string[string][string] node;
- int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0,];
- int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0,];
+ int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0,];
+ int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0,];
}
#+END_SRC
@@ -5527,63 +5605,3 @@ struct TheObjects {
ObjGenericComposite[] oca;
}
#+END_SRC
-
-* Notes
-** abstract document structure
-
-#+BEGIN_SRC d
-auto document_abstract_objects = (
- "head": the_document_head_section, // split from rest of content
- "toc_seg": the_table_of_contents_section["seg"], // table of contents for seg
- "toc_scroll": the_table_of_contents_section["scroll"], // table of contents for scroll
- "body": the_document_body_section,
- "endnotes_seg": the_endnotes_section["seg"],
- "endnotes_scroll": the_endnotes_section["scroll"],
- "glossary": the_glossary_section,
- "bibliography": the_bibliography_section,
- "bookindex_scroll": the_bookindex_section["scroll"],
- "bookindex_seg": the_bookindex_section["seg"],
- "blurb": the_blurb_section,
-);
-#+END_SRC
-
-** TODO work on
-
-- bespoke struct for sisu objects to replace JSON strings
-- book index *sort* fix (Aa-Zz instead of A-Za-z)
-- determine what goes in node info
- - understand collapsed level
-- convert file utf8 for processing from to utf32
-
-- general concepts
- - ranges
- - templates
- - unitest?
-
-|---------------------+------------------------------------------+------------------------+--------|
-| 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 |
-|---------------------+------------------------------------------+------------------------+--------|
diff --git a/org/ao_defaults.org b/org/ao_defaults.org
index 24baffb..28ed15c 100644
--- a/org/ao_defaults.org
+++ b/org/ao_defaults.org
@@ -33,6 +33,7 @@
+/
template RgxInit() {
struct Rgx {
+ mixin SiSUlanguageCodes;
<<ao_rgx>>
}
}
@@ -293,11 +294,11 @@ template SiSUregisters() {
#+name: ao_defaults_templates
#+BEGIN_SRC d
/+
-/+
- unify internal representation of header info for native & sdlang document headers
- represent either using struct, hashes or possibly json
- sdp internal representation should be identical for native & sdlang variants
-+/
+ /+
+ unify internal representation of header info for native & sdlang document headers
+ represent either using struct, hashes or possibly json
+ sdp internal representation should be identical for native & sdlang variants
+ +/
header.
├── make // make instructions
│   ├── bold
@@ -368,6 +369,99 @@ header.
+/
#+END_SRC
+** template: language codes
+
+#+name: ao_defaults_templates
+#+BEGIN_SRC d
+template SiSUlanguageCodes() {
+ /+ language codes +/
+ struct Lang {
+ string[string][string] codes() {
+ auto _lang_codes = [
+ "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ],
+ "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ],
+ "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ],
+ "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ],
+ "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ],
+ "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ],
+ "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ],
+ "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ],
+ "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ],
+ "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ],
+ "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
+ "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ],
+ "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ],
+ "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ],
+ "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ],
+ "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ],
+ "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ],
+ "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ],
+ "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ],
+ "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ],
+ "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ],
+ "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ],
+ "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ],
+ "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ],
+ "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ],
+ "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ],
+ "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ],
+ "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ],
+ "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ],
+ "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ],
+ "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ],
+ "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ],
+ "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ],
+ "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ],
+ "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ],
+ "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ],
+ "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ],
+ "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ],
+ "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ],
+ "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ],
+ "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ],
+ "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ],
+ "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ],
+ "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ],
+ "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ],
+ "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ],
+ "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ],
+ "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ],
+ "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ],
+ "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ],
+ "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ],
+ "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ],
+ "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ],
+ "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ],
+ "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ],
+ "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ],
+ "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ],
+ "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ],
+ "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ],
+ "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ],
+ "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
+ "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ],
+ ];
+ return _lang_codes;
+ }
+ string[] code_arr_ptr() {
+ auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",];
+ return _lang_codes;
+ }
+ string[] code_arr() {
+ auto _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"];
+ return _lang_codes;
+ }
+ auto codes_() {
+ // return join(code_arr,"|");
+ return "(" ~ join(code_arr,"|") ~ ")";
+ }
+ auto codes_regex() {
+ return regex(codes_);
+ }
+ }
+}
+#+END_SRC
+
** template: flags regex initialize :regex_flags:
#+name: ao_defaults_templates
@@ -498,6 +592,113 @@ template SiSUbiblio() {
}
#+END_SRC
+** TODO template: dir paths :dir:path:
+
+#+name: ao_defaults_templates
+#+BEGIN_SRC d
+template SiSUpaths() {
+ string _base_filename(string fn_src) {
+ string _fn_base = "";
+ if (extension(fn_src) == ".sst") {
+ _fn_base = baseName(fn_src, ".sst");
+ } else if (extension(fn_src) == ".ssm") {
+ _fn_base = baseName(fn_src, ".ssm");
+ }
+ return _fn_base;
+ }
+ struct DirPaths {
+ string base_filename(string fn_src) {
+ return _base_filename(fn_src);
+ }
+ }
+ struct SiSUpodPaths {
+ string base_filename(string fn_src) {
+ return _base_filename(fn_src);
+ }
+ string base(string fn_src) {
+ return chainPath("sisupod", _base_filename(fn_src)).array;
+ }
+ string doc(string fn_src) {
+ return chainPath(base(fn_src), "doc").array;
+ }
+ string doc_lng(string fn_src, string lng) {
+ return chainPath(doc(fn_src), lng).array;
+ }
+ string image(string fn_src) {
+ return chainPath(base(fn_src), "image").array;
+ }
+ string conf(string fn_src) {
+ return chainPath(base(fn_src), "conf").array;
+ }
+ string css(string fn_src) {
+ return chainPath(base(fn_src), "css").array;
+ }
+ string fn_doc(string fn_src, string lng) {
+ return chainPath((doc_lng(fn_src, lng)), baseName(fn_src)).array;
+ }
+ }
+ struct HtmlPaths {
+ string base_filename(string fn_src) {
+ return _base_filename(fn_src);
+ }
+ string base() {
+ return chainPath("en", "html").array;
+ }
+ string seg(string fn_src) {
+ return chainPath(base, _base_filename(fn_src)).array;
+ }
+ string fn_scroll(string fn_src) {
+ return chainPath(base, _base_filename(fn_src) ~ ".html").array;
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return chainPath(seg(fn_src), seg_filename ~ ".html").array;
+ }
+ // string fn_css(string fn_src) {
+ // // // return chainPath(seg(fn_src), "html.css").array;
+ // }
+ }
+ struct EpubPaths {
+ string base_filename(string fn_src) {
+ return _base_filename(fn_src);
+ }
+ string base() {
+ return chainPath("en", "epub").array;
+ }
+ string doc(string fn_src) {
+ return chainPath(base, _base_filename(fn_src)).array;
+ // return chainPath(base, base_fn).array;
+ }
+ string doc_meta_inf(string fn_src) {
+ return chainPath(doc(fn_src), "META-INF").array;
+ }
+ string doc_oebps(string fn_src) {
+ return chainPath(doc(fn_src), "OEBPS").array;
+ }
+ string doc_oebps_css(string fn_src) {
+ return chainPath(doc_oebps(fn_src), "css").array;
+ }
+ string doc_oebps_image(string fn_src) {
+ return chainPath(doc_oebps(fn_src), "image").array;
+ }
+ string fn_mimetypes(string fn_src) {
+ return chainPath(doc(fn_src), "mimetypes").array;
+ }
+ string fn_dmi_container_xml(string fn_src) {
+ return chainPath(doc_meta_inf(fn_src), "container.xml").array;
+ }
+ string fn_oebps_toc_ncx(string fn_src) {
+ return chainPath(doc_oebps(fn_src), "toc.ncx").array;
+ }
+ string fn_oebps_content_opf(string fn_src) {
+ return chainPath(doc_oebps(fn_src), "content.opf").array;
+ }
+ string fn_oebps_content_xhtml(string fn_src, string seg_filename) {
+ return chainPath(doc_oebps(fn_src), seg_filename ~ ".xhtml").array;
+ }
+ }
+}
+#+END_SRC
+
** template: internal markup :markup:
#+name: ao_defaults_templates
diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org
index 886adb1..f0a8cab 100644
--- a/org/ao_output_debugs.org
+++ b/org/ao_output_debugs.org
@@ -23,14 +23,9 @@
+/
template SiSUoutputDebugs() {
struct SDPoutputDebugs {
- auto abstract_doc_source_debugs(S)(
+ auto abstract_doc_source_debugs(S,T)(
auto ref const S contents,
- string[][string] document_section_keys_sequenced,
- string[] html_segnames,
- string[string][string] dochead_make,
- string[string][string] dochead_meta,
- string fn_src,
- bool[string] opt_action_bool
+ auto ref T doc_matters,
) {
mixin RgxInit;
mixin InternalMarkup;
@@ -66,7 +61,7 @@ debug(parent) {
__FILE__,
__LINE__,
);
- foreach (key; document_section_keys_sequenced["seg"]) {
+ foreach (key; doc_matters.keys_seq_seg) {
foreach (obj; contents[key]) {
if (obj.use != "empty") {
if (obj.is_a == "heading") {
@@ -112,16 +107,15 @@ debug(dumpdoc) {
#+name: ao_output_debugs
#+BEGIN_SRC d
-void out_segnames(S)(
+void out_segnames(S,T)(
auto ref const S contents,
- string[] keys,
- string[] html_segnames,
+ auto ref T doc_matters,
) {
- foreach (key; keys) {
+ foreach (key; doc_matters.keys_seq_seg) {
if (contents[key].length > 1) {
foreach (obj; contents[key]) {
if (obj.heading_lev_markup == 4) {
- writeln(obj.ptr_html_segnames, ". (", html_segnames[obj.ptr_html_segnames], ") -> ", obj.text);
+ writeln(obj.ptr_html_segnames, ". (", doc_matters.segnames[obj.ptr_html_segnames], ") -> ", obj.text);
}
}
}
@@ -247,26 +241,8 @@ debug(section_toc_scroll) {
#+name: ao_output_debugs
#+BEGIN_SRC d
debug(segnames) {
- key="toc_scroll";
writeln(__LINE__);
- string[] keys;
- keys ~= [ "toc_seg", "body" ];
- if (contents["endnotes_seg"].length > 1) {
- keys ~= "endnotes_seg";
- }
- if (contents["glossary"].length > 1) {
- keys ~= "glossary";
- }
- if (contents["bibliography"].length > 1) {
- keys ~= "bibliography";
- }
- if (contents["bookindex_seg"].length > 1) {
- keys ~= "bookindex_seg";
- }
- if (contents["blurb"].length > 1) {
- keys ~= "blurb";
- }
- out_segnames(contents, keys, html_segnames);
+ out_segnames(contents, doc_matters);
}
#+END_SRC
@@ -295,7 +271,7 @@ debug(section_body) {
#+BEGIN_SRC d
debug(dom) {
enum DomTags { none, open, close, close_and_open, open_still, }
- foreach (sect; document_section_keys_sequenced["seg"]) {
+ foreach (sect; doc_matters.keys_seq_seg) {
foreach (obj; contents[sect]) {
if (obj.is_a == "heading") {
foreach_reverse (k; 0 .. 7) {
@@ -318,7 +294,7 @@ debug(dom) {
}
}
writeln("--------------------");
- foreach (sect; document_section_keys_sequenced["seg"]) {
+ foreach (sect; doc_matters.keys_seq_seg) {
foreach (obj; contents[sect]) {
if (obj.is_a == "heading") {
foreach_reverse (k; 0 .. 7) {
@@ -350,7 +326,7 @@ debug(dom) {
#+name: ao_output_debugs
#+BEGIN_SRC d
debug(section_endnotes) {
- key="endnotes_seg";
+ key="endnotes";
out_endnotes(contents, key);
}
#+END_SRC
@@ -360,17 +336,7 @@ debug(section_endnotes) {
#+name: ao_output_debugs
#+BEGIN_SRC d
debug(section_endnotes_seg) {
- key="endnotes_seg";
- out_endnotes(contents, key);
-}
-#+END_SRC
-
-**** endnotes scroll
-
-#+name: ao_output_debugs
-#+BEGIN_SRC d
-debug(section_endnotes_scroll) {
- key="endnotes_scroll";
+ key="endnotes";
out_endnotes(contents, key);
}
#+END_SRC
@@ -497,19 +463,19 @@ debug(headermakejson) {
writefln(
"%s\n%s\n%s",
"document header, metadata & make instructions:",
- dochead_meta,
+ doc_matters.dochead_meta,
ptr_head_main,
);
foreach (main_header; ptr_head_main) {
switch (main_header) {
case "make":
foreach (sub_header; ptr_head_sub_make) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
@@ -529,115 +495,115 @@ debug(headermetadatajson) {
writefln(
"%s\n%s\n%s",
"document header, metadata & make instructions:",
- dochead_meta,
+ doc_matters.dochead_meta,
ptr_head_main,
);
foreach (main_header; ptr_head_main) {
switch (main_header) {
case "creator":
foreach (sub_header; ptr_head_sub_creator) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "title":
foreach (sub_header; ptr_head_sub_title) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "rights":
foreach (sub_header; ptr_head_sub_rights) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "date":
foreach (sub_header; ptr_head_sub_date) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "original":
foreach (sub_header; ptr_head_sub_original) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "classify":
foreach (sub_header; ptr_head_sub_classify) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "identifier":
foreach (sub_header; ptr_head_sub_identifier) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "notes":
foreach (sub_header; ptr_head_sub_notes) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
break;
case "publisher":
foreach (sub_header; ptr_head_sub_publisher) {
- if (to!string(dochead_meta[main_header][sub_header]).length > 2) {
+ if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) {
writefln(
"%s:%s: %s",
main_header,
sub_header,
- dochead_meta[main_header][sub_header]
+ doc_matters.dochead_meta[main_header][sub_header]
);
}
}
@@ -660,7 +626,7 @@ debug(anchor) {
__FILE__,
__LINE__,
);
- foreach (k; document_section_keys_sequenced["seg"]) {
+ foreach (k; doc_matters.keys_seq_seg) {
foreach (obj; contents[k]) {
if (obj.is_a == "heading") {
writefln(
@@ -682,7 +648,7 @@ debug(anchor) {
#+name: ao_output_debugs
#+BEGIN_SRC d
debug(heading) { // heading
- foreach (k; document_section_keys_sequenced["seg"]) {
+ foreach (k; doc_matters.keys_seq_seg) {
foreach (o; contents[k]) {
if (o.is_a == "heading") {
writefln(
@@ -709,7 +675,7 @@ debug(headings) {
__FILE__,
__LINE__,
);
- foreach (k; document_section_keys_sequenced["seg"]) {
+ foreach (k; doc_matters.keys_seq_seg) {
foreach (obj; contents[k]) {
if (obj.is_a == "heading") {
writefln(
@@ -738,7 +704,7 @@ debug(summary) {
#+name: ao_output_debugs_summary
#+BEGIN_SRC d
debug(checkdoc) {
- foreach (k; document_section_keys_sequenced["seg"]) {
+ foreach (k; doc_matters.keys_seq_seg) {
foreach (obj; contents[k]) {
if (obj.use != "empty") {
if (!empty(obj.obj_cite_number)) {
@@ -757,9 +723,9 @@ debug(checkdoc) {
writefln(
"%s\n\"%s\", %s\n%s\n%s\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n(%s: %s)",
"---------------------------------",
- dochead_meta["title"]["full"],
- dochead_meta["creator"]["author"],
- fn_src,
+ doc_matters.dochead_meta["title"]["full"],
+ doc_matters.dochead_meta["creator"]["author"],
+ doc_matters.source_filename,
"---------------------------------",
"length toc array: ",
to!int(contents["toc_seg"].length),
@@ -768,8 +734,8 @@ writefln(
"last obj_cite_number: ",
to!int(check["last_obj_cite_number"]),
"length endnotes: ",
- (contents["endnotes_seg"].length > 1)
- ? (to!int(contents["endnotes_seg"].length))
+ (contents["endnotes"].length > 1)
+ ? (to!int(contents["endnotes"].length))
: 0,
"length glossary: ",
(contents["glossary"].length > 1)
@@ -797,8 +763,8 @@ writefln(
#+name: ao_output_debugs_summary
#+BEGIN_SRC d
debug(checkdoc) {
- if (auto mfn=match(fn_src, rgx.src_fn)) {
- if (opt_action_bool["assertions"]) {
+ if (auto mfn=match(doc_matters.source_filename, rgx.src_fn)) {
+ if (doc_matters.opt_action_bool["assertions"]) {
switch (mfn.captures[2]) {
// live manual:
case "live-manual.ssm":
@@ -917,7 +883,7 @@ debug(checkdoc) {
// error in bookindex ... (ch7 ... building the cc machine, an extra semi colon)
break;
default:
- writeln(fn_src);
+ writeln(doc_matters.source_filename);
break;
}
}
diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org
index 05e15eb..819f1ff 100644
--- a/org/ao_read_source_files.org
+++ b/org/ao_read_source_files.org
@@ -158,10 +158,13 @@ WORK AREA
#+name: ao_config_file_in
#+BEGIN_SRC d
final private string readInConfigFile(string conf_sdl) {
+ string dot_pwd = chainPath(to!string(environment["PWD"]), ".sisu").array;
+ string underscore_pwd = chainPath(to!string(environment["PWD"]), "_sisu").array;
+ string dot_home = chainPath(to!string(environment["HOME"]), ".sisu").array;
string[] possible_config_path_locations = [
- environment["PWD"] ~ "/.sisu",
- environment["PWD"] ~ "/_sisu",
- environment["HOME"] ~ "/.sisu",
+ dot_pwd,
+ underscore_pwd,
+ dot_home,
"/etc/sisu"
];
string config_file_str;
@@ -232,7 +235,7 @@ final private auto configSDLang(string conf_sdl) {
#+name: ao_markup_source_raw_read_file_source_string
#+BEGIN_SRC d
-final private string readInMarkupSource(in string fn_src) {
+final private string readInMarkupSource(in char[] fn_src) {
enforce(
exists(fn_src)!=0,
"file not found"
@@ -334,7 +337,10 @@ auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {
#+name: ao_markup_source_raw_get_insert_source_line_array
#+BEGIN_SRC d
-final char[][] getInsertMarkupSourceContentRawLineArray(in string fn_src, Regex!(char) rgx_file) {
+final char[][] getInsertMarkupSourceContentRawLineArray(
+ in char[] fn_src,
+ Regex!(char) rgx_file
+) {
enforce(
match(fn_src, rgx_file),
"not a sisu markup filename"
@@ -405,7 +411,7 @@ if (type1["curly_code"] == 1) {
auto insert_fn = m.captures[2];
auto insert_sub_pth = m.captures[1];
auto fn_src_insert =
- to!string(markup_src_file_path ~ insert_sub_pth ~ insert_fn);
+ chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array;
auto raw = MarkupRawUnit();
auto markup_sourcesubfile_insert_content =
raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts);
@@ -477,7 +483,7 @@ if (type["curly_code"] == 1) {
auto insert_fn = m.captures[2];
auto insert_sub_pth = m.captures[1];
auto fn_src_insert =
- to!string(markup_src_file_path ~ insert_sub_pth ~ insert_fn);
+ chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array;
auto raw = MarkupRawUnit();
/+ TODO +/
if (auto ma = match(line, rgx.src_fn_text)) {
diff --git a/org/output.org b/org/output.org
index e9253dc..6292faa 100644
--- a/org/output.org
+++ b/org/output.org
@@ -23,51 +23,70 @@
+/
template SiSUoutputHub() {
struct SDPoutput {
- void hub(S)(
+ void hub(S,T)(
auto ref const S contents,
- string[][string] document_section_keys_sequenced,
- string[] html_segnames,
- string[string][string] dochead_make,
- string[string][string] dochead_meta,
- string fn_src,
- bool[string] opt_action_bool
+ auto ref T doc_matters,
) {
auto rgx = Rgx();
- if (opt_action_bool["source"]) {
- writeln("sisupod source");
+ if (doc_matters.opt_action_bool["source"]) {
+ writeln("source");
}
- if (opt_action_bool["sisupod"]) {
+ if (doc_matters.opt_action_bool["sisupod"]) {
+ mixin SiSUpod;
+ auto sisupod=SDPsisupod();
+ sisupod.sisupod_assemble(doc_matters.source_filename);
writeln("sisupod source");
}
- if (opt_action_bool["text"]) {
+ if (doc_matters.opt_action_bool["text"]) {
writeln("text processing");
}
- if (opt_action_bool["html"]) {
+ if (doc_matters.opt_action_bool["html"]) {
mixin SiSUoutputHTML;
auto html=SDPoutputHTML();
html.css_write;
html.scroll(
contents,
- document_section_keys_sequenced,
- dochead_make,
- dochead_meta,
- fn_src,
- opt_action_bool
+ doc_matters,
+ );
+ html.seg(
+ contents,
+ doc_matters,
+ );
+ } else if(doc_matters.opt_action_bool["html_seg"]) {
+ mixin SiSUoutputHTML;
+ auto html=SDPoutputHTML();
+ html.css_write;
+ html.seg(
+ contents,
+ doc_matters,
+ );
+ } else if(doc_matters.opt_action_bool["html_scroll"]) {
+ mixin SiSUoutputHTML;
+ auto html=SDPoutputHTML();
+ html.css_write;
+ html.scroll(
+ contents,
+ doc_matters,
);
}
- if (opt_action_bool["epub"]) {
- writeln("epub processing");
+ if (doc_matters.opt_action_bool["epub"]) {
+ mixin SiSUoutputEPub;
+ auto epub=SDPoutputEPub();
+ epub.doc_content( // consolidate
+ contents,
+ doc_matters,
+ );
}
- if (opt_action_bool["pdf"]) {
+ if (doc_matters.opt_action_bool["pdf"]) {
writeln("pdf processing");
}
- if (opt_action_bool["odt"]) {
+ if (doc_matters.opt_action_bool["odt"]) {
writeln("odt processing");
}
- if (opt_action_bool["sqlite"]) {
+ if (doc_matters.opt_action_bool["sqlite"]) {
writeln("sqlite processing");
}
- if (opt_action_bool["postgresql"]) {
+ if (doc_matters.opt_action_bool["postgresql"]) {
writeln("pgsql processing");
}
}
@@ -75,27 +94,115 @@ template SiSUoutputHub() {
}
#+END_SRC
-** templates outpt types (file, db)s
+** templates output types (file, db)s
+*** sisupod
+
+#+BEGIN_SRC d :tangle ../src/sdp/source_sisupod.d
+template SiSUpod() {
+ struct SDPsisupod {
+ <<source_sisupod_mkdirs>>
+ <<source_sisupod_config>>
+ <<source_sisupod_text>>
+ <<source_sisupod_images>>
+ }
+}
+#+END_SRC
+
+*** text
+*** xhtml common
+
+#+BEGIN_SRC d :tangle ../src/sdp/output_xhtmls.d
+template SiSUoutputXHTMLs() {
+ struct SDPoutputXHTMLs {
+ <<xhtml_format_objects>>
+<<xhtml_format_objects_code>>
+ }
+}
+#+END_SRC
+
*** html
#+BEGIN_SRC d :tangle ../src/sdp/output_html.d
template SiSUoutputHTML() {
struct SDPoutputHTML {
+ mixin SiSUoutputXHTMLs;
<<output_html>>
+ <<output_html_scroll>>
+ <<output_html_seg>>
<<output_html_css>>
}
}
#+END_SRC
+*** epub
+
+#+BEGIN_SRC d :tangle ../src/sdp/output_epub.d
+template SiSUoutputEPub() {
+ struct SDPoutputEPub {
+ mixin InternalMarkup;
+ mixin SiSUoutputXHTMLs;
+ <<output_epub_fixed>>
+ <<output_epub_constructs>>
+ <<output_epub_xhtml>>
+ <<output_epub_xhtml_seg>>
+ <<output_epub_css>>
+ }
+}
+#+END_SRC
+
* output functions :output:
-** text :text:
-** html [#A] :html:
-*** html text objects
+** sisupod :sisupod:
+*** TODO output files
+
+#+name: source_sisupod_config
+#+BEGIN_SRC d
+void sisupod_assemble(
+ string fn_src,
+) {
+ mixin SiSUpaths;
+ auto pth_sisupod = SiSUpodPaths();
+ mixin SiSUlanguageCodes;
+ auto lang = Lang();
+ /+
+ dir structure
+ /tmp/_sisu_processing_/ralph/en/sisupod
+ ├── doc
+ │   └── en
+ └── image
+
+ - create directory structure
+
+ +/
+ assert (match(fn_src, rgx.src_fn));
+ try {
+ /+ create directory structure +/
+ mkdirRecurse(pth_sisupod.doc(fn_src));
+ mkdirRecurse(pth_sisupod.conf(fn_src));
+ mkdirRecurse(pth_sisupod.css(fn_src));
+ mkdirRecurse(pth_sisupod.image(fn_src));
+ /+ copy relevant files +/
+ auto f_out = pth_sisupod.fn_doc(fn_src, "en"); // you need fn without path and then to insert back language code for output sub-directory
+ debug(sisupod) {
+ writeln(__LINE__, ": ", fn_src, " -> ", f_out);
+ }
+ mkdirRecurse(pth_sisupod.doc_lng(fn_src, "en")); // need to extract language code directories (from directory structure or filenames & have a default)
+ copy(fn_src, f_out);
+ }
+ catch (ErrnoException ex) {
+ // Handle error
+ }
+}
+#+END_SRC
+
+** text [#C] :text:
+** xml offspring (xhtml html epub)
+*** format xhtml objects :format:
**** misc
+***** anchor tags
-#+name: output_html
+#+name: xhtml_format_objects
#+BEGIN_SRC d
-string _html_anchor_tags(const(string[]) anchor_tags) {
+string _xhtml_anchor_tags(const(string[]) anchor_tags) {
string tags="";
if (anchor_tags.length > 0) {
foreach (tag; anchor_tags) {
@@ -108,14 +215,136 @@ string _html_anchor_tags(const(string[]) anchor_tags) {
}
#+END_SRC
+***** doc head & tails
+****** scroll head
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto scroll_head(
+ string[string][string] dochead_meta,
+) {
+ string o;
+ 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)" />
+ <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>¶",
+dochead_meta["title"]["full"],
+(dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"],
+);
+ return o;
+}
+#+END_SRC
+
+****** seg head
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto seg_head(
+ string[string][string] dochead_meta,
+) {
+ string o;
+ 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)" />
+ <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>¶",
+dochead_meta["title"]["full"],
+(dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"],
+);
+ return o;
+}
+#+END_SRC
+
+****** xhtml tail
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto 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
+
+**** toc
+
+#+name: xhtml_format_objects
+#+BEGIN_SRC d
+auto toc(O)(
+ auto ref const O obj,
+) {
+ 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,
+ obj.text
+ );
+ return o;
+}
+#+END_SRC
+
**** heading
-#+name: output_html
+#+name: xhtml_format_objects
#+BEGIN_SRC d
-auto html_heading(O)(
+auto heading(O)(
auto ref const O obj,
) {
- auto tags = _html_anchor_tags(obj.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶<br><hr /><br>
@@ -155,12 +384,12 @@ auto html_heading(O)(
**** para
-#+name: output_html
+#+name: xhtml_format_objects
#+BEGIN_SRC d
-auto html_para(O)(
+auto para(O)(
auto ref const O obj,
) {
- auto tags = _html_anchor_tags(obj.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj.anchor_tags);
string o;
if (obj.obj_cite_number.empty) {
o = format(q"¶ <div class="substance">
@@ -197,9 +426,9 @@ auto html_para(O)(
**** nugget
-#+name: output_html
+#+name: xhtml_format_objects
#+BEGIN_SRC d
-auto html_nugget(O)(
+auto nugget(O)(
auto ref const O obj,
) {
string o;
@@ -230,73 +459,11 @@ auto html_nugget(O)(
}
#+END_SRC
-**** scroll head
+**** endnote
-#+name: output_html
+#+name: xhtml_format_objects
#+BEGIN_SRC d
-auto scroll_head_html() {
- string o;
- 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)" />
- <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>¶",
-dochead_meta["title"]["full"],
-(dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"],
-);
- return o;
-}
-#+END_SRC
-
-**** scroll toc
-
-#+name: output_html
-#+BEGIN_SRC d
-auto html_toc(O)(
- auto ref const O obj,
-) {
- 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,
- obj.text
- );
- return o;
-}
-#+END_SRC
-
-**** scroll endnote
-
-#+name: output_html
-#+BEGIN_SRC d
-auto html_endnote(O)(
+auto endnote(O)(
auto ref const O obj,
) {
string o;
@@ -312,48 +479,89 @@ auto html_endnote(O)(
}
#+END_SRC
-**** scroll tail
+**** code
-#+name: output_html
+#+name: xhtml_format_objects_code
#+BEGIN_SRC d
-auto scroll_tail_html() {
- string o;
- o = format(q"¶ <a name="bottom" id="bottom"></a>
- <a name="end" id="end"></a>
-</div>
-</body>
-</html>¶");
- return o;
+ auto code(O)(
+ auto ref const O obj,
+ ) {
+ string o;
+ 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
+ );
+ }
+ return o;
+ }
+#+END_SRC
+
+*** html output [#A] :html:
+**** scroll :scroll:
+***** output file
+
+#+name: output_html_scroll
+#+BEGIN_SRC d
+void scroll_write_output_file(
+ string fn_src,
+ string[] doc,
+) {
+ mixin SiSUpaths;
+ auto pth_html = HtmlPaths();
+ try {
+ mkdirRecurse(pth_html.base);
+ auto f = File(pth_html.fn_scroll(fn_src), "w");
+ foreach (o; doc) {
+ f.writeln(o);
+ }
+ }
+ catch (ErrnoException ex) {
+ // Handle error
+ }
}
#+END_SRC
-*** html hub, sort objects [#A]
-**** scroll
+***** (sections & objects) switch (for html output format)
-#+name: output_html
+#+name: output_html_scroll
#+BEGIN_SRC d
-void scroll(C)(
+void scroll(C,T)(
auto ref const C contents,
- string[][string] document_section_keys_sequenced,
- string[string][string] dochead_make,
- string[string][string] dochead_meta,
- string fn_src,
- bool[string] opt_action_bool
+ auto ref T doc_matters,
) {
+ auto xhtml_format = SDPoutputXHTMLs();
auto rgx = Rgx();
- string[] body_html;
+ string[] doc_html;
string[] doc;
- foreach (part; document_section_keys_sequenced["scroll"]) {
+ foreach (part; doc_matters.keys_seq_scroll) {
foreach (obj; contents[part]) {
if (obj.use == "frontmatter") {
switch (obj.is_of) {
case "para":
switch (obj.is_a) {
case "heading":
- body_html ~= html_heading(obj);
+ doc_html ~= xhtml_format.heading(obj);
break;
case "toc":
- body_html ~= html_toc(obj);
+ doc_html ~= xhtml_format.toc(obj);
break;
default:
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
@@ -369,10 +577,10 @@ void scroll(C)(
case "para":
switch (obj.is_a) {
case "heading":
- body_html ~= html_heading(obj);
+ doc_html ~= xhtml_format.heading(obj);
break;
case "para":
- body_html ~= html_para(obj);
+ doc_html ~= xhtml_format.para(obj);
break;
default:
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
@@ -384,22 +592,22 @@ void scroll(C)(
case "poem":
break;
case "verse":
- body_html ~= html_nugget(obj);
+ doc_html ~= xhtml_format.nugget(obj);
break;
case "group":
- body_html ~= html_nugget(obj);
+ doc_html ~= xhtml_format.nugget(obj);
break;
case "block":
- body_html ~= html_nugget(obj);
+ doc_html ~= xhtml_format.nugget(obj);
break;
case "quote":
- body_html ~= html_nugget(obj);
+ doc_html ~= xhtml_format.nugget(obj);
break;
case "table":
- body_html ~= html_para(obj); //
+ doc_html ~= xhtml_format.para(obj); //
break;
case "code":
- body_html ~= html_nugget(obj);
+ doc_html ~= xhtml_format.code(obj);
break;
default:
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
@@ -415,22 +623,22 @@ void scroll(C)(
case "para":
switch (obj.is_a) {
case "heading":
- body_html ~= html_heading(obj);
+ doc_html ~= xhtml_format.heading(obj);
break;
case "endnote":
- body_html ~= html_endnote(obj);
+ doc_html ~= xhtml_format.endnote(obj);
break;
case "glossary":
- body_html ~= html_para(obj);
+ doc_html ~= xhtml_format.para(obj);
break;
case "bibliography":
- body_html ~= html_para(obj);
+ doc_html ~= xhtml_format.para(obj);
break;
case "bookindex":
- body_html ~= html_para(obj);
+ doc_html ~= xhtml_format.para(obj);
break;
case "blurb":
- body_html ~= html_para(obj);
+ doc_html ~= xhtml_format.para(obj);
break;
default:
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
@@ -444,23 +652,35 @@ void scroll(C)(
}
}
}
+ doc = xhtml_format.scroll_head(doc_matters.dochead_meta) ~ doc_html ~ xhtml_format.tail;
+ scroll_write_output_file(doc_matters.source_filename, doc);
+}
#+END_SRC
-**** scroll output file
+**** seg :seg:
+***** output files
-#+name: output_html
+#+name: output_html_seg
#+BEGIN_SRC d
- doc = scroll_head_html ~ body_html ~ scroll_tail_html;
+void seg_write_output_files(
+ string fn_src,
+ string[] seg_filenames,
+ string[][string] doc_html,
+) {
+ mixin SiSUpaths;
+ auto pth_html = HtmlPaths();
+ auto xhtml_format = SDPoutputXHTMLs();
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;
try {
- mkdirRecurse(pth_seg);
- auto f = File(pth_html_fn, "w");
- foreach (o; doc) {
- f.writeln(o);
+ mkdirRecurse(pth_html.seg(fn_src));
+ foreach (seg_filename; seg_filenames) {
+ // writeln(__LINE__, ": ", fn);
+ auto f = File(pth_html.fn_seg(fn_src, seg_filename), "w");
+ /+ // f.writeln(seg_head); // not needed built and inserted earlier +/
+ foreach (docseg; doc_html[seg_filename]) {
+ f.writeln(docseg);
+ }
+ f.writeln(xhtml_format.tail); // needed for each lev4
}
}
catch (ErrnoException ex) {
@@ -469,8 +689,164 @@ void scroll(C)(
}
#+END_SRC
-**** seg
-*** css :css:
+***** (sections & objects) switch (for html output format)
+
+#+name: output_html_seg
+#+BEGIN_SRC d
+void seg(C,T)(
+ auto ref const C contents,
+ auto ref T doc_matters,
+) {
+ auto xhtml_format = SDPoutputXHTMLs();
+ auto rgx = Rgx();
+ string[][string] doc_html;
+ string[] doc;
+ string segment_filename;
+ string[] seg_filenames;
+ string[] top_level_headings = ["","","",""];
+ foreach (part; doc_matters.keys_seq_seg) {
+ foreach (obj; contents[part]) {
+ if (obj.is_a == "heading") { // all headings: frontmatter, body & backmatter
+ switch (obj.heading_lev_markup) {
+ case 0: .. case 3:
+ /+ fill buffer, and replace with new levels from 1 to 3 +/
+ switch (obj.heading_lev_markup) {
+ case 0:
+ top_level_headings[0] = "";
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 1:
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 2:
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 3:
+ top_level_headings[3] = "";
+ goto default;
+ default:
+ top_level_headings[obj.heading_lev_markup] = xhtml_format.heading(obj); // should probably have different css tagging (fontsize etc)
+ break;
+ }
+ break;
+ case 4:
+ seg_filenames ~= obj.segment_anchor_tag;
+ segment_filename = obj.segment_anchor_tag;
+ doc_html[segment_filename] ~= xhtml_format.seg_head(doc_matters.dochead_meta); // consider placing seg_head here as can more easily populate it with lev4 info
+ foreach (top_level_heading; top_level_headings) {
+ // writeln(top_level_heading);
+ doc_html[segment_filename] ~= top_level_heading;
+ }
+ doc_html[segment_filename] ~= xhtml_format.heading(obj);
+ break;
+ case 5: .. case 7:
+ doc_html[segment_filename] ~= xhtml_format.heading(obj);
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ } else if (obj.use == "frontmatter") {
+ switch (obj.is_of) {
+ case "para":
+ switch (obj.is_a) {
+ case "toc":
+ doc_html[segment_filename] ~= xhtml_format.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 "para":
+ doc_html[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ default:
+ // writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.is_a) {
+ case "poem": // double check why both poem & verse
+ break;
+ case "verse":
+ doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ break;
+ case "group":
+ doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ break;
+ case "block":
+ doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ break;
+ case "quote":
+ doc_html[segment_filename] ~= xhtml_format.nugget(obj);
+ break;
+ case "table":
+ doc_html[segment_filename] ~= xhtml_format.para(obj); //
+ break;
+ case "code":
+ doc_html[segment_filename] ~= xhtml_format.code(obj);
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ break;
+ default:
+ // writeln(__FILE__, ":", __LINE__, ": ", obj.is_of);
+ break;
+ }
+ } else if (obj.use == "backmatter") {
+ switch (obj.is_of) {
+ case "para":
+ switch (obj.is_a) {
+ case "endnote":
+ doc_html[segment_filename] ~= xhtml_format.endnote(obj);
+ break;
+ case "glossary":
+ doc_html[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ case "bibliography":
+ doc_html[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ case "bookindex":
+ doc_html[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ case "blurb":
+ doc_html[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ default:
+ // writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ }
+ }
+ }
+ writeln(doc_matters.keys_seq_seg);
+ seg_write_output_files(doc_matters.source_filename, seg_filenames, doc_html);
+}
+#+END_SRC
+
+**** css :css:
#+name: output_html_css
#+BEGIN_SRC d
@@ -1769,6 +2145,405 @@ auto css_write() {
mkdirRecurse(pth_css);
auto f = File(pth_css_fn, "w");
f.writeln(html_css);
+ // foreach (o; doc) {
+ // f.writeln(o);
+ // }
+ }
+ catch (ErrnoException ex) {
+ // Handle error
+ }
+}
+#+END_SRC
+
+*** epub [#B] :epub:
+**** epub special files :format:
+***** fixed
+****** mimetype (file)
+
+#+name: output_epub_fixed
+#+BEGIN_SRC d
+string epub_mimetypes() {
+ string o;
+ o = format(q"¶application/epub+zip¶");
+ return o;
+}
+#+END_SRC
+
+****** META-INF/container.xml (file)
+
+#+name: output_epub_fixed
+#+BEGIN_SRC d
+string epub_container_xml() {
+ string o;
+ o = format(q"¶<?xml version='1.0' encoding='utf-8'?>
+<container version="1.0"
+ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
+ <rootfiles>
+ <rootfile full-path="OEBPS/content.opf"
+ media-type="application/oebps-package+xml" />
+ </rootfiles>
+</container>¶");
+ return o;
+}
+#+END_SRC
+
+***** TODO constructs (in OEBPS)
+****** TODO OEBPS/content.opf (register content: files, images etc.)
+
+#+name: output_epub_constructs
+#+BEGIN_SRC d
+string epub_oebps_content(
+ // string[string][string] dochead_meta,
+) {
+ // string[] toc;
+ // int counter = 0;
+ string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
+ string content = format(q"¶<?xml version='1.0' encoding='utf-8'?>
+<?xml version='1.0' encoding='utf-8'?>
+<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID">
+ <opf:metadata
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:opf="http://www.idpf.org/2007/opf"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ unique-identifier="urn:uuid:%s" version="2.0">
+ <dc:title>%s</dc:title>
+ <dc:creator opf:file-as="%s" opf:role="aut">%s</dc:creator>
+ <dc:language>en</dc:language>
+ <dc:date opf:event="published">%s</dc:date>
+ <dc:rights>Copyright: %s</dc:rights>
+ <dc:identifier opf:scheme="URI">ox/current/en/epub/sisu_markup.epub</dc:identifier>
+ <dc:identifier id="bookid">urn:uuid:%s</dc:identifier>
+ <!-- <dc:identifier id="EPB-UUID">urn:uuid:%s</dc:identifier> -->
+ </opf:metadata>
+ <manifest>
+ <!-- NCX -->
+ <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" />
+ <!-- CSS Style Sheets -->
+ <item id="main-css" href="css/xhtml.css" media-type="text/css" />¶",
+ uuid,
+ doc_matters.dochead_meta["title"]["full"], // title
+ (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : " by " ~ doc_matters.dochead_meta["creator"]["author"], // author
+ (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : " by " ~ doc_matters.dochead_meta["creator"]["author"], // author
+ (doc_matters.dochead_meta["date"]["published"].empty) ? "" : " by " ~ doc_matters.dochead_meta["date"]["published"], // date
+ (doc_matters.dochead_meta["rights"]["copyright"].empty) ? "" : " by " ~ doc_matters.dochead_meta["rights"]["copyright"], // rights
+ uuid,
+ uuid,
+ );
+ foreach (sect; doc_matters.keys_seq_seg) {
+ foreach (obj; contents[sect]) {
+ }
+ }
+ return content;
+}
+#+END_SRC
+
+****** TODO OEBPS/toc.ncx (navigable toc using Dom structure)
+
+#+name: output_epub_constructs
+#+BEGIN_SRC d
+string epub_oebps_toc() {
+ int counter = 0;
+ string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
+ auto markup = InlineMarkup();
+ enum DomTags { none, open, close, close_and_open, open_still, }
+ string toc = format(q"¶<?xml version='1.0' encoding='utf-8'?>
+<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
+ <head>
+ <!-- four required metadata items (for all NCX documents,
+ (including the relaxed constraints of OPS 2.0) -->
+ <title>%s%s</title>
+ <link href="css/xhtml.css" rel="stylesheet" type="text/css" id="main-css" />
+ <meta name="dtb:uid" content="urn:uuid:%s" />
+ <!-- <meta name="epub-creator" content="SiSU http://www.jus.uio.no/sisu (this copy)" /> -->
+ <meta name="dtb:depth" content="%s" />
+ <meta name="dtb:totalPageCount" content="0" />
+ <meta name="dtb:maxPageNumber" content="0" />
+ </head>
+ <docTitle>
+ <text>%s</text>
+ </docTitle>
+ <docAuthor>
+ <text>%s</text>
+ </docAuthor>
+ <navMap>¶",
+ doc_matters.dochead_meta["title"]["full"], // title
+ (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : " by " ~ doc_matters.dochead_meta["creator"]["author"], // author
+ uuid, // uuid
+ "3", // content depth
+ doc_matters.dochead_meta["title"]["full"], // title
+ (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : doc_matters.dochead_meta["creator"]["author"], // author
+ );
+ foreach (sect; doc_matters.keys_seq_seg) {
+ foreach (obj; contents[sect]) {
+ if (obj.is_a == "heading") {
+ foreach_reverse (k; 0 .. 7) {
+ switch (obj.dom_markedup[k]) {
+ case DomTags.close :
+ writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
+toc ~= "</navPoint>";
+ break;
+ case DomTags.close_and_open :
+ writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
+ writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text);
+ ++counter;
+toc ~= "</navPoint>";
+toc ~= format(q"¶<navPoint class="chapter" id="navpoint" playOrder="%s">
+<navLabel>
+ <text>%s</text>
+</navLabel>
+<content src="%s" />¶",
+counter,
+obj.text,
+obj.segment_anchor_tag, // lev < 4 [no link]; lev == 4 [filename] markup.xhtml; lev > 4 [filename#ocn] (links done in segment_anchor_tag)
+);
+ break;
+ case DomTags.open :
+ writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text);
+ ++counter;
+toc ~= format(q"¶<navPoint class="chapter" id="navpoint" playOrder="%s">
+<navLabel>
+ <text>%s</text>
+</navLabel>
+<content src="%s" />¶",
+counter,
+obj.text,
+obj.segment_anchor_tag, // lev < 4 [no link]; lev == 4 [filename] markup.xhtml; lev > 4 [filename#ocn] (fix links in segment_anchor_tag)
+);
+ break;
+ default :
+ break;
+ }
+ }
+ }
+ }
+ }
+ toc ~= format(q"¶ </navMap>
+</ncx>¶");
+ return toc;
+}
+#+END_SRC
+
+**** (sections & objects) switch (for epub xhtml output format)
+
+#+name: output_epub_xhtml_seg
+#+BEGIN_SRC d
+void doc_content(C,T)(
+ auto ref const C contents,
+ auto ref T doc_matters,
+) {
+ auto xhtml_format = SDPoutputXHTMLs();
+ auto rgx = Rgx();
+ // string[] toc;
+ string[][string] doc_epub;
+ string[] doc;
+ string segment_filename;
+ string[] seg_filenames;
+ string[] top_level_headings = ["","","",""];
+ auto mimetypes = epub_mimetypes;
+ auto meta_inf_container_xml = epub_container_xml;
+ auto oebps_toc_ncx = epub_oebps_toc;
+ auto oebps_content_opf = epub_oebps_content;
+ foreach (part; doc_matters.keys_seq_seg) {
+ foreach (obj; contents[part]) {
+ if (obj.is_a == "heading") {
+ switch (obj.heading_lev_markup) {
+ // case 0:
+ // break;
+ case 0: .. case 3:
+ /+ fill buffer, and replace with new levels from 1 to 3 +/
+ switch (obj.heading_lev_markup) {
+ case 0:
+ top_level_headings[0] = "";
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 1:
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 2:
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 3:
+ top_level_headings[3] = "";
+ goto default;
+ default:
+ top_level_headings[obj.heading_lev_markup] = xhtml_format.heading(obj);
+ break;
+ }
+ break;
+ case 4:
+ seg_filenames ~= obj.segment_anchor_tag;
+ segment_filename = obj.segment_anchor_tag;
+ doc_epub[segment_filename] ~= xhtml_format.seg_head(doc_matters.dochead_meta);
+ foreach (top_level_heading; top_level_headings) {
+ // writeln(top_level_heading);
+ doc_epub[segment_filename] ~= top_level_heading;
+ }
+ doc_epub[segment_filename] ~= xhtml_format.heading(obj);
+ break;
+ case 5: .. case 7:
+ doc_epub[segment_filename] ~= xhtml_format.heading(obj);
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ } else if (obj.use == "frontmatter") {
+ switch (obj.is_of) {
+ case "para":
+ switch (obj.is_a) {
+ case "toc":
+ doc_epub[segment_filename] ~= xhtml_format.toc(obj);
+ // doc_epub ~= xhtml_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 "para":
+ doc_epub[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ default:
+ // writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.is_a) {
+ case "poem": // double check why both poem & verse
+ break;
+ case "verse":
+ doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ // doc_epub ~= xhtml_verse(obj);
+ break;
+ case "group":
+ doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ // doc_epub ~= xhtml_group(obj);
+ break;
+ case "block":
+ doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ // doc_epub ~= xhtml_block(obj);
+ break;
+ case "quote":
+ doc_epub[segment_filename] ~= xhtml_format.nugget(obj);
+ // doc_epub ~= xhtml_quote(obj);
+ break;
+ case "table":
+ doc_epub[segment_filename] ~= xhtml_format.para(obj); //
+ // doc_epub ~= xhtml_table(obj);
+ break;
+ case "code":
+ doc_epub[segment_filename] ~= xhtml_format.code(obj);
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ break;
+ default:
+ // writeln(__FILE__, ":", __LINE__, ": ", obj.is_of);
+ break;
+ }
+ } else if (obj.use == "backmatter") {
+ switch (obj.is_of) {
+ case "para":
+ switch (obj.is_a) {
+ case "endnote":
+ doc_epub[segment_filename] ~= xhtml_format.endnote(obj);
+ break;
+ case "glossary":
+ doc_epub[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ case "bibliography":
+ doc_epub[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ case "bookindex":
+ doc_epub[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ case "blurb":
+ doc_epub[segment_filename] ~= xhtml_format.para(obj);
+ break;
+ default:
+ // writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ break;
+ default:
+ writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
+ break;
+ }
+ }
+ }
+ }
+ writeln(doc_matters.keys_seq_seg);
+ epub_write_output_files(
+ doc_matters.source_filename,
+ seg_filenames,
+ doc_epub,
+ mimetypes,
+ meta_inf_container_xml,
+ oebps_toc_ncx,
+ oebps_content_opf,
+ );
+}
+#+END_SRC
+
+**** TODO output files
+
+#+name: output_epub_xhtml_seg
+#+BEGIN_SRC d
+void epub_write_output_files(
+ string fn_src,
+ string[] seg_filenames,
+ string[][string] doc_epub,
+ string mimetypes,
+ string meta_inf_container_xml,
+ string oebps_toc_ncx,
+ string oebps_content_opf,
+) {
+ mixin SiSUpaths;
+ auto pth_epub = EpubPaths();
+ // doc = xhtml_format.scroll_head ~ doc_epub ~ xhtml_format.tail;
+ auto xhtml_format = SDPoutputXHTMLs();
+ try {
+ mkdirRecurse(pth_epub.doc_meta_inf(fn_src));
+ mkdirRecurse(pth_epub.doc_oebps_css(fn_src));
+ mkdirRecurse(pth_epub.doc_oebps_image(fn_src));
+ /+ OEBPS/[segments].xhtml +/
+ foreach (seg_filename; seg_filenames) {
+ auto f = File(pth_epub.fn_oebps_content_xhtml(fn_src, seg_filename), "w");
+ /+ // f.writeln(seg_head); // not needed built and inserted earlier +/
+ foreach (docseg; doc_epub[seg_filename]) {
+ f.writeln(docseg);
+ }
+ f.writeln(xhtml_format.tail); // needed for each lev4
+ }
+ /+ mimetypes +/
+ auto f = File(pth_epub.fn_mimetypes(fn_src), "w");
+ f.writeln(mimetypes);
+ /+ META-INF/container.xml +/
+ f = File(pth_epub.fn_dmi_container_xml(fn_src), "w");
+ f.writeln(meta_inf_container_xml);
+ /+ OEBPS/toc.ncx +/
+ f = File(pth_epub.fn_oebps_toc_ncx(fn_src), "w");
+ f.writeln(oebps_toc_ncx);
+ /+ OEBPS/content.opf +/
+ f = File(pth_epub.fn_oebps_content_opf(fn_src), "w");
+ f.writeln(oebps_content_opf);
}
catch (ErrnoException ex) {
// Handle error
@@ -1776,8 +2551,7 @@ auto css_write() {
}
#+END_SRC
-** epub [#B] :epub:
-** pdf :pdf:
+** pdf [#C] :pdf:
** odt :odt:
** sqlite [#B] :sqlite:
** pgsql :pgsql:
diff --git a/org/sdp.org b/org/sdp.org
index f8734be..54a36a3 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -24,7 +24,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 10, 1);
+enum ver = Version(0, 11, 0);
#+END_SRC
** TODO sdp src/sdp.d :sdp.d:
@@ -87,18 +87,21 @@ unittest {
#+BEGIN_SRC d
/+ sdp: sisu document parser, see http://sisudoc.org +/
import
- compile_time_info, // sdp/compile_time_info.d
- ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d
- ao_conf_make_meta, // sdp/ao_conf_make_meta.d
- ao_conf_make_meta_native, // sdp/ao_conf_make_meta_native.d
- ao_conf_make_meta_sdlang, // sdp/ao_conf_make_meta_sdlang.d
- ao_defaults, // sdp/ao_defaults.d
- ao_output_debugs, // sdp/ao_output_debugs.d
- ao_read_config_files, // sdp/ao_read_config_files.d
- ao_read_source_files, // sdp/ao_read_source_files.d
- ao_rgx, // sdp/ao_rgx.d
- output_hub, // output_hub.d
- output_html; // output_html.d
+ compile_time_info,
+ ao_abstract_doc_source,
+ ao_conf_make_meta,
+ ao_conf_make_meta_native,
+ ao_conf_make_meta_sdlang,
+ ao_defaults,
+ ao_output_debugs,
+ ao_read_config_files,
+ ao_read_source_files,
+ ao_rgx,
+ output_hub,
+ output_epub,
+ output_html,
+ output_xhtmls,
+ source_sisupod;
#+END_SRC
***** notes
@@ -156,6 +159,7 @@ private import
std.process,
std.stdio,
std.file,
+ std.path,
std.range,
std.regex,
std.string,
@@ -258,13 +262,15 @@ look into using getopt
#+NAME: sdp_args
#+BEGIN_SRC d
-bool[string] opt_action_bool = [
+bool[string] _opt_action_bool = [
"assertions" : false,
"concordance" : false,
"digest" : false,
"docbook" : false,
"epub" : false,
"html" : false,
+ "html_seg" : false,
+ "html_scroll" : false,
"manifest" : false,
"ocn" : true,
"odt" : false,
@@ -291,38 +297,40 @@ bool[string] opt_action_bool = [
];
auto helpInfo = getopt(args,
std.getopt.config.passThrough,
- "assert", "--assert set optional assertions on", &opt_action_bool["assertions"],
- "concordance", "--concordance file for document", &opt_action_bool["concordance"],
- "digest", "--digest hash digest for each object", &opt_action_bool["digest"],
- "docbook", "--docbook process docbook output", &opt_action_bool["docbook"],
- "epub", "--epub process epub output", &opt_action_bool["epub"],
- "html", "--html process html output", &opt_action_bool["html"],
- "manifest", "--manifest process manifest output", &opt_action_bool["manifest"],
- "ocn", "--ocn object cite numbers (default)", &opt_action_bool["ocn"],
- "odf", "--odf process odf:odt output", &opt_action_bool["odt"],
- "odt", "--odt process odf:odt output", &opt_action_bool["odt"],
- "pdf", "--pdf process pdf output", &opt_action_bool["pdf"],
- "pg", "--pg process postgresql output", &opt_action_bool["postgresql"],
- "postgresql", "--postgresql process postgresql output", &opt_action_bool["postgresql"],
- "qrcode", "--qrcode with document metadata", &opt_action_bool["qrcode"],
- "sisupod", "--sisupod sisupod source content bundled", &opt_action_bool["sisupod"],
- "source", "--source markup source text content", &opt_action_bool["source"],
- "sqlite", "--sqlite process sqlite output", &opt_action_bool["sqlite"],
- "text", "--text process text output", &opt_action_bool["text"],
- "txt", "--txt process text output", &opt_action_bool["text"],
- "verbose|v", "--verbose output to terminal", &opt_action_bool["verbose"],
- "xhtml", "--xhtml process xhtml output", &opt_action_bool["xhtml"],
- "xml-dom", "--xml-dom process xml dom output", &opt_action_bool["xml_dom"],
- "xml-sax", "--xml-sax process xml sax output", &opt_action_bool["xml_sax"],
- "section-toc", "--section-toc process table of contents (default)", &opt_action_bool["section_toc"],
- "section-body", "--section-body process document body (default)", &opt_action_bool["section_body"],
- "section-endnotes", "--section-endnotes process document endnotes (default)", &opt_action_bool["section_endnotes"],
- "section-glossary", "--section-glossary process document glossary (default)", &opt_action_bool["section_glossary"],
- "section-biblio", "--section-biblio process document biblio (default)", &opt_action_bool["section_biblio"],
- "section-bookindex", "--section-bookindex process document bookindex (default)", &opt_action_bool["section_bookindex"],
- "section-blurb", "--section-blurb process document blurb (default)", &opt_action_bool["section_blurb"],
- "backmatter", "--section-backmatter process document backmatter (default)", &opt_action_bool["backmatter"],
- "skip_output", "--skip-output", &opt_action_bool["skip_output"],
+ "assert", "--assert set optional assertions on", &_opt_action_bool["assertions"],
+ "concordance", "--concordance file for document", &_opt_action_bool["concordance"],
+ "digest", "--digest hash digest for each object", &_opt_action_bool["digest"],
+ "docbook", "--docbook process docbook output", &_opt_action_bool["docbook"],
+ "epub", "--epub process epub output", &_opt_action_bool["epub"],
+ "html", "--html process html output", &_opt_action_bool["html"],
+ "html_seg", "--html-seg process html output", &_opt_action_bool["html_seg"],
+ "html_scroll", "--html-seg process html output", &_opt_action_bool["html_scroll"],
+ "manifest", "--manifest process manifest output", &_opt_action_bool["manifest"],
+ "ocn", "--ocn object cite numbers (default)", &_opt_action_bool["ocn"],
+ "odf", "--odf process odf:odt output", &_opt_action_bool["odt"],
+ "odt", "--odt process odf:odt output", &_opt_action_bool["odt"],
+ "pdf", "--pdf process pdf output", &_opt_action_bool["pdf"],
+ "pg", "--pg process postgresql output", &_opt_action_bool["postgresql"],
+ "postgresql", "--postgresql process postgresql output", &_opt_action_bool["postgresql"],
+ "qrcode", "--qrcode with document metadata", &_opt_action_bool["qrcode"],
+ "sisupod", "--sisupod sisupod source content bundled", &_opt_action_bool["sisupod"],
+ "source", "--source markup source text content", &_opt_action_bool["source"],
+ "sqlite", "--sqlite process sqlite output", &_opt_action_bool["sqlite"],
+ "text", "--text process text output", &_opt_action_bool["text"],
+ "txt", "--txt process text output", &_opt_action_bool["text"],
+ "verbose|v", "--verbose output to terminal", &_opt_action_bool["verbose"],
+ "xhtml", "--xhtml process xhtml output", &_opt_action_bool["xhtml"],
+ "xml-dom", "--xml-dom process xml dom output", &_opt_action_bool["xml_dom"],
+ "xml-sax", "--xml-sax process xml sax output", &_opt_action_bool["xml_sax"],
+ "section-toc", "--section-toc process table of contents (default)", &_opt_action_bool["section_toc"],
+ "section-body", "--section-body process document body (default)", &_opt_action_bool["section_body"],
+ "section-endnotes", "--section-endnotes process document endnotes (default)", &_opt_action_bool["section_endnotes"],
+ "section-glossary", "--section-glossary process document glossary (default)", &_opt_action_bool["section_glossary"],
+ "section-biblio", "--section-biblio process document biblio (default)", &_opt_action_bool["section_biblio"],
+ "section-bookindex", "--section-bookindex process document bookindex (default)", &_opt_action_bool["section_bookindex"],
+ "section-blurb", "--section-blurb process document blurb (default)", &_opt_action_bool["section_blurb"],
+ "backmatter", "--section-backmatter process document backmatter (default)", &_opt_action_bool["backmatter"],
+ "skip_output", "--skip-output", &_opt_action_bool["skip_output"],
);
if (helpInfo.helpWanted) {
defaultGetoptPrinter("Some information about the program.", helpInfo.options);
@@ -380,7 +388,7 @@ enforce(
);
#+END_SRC
-**** [#A] read in raw file (using filename with path) :file:read:
+**** _read in raw file_ (using filename with path) :file:read:
[[./ao_markup_source_raw.org][ao_markup_source_raw]]
#+NAME: sdp_each_file_do_read_sisu_markup_file
@@ -389,7 +397,7 @@ enforce(
auto read_in_file_string = raw.sourceContent(fn_src);
#+END_SRC
-**** [#A] split raw content file into: doc header & doc content :file:read:
+**** split raw content file into: _doc header & doc content_ :file:read:
#+NAME: sdp_each_file_do_split_sisu_markup_file_content_into_header_and_body
#+BEGIN_SRC d
@@ -404,101 +412,125 @@ debug(header_and_body) {
}
#+END_SRC
-**** [#A] split doc header into: metadata & make :doc:header:metadata:make:
+**** split doc header into: _metadata & make_ :doc:header:metadata:make:
#+NAME: sdp_each_file_do_split_sisu_markup_file_header_into_make_and_meta
#+BEGIN_SRC d
/+ ↓ split header into make and meta +/
auto header_make_and_meta_tuple = head.headerContentAA(header, conf_doc_make_aa);
static assert(!isTypeTuple!(header_make_and_meta_tuple));
-string[string][string] dochead_make = header_make_and_meta_tuple[0];
-string[string][string] dochead_meta = header_make_and_meta_tuple[1];
+string[string][string] _dochead_make = header_make_and_meta_tuple[0];
+string[string][string] _dochead_meta = header_make_and_meta_tuple[1];
#+END_SRC
-**** [#A] processing: document abstraction, tuple :processing:
+**** [#A] processing: _document abstraction, tuple_ :processing:
#+NAME: sdp_each_file_do_document_abstraction
#+BEGIN_SRC d
/+ ↓ document abstraction: process document, return abstraction as tuple +/
-auto t = abs.abstract_doc_source(content_body, dochead_make, dochead_meta, opt_action_bool);
+auto t = abs.abstract_doc_source(content_body, _dochead_make, _dochead_meta, _opt_action_bool);
static assert(!isTypeTuple!(t));
-auto doc_ao_contents = t[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb;
-auto doc_html_segnames = t[1];
+auto doc_abstraction = t[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb;
+string[] doc_html_segnames = t[1];
#+END_SRC
-**** document section keys view
+**** document _section keys_ sequence
#+NAME: sdp_each_file_do_document_abstraction
#+BEGIN_SRC d
string[][string] document_section_keys_sequenced = [
- "seg": ["head", "toc_seg", "body",],
+ "seg": ["head", "toc_seg", "body",],
"scroll": ["head", "toc_scroll", "body",]
];
-if (doc_ao_contents["endnotes_seg"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "endnotes_seg";
+if (doc_abstraction["endnotes"].length > 1) {
+ document_section_keys_sequenced["seg"] ~= "endnotes";
+ document_section_keys_sequenced["scroll"] ~= "endnotes";
}
-if (doc_ao_contents["endnotes_scroll"].length > 1) {
- document_section_keys_sequenced["scroll"] ~= "endnotes_scroll";
-}
-if (doc_ao_contents["glossary"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "glossary";
+if (doc_abstraction["glossary"].length > 1) {
+ document_section_keys_sequenced["seg"] ~= "glossary";
document_section_keys_sequenced["scroll"] ~= "glossary";
}
-if (doc_ao_contents["bibliography"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "bibliography";
+if (doc_abstraction["bibliography"].length > 1) {
+ document_section_keys_sequenced["seg"] ~= "bibliography";
document_section_keys_sequenced["scroll"] ~= "bibliography";
}
-if (doc_ao_contents["bookindex_seg"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "bookindex_seg";
+if (doc_abstraction["bookindex_seg"].length > 1) {
+ document_section_keys_sequenced["seg"] ~= "bookindex_seg";
}
-if (doc_ao_contents["bookindex_scroll"].length > 1) {
+if (doc_abstraction["bookindex_scroll"].length > 1) {
document_section_keys_sequenced["scroll"] ~= "bookindex_scroll";
}
-if (doc_ao_contents["blurb"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "blurb";
+if (doc_abstraction["blurb"].length > 1) {
+ document_section_keys_sequenced["seg"] ~= "blurb";
document_section_keys_sequenced["scroll"] ~= "blurb";
}
-if ((opt_action_bool["html"])
-|| (opt_action_bool["html_scroll"])
-|| (opt_action_bool["html_seg"])
-|| (opt_action_bool["epub"])) {
- document_section_keys_sequenced["seg"] ~= "tail";
+if ((_opt_action_bool["html"])
+|| (_opt_action_bool["html_scroll"])
+|| (_opt_action_bool["html_seg"])
+|| (_opt_action_bool["epub"])) {
+ document_section_keys_sequenced["seg"] ~= "tail";
document_section_keys_sequenced["scroll"] ~= "tail";
}
#+END_SRC
-**** TODO debug (document parts, checkdoc) :debug:checkdoc:
+**** [#A] _document matters_
+#+NAME: sdp_each_file_do_document_abstraction
+#+BEGIN_SRC d
+struct DocumentMatters {
+ string[] keys_seq_seg() {
+ string[] _k = document_section_keys_sequenced["seg"];
+ return _k;
+ }
+ string[] keys_seq_scroll() {
+ string[] _k = document_section_keys_sequenced["scroll"];
+ return _k;
+ }
+ string[] segnames() {
+ string[] _k = doc_html_segnames;
+ return _k;
+ }
+ auto dochead_make() {
+ string[string][string] _k = _dochead_make;
+ return _k;
+ }
+ auto dochead_meta() {
+ string[string][string] _k = _dochead_meta;
+ return _k;
+ }
+ auto source_filename() {
+ string _k = fn_src;
+ return _k;
+ }
+ auto opt_action_bool() {
+ bool[string] _k = _opt_action_bool;
+ return _k;
+ }
+}
+auto doc_matters = DocumentMatters();
+#+END_SRC
+
+**** TODO _debug_ (document parts, checkdoc) :debug:checkdoc:
#+NAME: sdp_each_file_do_debugs_checkdoc
#+BEGIN_SRC d
/+ ↓ debugs +/
debug(checkdoc) {
dbg.abstract_doc_source_debugs(
- doc_ao_contents,
- document_section_keys_sequenced,
- doc_html_segnames,
- dochead_make,
- dochead_meta,
- fn_src,
- opt_action_bool
+ doc_abstraction,
+ doc_matters,
);
}
#+END_SRC
-**** TODO process outputs :outputs:
+**** TODO _process outputs_ :outputs:
#+NAME: sdp_each_file_do_selected_output
#+BEGIN_SRC d
/+ ↓ output hub +/
-if (!(opt_action_bool["skip_output"])) {
+if (!(_opt_action_bool["skip_output"])) {
output.hub(
- doc_ao_contents,
- document_section_keys_sequenced,
- doc_html_segnames,
- dochead_make,
- dochead_meta,
- fn_src,
- opt_action_bool
+ doc_abstraction,
+ doc_matters,
);
}
#+END_SRC
@@ -516,7 +548,7 @@ scope(exit) {
}
destroy(content_body);
destroy(t);
- destroy(doc_ao_contents);
+ destroy(doc_abstraction);
destroy(doc_html_segnames);
destroy(fn_src);
}
@@ -531,8 +563,10 @@ break;
#+END_SRC
* Notes
-** directory structure, program file arrangement
+** directory structure
+*** program file arrangement
+#+BEGIN_SRC shell
├── src
│   ├── sdp.d
│   └── sdp
@@ -550,167 +584,456 @@ break;
│   └── sdp.d
├── views
│   └── version.txt
+#+END_SRC
-** TODO work on
-*** program dir structure
-figure out best program dir structure for dub and compilers, issue with rdmd
-
-*** sisu document structure
-
-|---------------------+------------------------------------------+------------------------+------------------------+--------|
-| | | | 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 |
-|---------------------+------------------------------------------+------------------------+------------------------+--------|
-
-- header
-
-- table of contents
- - scroll #[ocn]
- - seg ../[fn]/#[ocn]
-- substantive contents
- contents
- footnotes
- - seg #[ocn]
- internal links
- - scroll #[ocn]
- - seg ../[fn]/#[ocn]
-- endnotes
- - scroll
- - seg ../[fn]/#[ocn]
-- glossary
-- bibliography
-- book index
- - scroll #[ocn]
- - seg ../[fn]/#[ocn]
-- metadata
-
-*** config :config:
-using sdlang in sdp
-
-**** sdp config and header? file format? sdl ? yml ? json ? :sdl:sdlang:
+*** markup files
-[[https://sdlang.org/][SDL: Simple Declarative Language]] [[http://sdl4r.rubyforge.org/syntaxhighlighter_brush.html][highlighter]]
-https://github.com/Abscissa/SDLang-D
-https://github.com/Abscissa/SDLang-D/blob/master/HOWTO.md
+#+BEGIN_SRC shell
+#+END_SRC
-***** build/ compile
+*** source file bundles
-The recommended way to use SDLang-D is via DUB. Just add a dependency to
-sdlang-d in your project's dub.json or dub.sdl file as shown here. Then simply
-build your project with DUB as usual. dub dependency
-http://code.dlang.org/packages/sdlang-d
+#+BEGIN_SRC shell
+dir structure
+/tmp/_sisu_processing_/ralph/en/sisupod
+ ├── doc
+ │   └── en
+ └── image
+#+END_SRC
+*** src dir structure & files
+#+BEGIN_SRC txt :tangle no
+tree /home/ralph/sisu_www/current/src/democratizing_innovation.eric_von_hippel.sst
-Alternatively, you can git clone both SDLang-D and the latest version of
-libInputVisitor,
+/home/ralph/sisu_www/current/src/
+democratizing_innovation.eric_von_hippel.sst
+└── sisupod
+ ├── doc
+ │   ├── en
+ │   │   └── democratizing_innovation.eric_von_hippel.sst
+ │   └── _sisu
+ │   └── sisu_document_make // [interesting as part of larger conf.sdl]
+ └── image
+ ├── di_evh_f10-1.png
+ ├── di_evh_f11-1.png
+ ├── di_evh_f11-2.png
+ ├── di_evh_f1-1.png
+ ├── di_evh_f5-1.png
+ └── di_evh.png
-#+BEGIN_SRC d :tangle no
-dub fetch sdlang-d
-git clone https://github.com/Abscissa/SDLang-D
-git clone https://github.com/abscissa/libInputVisitor
#+END_SRC
- and when running the compiler include:
-#+BEGIN_SRC d :tangle no
- -I{path to SDLang-D}/src -I{path to libInputVisitor}/src
+** document abstraction
+*** terminology / glossary
+
+- header
+ - document header, containing document specific
+ - (i) metadata information or
+ - (ii) make instructions
+
+- (document) structure
+ - relationship between headings and sub-headings, and the objects they
+ contain.
+ - Document structure is extracted from
+ - heading levels, which are either:
+ - explicitly marked up, or;
+ - determined from a make regex provided in the document header.
+ Use of document structure allow for the meaningful representation of
+ documents in alternative ways and the use of ocn permits easy reference
+ across different output formats.
+
+- heading
+ - document heading, each heading is marked indicating its level (in relation
+ to other headings), and this is used as basis for determininge document
+ structure. There are 8 levels, which are can be distinguesed as being one of
+ three types: (i) 1 title level (marked up A or numeric 0); (ii) 3 optional
+ document division levels, above text separating headings (marked up B - D,
+ or numeric 1 to 3); (iii) 4 text headings (marked up 1 - 4, or numeric 4
+ to 7)
+
+- levels == heading levels
+ - document heading level, see heading and structure
+
+- marked up headings / mark up level
+
+- collapsed headings / collapsed levels
+
+- numeric levels
+
+- dummy heading
+ - a markup level 1 / dummy level 4 that does not exist in the original text
+ that is manually inserted to maintain the documents structure rule that text
+ follows a heading of markup level 1 (rather than A to D) (numeric level 4
+ rather than 0 to 3)
+
+- relatives? relations
+ - ancestors
+ - headings preceding current level under which it occurs
+ - decendants
+ - sub-headings contained beneath current level
+ - range of objects contained by a heading (ocn ranges for each heading in document body)
+ see ancestors and decendants
+
+- document ...
+
+- ancestors
+ - heading levels above the current heading level which it logically falls
+ under and to which it belongs (headings preceding current level under which
+ it occurs)
+
+- decendants
+ - decendant headings are sub-headings beneath the current heading level,
+ heading levels below the current heading level which are derived from it and
+ belong to it (sub-headings contained beneath current level); decendant
+ objects are the range of objects contained by a heading (ocn ranges for each
+ heading in document body)
+
+- (document) sections
+ - a document can be divided into 3 parts: front; body and; back. Front matter
+ includes the table of contents (which is generated from headings) and any
+ parts of the document that are presented before the document body (this
+ might include a copyright notice for example). The document body, the
+ substantive part of the document, all its substantive objects, including:
+ headings, paragraphs, tables, verse etc. This is followed by optional
+ backmatter: endnotes, generated from inline markup; glossary, from section
+ using a subset of regular markup, with an indication that section is to be
+ treated as glossary. Note two things glossary might do that it does not,
+ there is: no automatic (sorting) alphabetisation of listing; no creation of
+ term anchor tags (perhaps it should); bibliography, created from a specially
+ marked up section, with indication that section is to be treated as
+ bibliography; bookindex generated from dedicated markup appended to objects
+ providing index terms and the relevant range; blurb made up of ordinary
+ markup, with indication that section is to be treated as blurb
+
+|-----------------------+------------------------------------------+------------------------+--------|
+| _header_ | | | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| - metadata | sisu /header markup/ | markup | |
+| - make instructions | | | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| _front matter_ | | | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| - table of contents | markup of headings | (regular content) | output |
+|-----------------------+------------------------------------------+------------------------+--------|
+| _body_ | | | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| - substantive content | sisu /content markup/ | markup | output |
+| | headings (providing document structure), | (regular content) | |
+| | paragraphs, blocks | | |
+| | blocks (code, poem, group, table) | | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| _backmatter_ | | | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| - 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) | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| - blurb | | | |
+|-----------------------+------------------------------------------+------------------------+--------|
+| - metadata | | (from regular header) | output |
+|-----------------------+------------------------------------------+------------------------+--------|
+
+- segment, segmented text
+ - certain forms of output are conveniently segmented, e.g. epub and segmented
+ html. The document is broken into chunks indicated by markup level 1 heading
+ (numeric level 4 headings) as the significant level at which the document
+ should be segmented, and including all decendant objects of that level. For
+ a longer text/book this will usually the chapter level. (this is significant
+ in e.g. for epub and segmented html, which are broken by segment, usually
+ chosen to be chapter)
+
+- scroll
+ - the document as a "scroll", e.g. as a single text file, or continuous html
+ document
+
+- object
+ - a unit of text. Objects include:
+ - headings;
+ - paragraphs;
+ - code blocks;
+ - grouped text;
+ - verse of poems;
+ - tables.
+ - Each substantive object is given an object number, that should make it citable.
+
+- ocn (object citation number / citation number)
+ - numbers assigned sequentially to each substantive object of a document.
+ - An ocn has the characteristic of remaining identical across output
+ formats.
+ - Translations should be prepared so number remains identical across objects
+ in different languages
+
+- citation number (see ocn / object citation number)
+
+- document abstraction (== internal representation) intermediate step,
+ - preprocessing of document, into abstraction / representation that is used by
+ all downstream processing, i.e. for all output formats. This allows
+ normalisation, reducing alternative markup options to common
+ representations, e.g. code blocks (open and close), tables, ways of
+ instructing that text be bold, shortuct way of providing and endnote
+ reference to a link
+
+- (document) internal representation (== document abstraction)
+ - see document abstraction
+
+- node representation
+
+- attribute (object attributes)
+ - when the document is abstracted attributes associated with an object, for
+ example for a:
+ - paragraph,
+ - indent (hang ... check & add),
+ - bulleted,
+ - code block,
+ - the language syntax,
+ - whether the block is numbered
+
+- inline markup
+ - when the document is abstracted, markup that remains embedded in the text,
+ such as its
+ - font face
+ - bold,
+ - italic,
+ - emphasis,
+ - underscore,
+ - strike,
+ - superscript,
+ - subscript,
+ - links,
+ - endnotes
+
+- sequential all objects backkeeping number?
+
+*** configuration (flies and command line)
+**** alternative config sources
+
+- ./_sisu/conf.sdl
+- ./_sisu/sisu_document_make
+- markup document header, make section
+- command line options
+
+**** conf.sdl
+(site wide make instruction contained in same file as site configuration file)
+
+#+BEGIN_SRC shell
+/*
+ name "SiSU sdl config"
+ author email="ralph@amissah.com"
+ description "site or directory wide environment defaults set here using sdlang see http://sdlang.org system environment info / resource configuration file, for sisu"
+ license "GPL v3 or later"
+ this file should be configured and live in
+ /etc/sisu #per environment settings, overridden by:
+ ~/.sisu #per user settings, overridden by:
+ ./_sisu/config #per local directory settings
+*/
+
+/* presentation/web directory, main path and subdirectories (most subdirectories are created automatically based on markup directory name) */
+// webserv \
+// url_root 'http://www.sisudoc.org' // without dir stub, e.g. this dir would map to http://www.sisudoc.org/samples
+// path '~/sisu_www' // /srv/www #either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home
+// #path './tested' // either (i) / [full path from root] or (ii) ~/ [home] or (iii) ./ [pwd] or (iv) will be made from home
+// #images 'sisu/image'
+// #man 'man'
+// #cgi '/usr/local/lib/sisu-cgi'
+// show_output_on 'filesystem' // for -v and -u url information, alternatives: 'filesystem','webserver','remote_webserver','local:8111','localhost','localhost:8080','webrick','path'
+//// show_output_on 'filesystem_url'
+
+// webserv_cgi \
+// host: localhost
+// base_path: ~
+// port: '8081'
+// user: ~
+// file_links: www.sisudoc.org
+
+/* processing directories, main path and subdirectories */
+// processing \
+// path= "~" \
+// dir= "_sisu_processing~" \
+// // metaverse= 'metaverse' \
+// // tune= 'tune' \
+// // latex= 'tex' \
+// // texinfo= 'texinfo' \
+// // concord_max= 400000
+
+/* output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2) */
+output_dir_structure_by "language"
+
+/* flag - set (non-default) processing flag shortcuts -1, -2 etc. (here adding color and verbosity as default)
+ making color default -c is toggle, and will now toggle color off */
+flag \
+ color= true \
+ act0= "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest --verbose" \
+ act1= "--digest --text --html --manifest" \
+ act2= "--digest --text --html --epub --pdf --manifest" \
+ act3= "--digest --qrcode --text --html --epub --concordance --pdf --manifest" \
+ act4= "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --manifest" \
+ act5= "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --sqlite --manifest" \
+ act6= "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest" \
+ act7= "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --source --sisupod --manifest" \
+ act8= "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --manifest" \
+ act9= "--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --pg --update --source --sisupod --manifest"
+
+/* papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal */
+default \
+ papersize= "a4,letter" // 'a4,letter,b5,a5,legal'
+
+// texpdf_font 'Liberation Sans'
+// texpdf_font_sans 'Liberation Sans'
+// texpdf_font_serif 'Liberation Serif'
+// texpdf_font_mono 'Liberation Mono' #'Inconsolata'
+// text_wrap: 78
+// emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold'
+// language: 'fr'
+// language: 'en'
+// digest: 'sha' #sha is sha256, default is md5
+
+/* settings used by ssh scp */
+// remote \
+// user 'ralph' \
+// host 'www.sisudoc.org' \
+// path '/srv/www' // '/srv/sisudoc/web' // '.' #no trailing slash eg 'sisu/www'
+
+/* webrick information */
+
+/* sql database info, postgresql */
+// db
+// engine
+// default 'postgresql'
+// # share_source: true
+// postgresql \
+// port '5432' \
+// user 'ralph' \\ '[provide username]'
+// #host 'sisudoc.org'
+
+/* search */
+// search \
+// sisu
+// flag false
+// action "http://www.sisudoc.org/cgi-bin/sisu_lng_pgsql.cgi"
+// #action "http://www.sisudoc.org/cgi-bin/sisu_pgsql.cgi"
+// #action "http://search.sisudoc.org"
+// db "current"
+// title 'SiSU search form (sample)'
+// html
+// minitoc true
+// manifest
+// minitoc true
+make \
+ breaks="break=1" \
+ home_button_text="{SiSU}http://sisudoc.org; {sources / git}http://git.sisudoc.org/gitweb/"
+// footer="{SiSU}http://sisudoc.org; {sources / git}http://git.sisudoc.org/gitweb/"
+// home_button_image="{sisu.png }http://sisudoc.org"
+
+link "{SiSU}http://sisudoc.org"
+link "{sources / git}http://git.sisudoc.org/gitweb/"
#+END_SRC
-***** Importing
+**** sisu_document_make
+(site wide make instruction)
-To use SDL, first import the module sdlang:
+sample
+#+BEGIN_SRC shell
+make \
+ breaks="break=1" \
+ home_button_text="{SiSU}http://sisudoc.org; {sources / git}http://git.sisudoc.org/gitweb/"
+// footer="{SiSU}http://sisudoc.org; {sources / git}http://git.sisudoc.org/gitweb/" \
+// home_button_text="{sisu.png }http://sisudoc.org" \
-#+BEGIN_SRC d :tangle no
-import sdlang;
+links \
+ link="{SiSU}http://sisudoc.org" \
+ link="{sources / git}http://git.sisudoc.org/gitweb/"
#+END_SRC
-If you're not using DUB, then you must also include the path the SDLang-D sources when you compile:
+**** markup document header, make section
+(document specific make instructions)
-#+BEGIN_SRC d :tangle no
-rdmd --build-only -I{path to sdlang}/src -I{path to libInputVisitor}/src {other flags} yourProgram.d
-#+END_SRC
+sample
-***** misc
-http://forum.dlang.org/thread/hphtqkkmrfnlcipnxzai@forum.dlang.org
-http://forum.dlang.org/thread/gnfctbuhiemidetngrzi@forum.dlang.org?page=23#post-rlxlfveyyzgewhkxhhta:40forum.dlang.org
+#+BEGIN_SRC shell
+% SiSU 8.0
-**** other links
-http://semitwist.com/sdlang-d-docs/v0.9.3/sdlang.html http://semitwist.com/sdlang-d-docs/
+title "The Wealth of Networks" \
+ sub="How Social Production Transforms Markets and Freedom" \
+ language="US"
-*** markup
-**** code
+creator \
+ author="Benkler, Yochai"
-#+BEGIN_SRC txt :tangle no
-code.ruby{
+date \
+ published="2006-04-03" \
+ created="2006-04-03" \
+ issued="2006-04-03" \
+ available="2006-04-03" \
+ modified="2006-04-03" \
+ valid="2006-04-03"
-}code
+rights \
+ copyright="Copyright (C) 2006 Yochai Benkler." \
+ license="All rights reserved. Subject to the exception immediately following, this book may not be reproduced, in whole or in part, including illustrations, in any form (beyond that copying permitted by Sections 107 and 108 of the U.S. Copyright Law and except by reviewers for the public press), without written permission from the publishers. http://creativecommons.org/licenses/by-nc-sa/2.5/ The author has made an online version of the book available under a Creative Commons Noncommercial Sharealike license; it can be accessed through the author's website at http://www.benkler.org."
-code.python{
+classify \
+ topic_register="SiSU markup sample:book:discourse;networks;Internet;intellectual property:patents|copyright;intellectual property:copyright:creative commons;economics;society;copyright;patents;book:subject:information society|information networks|economics|public policy|society|copyright|patents"
-}code
+make \
+ breaks="new=:B; break=1" \
+ home_button_image="{won_benkler.png }http://cyber.law.harvard.edu/wealth_of_networks/Main_Page" \
+ footer="{The Wealth of Networks}http://cyber.law.harvard.edu/wealth_of_networks/Main_Page; {Yochai Benkler}http://http://www.doctorow.com"
+#+END_SRC
-code.sh{
+**** hierarchy
-}code
+#+BEGIN_SRC text
+./.sisu ./_sisu ~/.sisu /etc/.sisu
+#+END_SRC
-code.txt{
+*** links
+**** internal
+**** configure
+site url base, needed e.g. for pdf documents that do not use relative links
-}code
+*** substitutions
+**** configure
+substitutions to occur within a document
-code.d{
+*** source
+**** sisupod
-}code
-#+END_SRC
+*** abstract document structure
-*** src dir structure & files
-#+BEGIN_SRC txt :tangle no
-tree /home/ralph/sisu_www/current/src/democratizing_innovation.eric_von_hippel.sst
+** TODO work on
+*** sisu document structure
-/home/ralph/sisu_www/current/src/
-democratizing_innovation.eric_von_hippel.sst
-└── sisupod
- ├── doc
- │   ├── en
- │   │   └── democratizing_innovation.eric_von_hippel.sst
- │   └── _sisu
- │   └── sisu_document_make // [interesting as part of larger conf.sdl]
- └── image
- ├── di_evh_f10-1.png
- ├── di_evh_f11-1.png
- ├── di_evh_f11-2.png
- ├── di_evh_f1-1.png
- ├── di_evh_f5-1.png
- └── di_evh.png
+- header
-#+END_SRC
+- table of contents
+ - scroll #[ocn]
+ - seg ../[fn]/#[ocn]
+- substantive contents
+ contents
+ footnotes
+ - seg #[ocn]
+ internal links
+ - scroll #[ocn]
+ - seg ../[fn]/#[ocn]
+- endnotes
+ - scroll
+ - seg ../[fn]/#[ocn]
+- glossary
+- bibliography
+- book index
+ - scroll #[ocn]
+ - seg ../[fn]/#[ocn]
+- metadata
*** read markup files
**** regular .sst
@@ -731,20 +1054,3 @@ or
thrown away. At least the title and author information for each imported .sst
file would have to read and available for use in its header A that is demoted
to B
-
-*** processing files, currently using utf8
-*** check
-
-#+BEGIN_SRC text
-./.sisu ./_sisu ~/.sisu /etc/.sisu
-#+END_SRC
-
-#+BEGIN_SRC d
-/+
-writefln(
- "pwd: %s; home: %s",
- environment["PWD"],
- environment["HOME"]
-);
-+/
-#+END_SRC