aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ocda.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/ocda.org')
-rw-r--r--org/ocda.org123
1 files changed, 73 insertions, 50 deletions
diff --git a/org/ocda.org b/org/ocda.org
index dca0098..ee24570 100644
--- a/org/ocda.org
+++ b/org/ocda.org
@@ -1,15 +1,16 @@
-*- mode: org -*-
#+TITLE: sisudoc spine (doc_reform) object-centric document abstraction
#+DESCRIPTION: documents - structuring, publishing in multiple formats & search
+#+SUMMARY: process markup document, create document abstraction
#+FILETAGS: :spine:abstraction:
#+AUTHOR: Ralph Amissah
#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
-#+COPYRIGHT: Copyright (C) 2015 - 2024 Ralph Amissah
+#+COPYRIGHT: Copyright (C) 2015 - 2025 Ralph Amissah
#+LANGUAGE: en
#+STARTUP: content hideblocks hidestars noindent entitiespretty
#+PROPERTY: header-args :noweb yes
#+PROPERTY: header-args+ :exports code
-#+PROPERTY: header-args+ :results no
+#+PROPERTY: header-args+ :results output none
#+PROPERTY: header-args+ :cache no
#+PROPERTY: header-args+ :padline no
#+PROPERTY: header-args+ :mkdirp yes
@@ -18,7 +19,8 @@
- [[./doc-reform.org][doc-reform.org]] [[./][org/]]
* (Object-Centric) Document Abstraction
-Process markup document, create document abstraction.
+
+- Process markup document, create document abstraction
** _module template_ :module:metadoc_from_src:
@@ -51,31 +53,29 @@ template docAbstraction() {
#+HEADER: :noweb yes
#+BEGIN_SRC d
// ↓ abstraction imports
-import
- std.algorithm,
- std.container,
- std.digest.sha,
- std.file,
- std.json,
- std.path;
-import
- sisudoc.meta,
- sisudoc.meta.defaults,
- sisudoc.meta.rgx,
- sisudoc.meta.metadoc_object_setter,
- sisudoc.meta.rgx;
+import std.algorithm;
+import std.container;
+import std.digest.sha;
+import std.file;
+import std.json;
+import std.path;
+import sisudoc.meta;
+import sisudoc.meta.defaults;
+import sisudoc.meta.rgx;
+import sisudoc.meta.metadoc_object_setter;
+import sisudoc.meta.rgx;
public import sisudoc.meta.metadoc_from_src_functions;
mixin docAbstractionFunctions;
#+END_SRC
** docAbstraction
-*** abstraction summary
+*** _toc_ abstraction summary
#+NAME: docAbstraction
#+HEADER: :noweb yes
#+BEGIN_SRC d
<<docAbstractionInit>>
-<<docAbstractionInitSubstitutions>>
+<<docAbstractionInitSubstitutionsDebug>>
<<docAbstractionMainLoopSrcByLine>>
<<docAbstractionPostMainLoop>>
<<docAbstractionReturnsStruct>>
@@ -109,8 +109,8 @@ scope(exit) {
anchor_tag = "";
}
mixin spineNode;
-auto node_para_int_ = node_metadata_para_int;
-auto node_para_str_ = node_metadata_para_str;
+int[string] node_para_int_ = node_metadata_para_int;
+string[string] node_para_str_ = node_metadata_para_str;
ObjGenericComposite comp_obj_;
line_occur = [
"heading" : 0,
@@ -219,9 +219,9 @@ int cnt1 = 1; int cnt2 = 1; int cnt3 = 1;
// abstraction init ↑
#+END_SRC
-*** abstraction init substitutions
+*** debug abstraction init substitutions
-#+NAME: docAbstractionInitSubstitutions
+#+NAME: docAbstractionInitSubstitutionsDebug
#+HEADER: :noweb yes
#+BEGIN_SRC d
debug (substitutions) {
@@ -231,8 +231,8 @@ debug (substitutions) {
}
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
- writeln("regex to match: ", substitution_pair[Substitute.match]);
- writeln("substitution to make: ", substitution_pair[Substitute.markup]);
+ writeln("regex to match: ", substitution_pair[Substitute.match]);
+ writeln("substitution to make: ", substitution_pair[Substitute.markup]);
}
}
if (conf_make_meta.make.bold) {
@@ -250,12 +250,12 @@ debug (substitutions) {
}
#+END_SRC
-*** loop source by line (large block)
+*** _loop_ source by line (large block)
#+NAME: docAbstractionMainLoopSrcByLine
#+HEADER: :noweb yes
#+BEGIN_SRC d
-auto loopMarkupSrcByLine(
+_loopMarkupSrcByLineStruct loopMarkupSrcByLine(
char[][] markup_sourcefile_content,
string[string] an_object,
uint[string] pith,
@@ -364,7 +364,7 @@ auto loopMarkupSrcByLine(
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta);
{
- auto _get = line.txt_by_line_block_quote(an_object, pith);
+ ST_txt_by_line_block_generic _get = line.txt_by_line_block_quote(an_object, pith);
{
an_object = _get.this_object;
pith = _get.pith;
@@ -377,7 +377,7 @@ auto loopMarkupSrcByLine(
._doc_header_and_make_substitutions_fontface_(conf_make_meta)
.replaceAll(rgx.para_delimiter, mkup.br_line_spaced ~ "$1");
{
- auto _get = line.txt_by_line_block_group(an_object, pith);
+ ST_txt_by_line_block_generic _get = line.txt_by_line_block_group(an_object, pith);
{
an_object = _get.this_object;
pith = _get.pith;
@@ -393,7 +393,7 @@ auto loopMarkupSrcByLine(
.replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
}
{
- auto _get = line.txt_by_line_block_block(an_object, pith);
+ ST_txt_by_line_block_generic _get = line.txt_by_line_block_block(an_object, pith);
{
an_object = _get.this_object;
pith = _get.pith;
@@ -402,7 +402,7 @@ auto loopMarkupSrcByLine(
continue;
} else if (pith["block_is"] == eN.blk_is.poem) {
{
- auto _get = line.txt_by_line_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg);
+ ST_txt_by_line_block_poem _get = line.txt_by_line_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg);
{
an_object = _get.this_object;
pith = _get.pith;
@@ -436,7 +436,7 @@ auto loopMarkupSrcByLine(
object_number_poem["start"] = obj_cite_digits.object_number.to!string;
}
{
- auto _get = line.txt_by_line_block_start(pith, dochas, object_number_poem);
+ ST_txt_by_line_block_start _get = line.txt_by_line_block_start(pith, dochas, object_number_poem);
{
pith = _get.pith;
dochas = _get.dochas;
@@ -466,7 +466,7 @@ auto loopMarkupSrcByLine(
|| line.matchFirst(rgx.book_index_item_open)
|| pith["section"] == eN.sect.book_index) {
{ // book_index
- auto _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action);
+ ST_flow_book_index _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action);
{
an_object = _get.this_object;
pith = _get.pith;
@@ -488,7 +488,7 @@ auto loopMarkupSrcByLine(
comp_obj_comment.text = an_object[an_object_key].strip;
the_document_body_section ~= comp_obj_comment;
{
- auto _get = txt_by_line_common_reset_(line_occur, an_object, pith);
+ ST_txt_by_line_common_reset _get = txt_by_line_common_reset_(line_occur, an_object, pith);
{
line_occur = _get.line_occur;
an_object = _get.this_object;
@@ -505,7 +505,7 @@ auto loopMarkupSrcByLine(
&& (pith["make_headings"] == eN.bi.off)) {
// heading found
{
- auto _get = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith);
+ ST_flow_heading_found _get = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith);
{
heading_match_str = _get.heading_match_str;
heading_match_rgx = _get.heading_match_rgx;
@@ -520,7 +520,7 @@ auto loopMarkupSrcByLine(
) {
// heading make set
{
- auto _get = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith);
+ ST_flow_heading_make_set _get = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith);
{
line = _get.line;
an_object = _get.this_object;
@@ -558,7 +558,7 @@ auto loopMarkupSrcByLine(
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta);
{
- auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
+ ST_flow_para_match _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
{
an_object = _get.this_object;
an_object_key = _get.this_object_key;
@@ -587,7 +587,7 @@ auto loopMarkupSrcByLine(
} else if (pith["block_state"] == eN.blk_state.closing) {
// line empty, with blocks flag
{
- auto _get = line.flow_block_flag_line_empty_(
+ ST_flow_block_flag_line_empty _get = line.flow_block_flag_line_empty_(
an_object,
bookindex_extract_hash,
the_document_body_section,
@@ -703,7 +703,7 @@ auto loopMarkupSrcByLine(
_anchor_tag = obj_cite_digits.identifier;
// (incrementally build toc) table of contents here!
{
- auto _get = obj_im.flow_table_of_contents_gather_headings(
+ ST_flow_table_of_contents_gather_headings _get = obj_im.flow_table_of_contents_gather_headings(
an_object,
conf_make_meta,
tag_in_seg,
@@ -724,7 +724,7 @@ auto loopMarkupSrcByLine(
if (an_object["lev_markup_number"].to!int <= 4) {
segnames["epub"] ~= tag_in_seg["seg_lv1to4"];
}
- auto comp_obj_ = node_construct.node_emitter_heading(
+ ObjGenericComposite comp_obj_ = node_construct.node_emitter_heading(
an_object,
tag_in_seg,
lev_anchor_tag,
@@ -745,7 +745,7 @@ auto loopMarkupSrcByLine(
the_document_body_section ~= comp_obj_;
debug(objectrelated1) { writeln(line); } // check
{
- auto _get = txt_by_line_common_reset_(line_occur, an_object, pith);
+ ST_txt_by_line_common_reset _get = txt_by_line_common_reset_(line_occur, an_object, pith);
{
line_occur = _get.line_occur;
an_object = _get.this_object;
@@ -766,7 +766,7 @@ auto loopMarkupSrcByLine(
an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg);
an_object["is"] = "para";
- auto comp_obj_ = node_construct.node_location_emitter(
+ ObjGenericComposite comp_obj_ = node_construct.node_location_emitter(
content_non_header,
tag_in_seg,
lev_anchor_tag,
@@ -796,9 +796,9 @@ auto loopMarkupSrcByLine(
comp_obj_.has.inline_links = substantive_obj_misc_struct.has_links;
comp_obj_.has.image_without_dimensions = substantive_obj_misc_struct.has_images_without_dimensions;
the_document_body_section ~= comp_obj_;
- tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc);
+ tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc);
{
- auto _get = txt_by_line_common_reset_(line_occur, an_object, pith);
+ ST_txt_by_line_common_reset _get = txt_by_line_common_reset_(line_occur, an_object, pith);
{
line_occur = _get.line_occur;
an_object = _get.this_object;
@@ -872,7 +872,7 @@ auto loopMarkupSrcByLine(
return ret;
}
{ // loopMarkupSrcByLine
- auto _doc_by_line = loopMarkupSrcByLine(markup_sourcefile_content, an_object, pith);
+ _loopMarkupSrcByLineStruct _doc_by_line = loopMarkupSrcByLine(markup_sourcefile_content, an_object, pith);
the_document_toc_section = _doc_by_line.toc;
the_document_body_section = _doc_by_line.body;
the_document_glossary_section = _doc_by_line.glossary;
@@ -883,7 +883,7 @@ auto loopMarkupSrcByLine(
}
#+END_SRC
-*** post loop (consider and segment/break up further in code & org)
+*** _post loop_ (consider and segment/break up further in code & org)
#+NAME: docAbstractionPostMainLoop
#+HEADER: :noweb yes
@@ -972,7 +972,7 @@ ST_endnotes en_st = note_section.backmatter_endnote_objects(obj_cite_digits, opt
}
{ // document segnames
ST_segnames get_segnames;
- get_segnames = the_document_body_section.after_doc_determine_segnames(the_document_endnotes_section, the_document_glossary_section, the_document_bibliography_section, the_document_bookindex_section, the_document_blurb_section, segnames, html_segnames_ptr_cntr, html_segnames_ptr); //
+ get_segnames = the_document_body_section.after_doc_determine_segnames(the_document_endnotes_section, the_document_glossary_section, the_document_bibliography_section, the_document_bookindex_section, the_document_blurb_section, segnames, html_segnames_ptr_cntr, html_segnames_ptr);
segnames = get_segnames.segnames;
html_segnames_ptr_cntr = get_segnames.html_segnames_ptr_cntr;
html_segnames_ptr = get_segnames.html_segnames_ptr;
@@ -1409,36 +1409,42 @@ string[][string] document_section_keys_sequenced = [
"scroll": ["head", "toc", "body",],
"seg": ["head", "toc", "body",],
"sql": ["head", "body",],
- "latex": ["head", "toc", "body",]
+ "latex": ["head", "toc", "body",],
+ "text": ["head", "toc", "body",],
];
if (document_the["endnotes"].length > 1) {
document_section_keys_sequenced["scroll"] ~= "endnotes";
document_section_keys_sequenced["seg"] ~= "endnotes";
document_section_keys_sequenced["latex"] ~= "endnotes";
+ document_section_keys_sequenced["text"] ~= "endnotes";
}
if (document_the["glossary"].length > 1) {
document_section_keys_sequenced["scroll"] ~= "glossary";
document_section_keys_sequenced["seg"] ~= "glossary";
document_section_keys_sequenced["sql"] ~= "glossary";
document_section_keys_sequenced["latex"] ~= "glossary";
+ document_section_keys_sequenced["text"] ~= "glossary";
}
if (document_the["bibliography"].length > 1) {
document_section_keys_sequenced["scroll"] ~= "bibliography";
document_section_keys_sequenced["seg"] ~= "bibliography";
document_section_keys_sequenced["sql"] ~= "bibliography";
document_section_keys_sequenced["latex"] ~= "bibliography";
+ document_section_keys_sequenced["text"] ~= "bibliography";
}
if (document_the["bookindex"].length > 1) {
document_section_keys_sequenced["scroll"] ~= "bookindex";
document_section_keys_sequenced["seg"] ~= "bookindex";
document_section_keys_sequenced["sql"] ~= "bookindex";
document_section_keys_sequenced["latex"] ~= "bookindex";
+ document_section_keys_sequenced["text"] ~= "bookindex";
}
if (document_the["blurb"].length > 1) {
document_section_keys_sequenced["scroll"] ~= "blurb";
document_section_keys_sequenced["seg"] ~= "blurb";
document_section_keys_sequenced["sql"] ~= "blurb";
document_section_keys_sequenced["latex"] ~= "blurb";
+ document_section_keys_sequenced["text"] ~= "blurb";
}
if ((opt_action.html)
|| (opt_action.html_scroll)
@@ -1456,7 +1462,7 @@ debug(segnames) {
}
#+END_SRC
-*** return structure
+*** _return structure_
#+NAME: docAbstractionReturnsStruct
#+HEADER: :noweb yes
@@ -1534,7 +1540,7 @@ struct DocHas_ {
return tag_assoc;
}
}
-auto doc_has() {
+DocHas_ doc_has() {
return DocHas_();
}
// the doc to be returned
@@ -1550,7 +1556,24 @@ ST_docAbstraction ret;
return ret;
#+END_SRC
-* document header including copyright & license
+* org includes
+** project version
+
+#+NAME: spine_version
+#+HEADER: :noweb yes
+#+BEGIN_SRC emacs-lisp
+<<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:spine_project_version()>>
+#+END_SRC
+
+** year
+
+#+NAME: year
+#+HEADER: :noweb yes
+#+BEGIN_SRC emacs-lisp
+<<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:year()>>
+#+END_SRC
+
+** document header including copyright & license
#+NAME: doc_header_including_copyright_and_license
#+HEADER: :noweb yes