aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-11-28 20:03:08 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:13 -0400
commit42942142d1379e7e5361a641f837beb54b23a2f1 (patch)
tree83ddd207debd3f854b6b5d2150807c9abd457c8a /org
parenthousekeeping (diff)
discrete objects marks, output html work in progress
Diffstat (limited to 'org')
-rw-r--r--org/ao_abstract_doc_source.org77
-rw-r--r--org/ao_defaults.org2
-rw-r--r--org/output.org118
3 files changed, 160 insertions, 37 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org
index b3c4cd6..690c029 100644
--- a/org/ao_abstract_doc_source.org
+++ b/org/ao_abstract_doc_source.org
@@ -842,7 +842,7 @@ if (the_document_body_section.length > 0) {
#+name: abs_post
#+BEGIN_SRC d
debug(objectrelated2) { // check
- writeln(line);
+ writeln(line);
}
/+
Backmatter:
@@ -1088,7 +1088,7 @@ if (the_endnotes_section["seg"].length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1105,7 +1105,7 @@ if (the_endnotes_section["scroll"].length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1122,7 +1122,7 @@ if (the_glossary_section.length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1137,7 +1137,7 @@ if (the_glossary_section.length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1154,7 +1154,7 @@ if (the_bibliography_section.length > 1){
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1169,7 +1169,7 @@ if (the_bibliography_section.length > 1){
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1186,7 +1186,7 @@ if (the_bookindex_section["seg"].length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1203,7 +1203,7 @@ if (the_bookindex_section["scroll"].length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1220,7 +1220,7 @@ if (the_blurb_section.length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -1235,7 +1235,7 @@ if (the_blurb_section.length > 1) {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -3195,7 +3195,7 @@ struct ObjInlineMarkup {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -3209,7 +3209,7 @@ struct ObjInlineMarkup {
"base_position" : 0,
];
the_table_of_contents_section["scroll"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
"Table of Contents",
"", // attrib
@@ -3227,7 +3227,7 @@ struct ObjInlineMarkup {
toc_txt_ = "{ Table of Contents }../toc.fn_suffix";
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -3247,7 +3247,7 @@ struct ObjInlineMarkup {
);
toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -3268,7 +3268,7 @@ struct ObjInlineMarkup {
"base_position" : to!int(obj_["lev_markup_number"]),
];
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -3290,7 +3290,7 @@ struct ObjInlineMarkup {
"base_position" : to!int(obj_["lev_markup_number"]),
];
the_table_of_contents_section["seg"] ~=
- set_abstract_object.contents_para(
+ set_abstract_object.contents_toc(
"toc",
toc_txt_,
"", // attrib
@@ -4182,11 +4182,7 @@ struct NotesSection {
m.captures[2]); // sometimes need segment name (segmented html & epub)
}
// TODO NEXT you need anchor for segments at this point ->
- object_notes["seg"] ~=
- munge.url_links(
- "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
- m.captures[1]
- ) ~ " " ~ m.captures[2] ~ "』";
+ object_notes["anchor"] ~= "#note_" ~ m.captures[1] ~ "』";
object_notes["seg"] ~= (segment_object_belongs_to.empty)
? (munge.url_links(
"{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
@@ -4218,9 +4214,11 @@ struct NotesSection {
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_["anchor"] = (split(object_notes["anchor"], rgx.break_string))[0..$-1];
} else {
endnotes_["seg"] = [];
endnotes_["scroll"] = [];
+ endnotes_["anchor"] = [];
}
return endnotes_;
}
@@ -4316,15 +4314,15 @@ struct NotesSection {
1
);
}
- foreach (endnote; endnotes_["seg"]) {
+ foreach (i, endnote; endnotes_["seg"]) {
attrib="";
the_endnotes_section["seg"] ~=
- set_abstract_object.contents_endnote(endnote);
+ set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]);
}
- foreach (endnote; endnotes_["scroll"]) {
+ foreach (i, endnote; endnotes_["scroll"]) {
attrib="";
the_endnotes_section["scroll"] ~=
- set_abstract_object.contents_endnote(endnote);
+ set_abstract_object.contents_endnote(endnote, endnotes_["anchor"][i]);
}
auto t = tuple(the_endnotes_section, obj_cite_number);
return t;
@@ -5066,12 +5064,38 @@ auto contents_para(
}
#+END_SRC
+*** toc :para:
+
+#+name: ao_object_setter_para
+#+BEGIN_SRC d
+auto contents_toc(
+ in string is_a,
+ in string object,
+ in string attrib,
+ in int obj_cite_number,
+ in int[string] indent,
+ in bool bullet
+) {
+ ObjComposite object_set;
+ object_set.use = "content";
+ object_set.of = "para";
+ object_set.is_a = "toc";
+ object_set.object = object.strip;
+ object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
+ object_set.para_attrib.indent_start = to!int(indent["hang_position"]);
+ object_set.para_attrib.indent_rest = to!int(indent["base_position"]);
+ object_set.para_attrib.bullet = false; // bullet;
+ return object_set;
+}
+#+END_SRC
+
*** para_endnote :para:
#+name: ao_object_setter_endnote
#+BEGIN_SRC d
auto contents_endnote(
in string object,
+ in string tag,
) {
auto m = (matchFirst(object, rgx.note_ref));
string notenumber = to!string(m.captures[1]);
@@ -5082,6 +5106,7 @@ auto contents_endnote(
object_set.is_a = "endnote";
object_set.object = object.strip;
object_set.obj_cite_number = "";
+ object_set.anchor_tags ~= [ tag ];
object_set.para_attrib.indent_start = 0;
object_set.para_attrib.indent_rest = 0;
object_set.para_attrib.bullet = false;
diff --git a/org/ao_defaults.org b/org/ao_defaults.org
index 8dde679..b5ed652 100644
--- a/org/ao_defaults.org
+++ b/org/ao_defaults.org
@@ -672,7 +672,7 @@ static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(\d+)\s+(.+
static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m");
static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m");
static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)【(?:[*+ ]*)(?P<note>.+?)】`, "mg");
-static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+ ]*.+?】|$))`, "mg");
+static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
#+END_SRC
** links/ urls :inline:footnote:
diff --git a/org/output.org b/org/output.org
index d17020f..b77c2dd 100644
--- a/org/output.org
+++ b/org/output.org
@@ -31,7 +31,7 @@ auto html_heading(O)(
o = format(q"¶<br><hr /><br>
<div class="substance">
<label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
- <h%s class="norm" id="%s"><a name="%s"></a>
+ <h%s class="%s" id="%s"><a name="%s"></a>
%s
</h%s>
</div>
@@ -39,6 +39,7 @@ auto html_heading(O)(
obj.obj_cite_number,
obj.obj_cite_number,
obj.heading_attrib.lev_markup_number,
+ obj.is_a,
obj.obj_cite_number,
obj.obj_cite_number,
obj.object,
@@ -56,17 +57,109 @@ auto html_para(O)(
auto ref const O obj,
) {
string o;
+ if (obj.obj_cite_number.empty) {
+ o = format(q"¶<div class="substance">
+ <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
+ <p class="%s" attrib="h%si%s">
+ %s
+ </p>
+ </div>
+ ¶",
+ obj.obj_cite_number,
+ obj.obj_cite_number,
+ obj.is_a,
+ obj.para_attrib.indent_start,
+ obj.para_attrib.indent_rest,
+ obj.object
+ );
+ } else {
+ o = format(q"¶<div class="substance">
+ <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
+ <p class="%s" attrib="h%si%s" id="%s">
+ %s
+ </p>
+ </div>
+ ¶",
+ obj.obj_cite_number,
+ obj.obj_cite_number,
+ obj.is_a,
+ obj.para_attrib.indent_start,
+ obj.para_attrib.indent_rest,
+ obj.obj_cite_number,
+ obj.object
+ );
+ }
+ return o;
+}
+#+END_SRC
+
+***** html endnote
+
+#+name: output_html
+#+BEGIN_SRC d
+auto html_endnote(O)(
+ auto ref const O obj,
+) {
+ string o;
+ o = format(q"¶<div class="substance">
+ <label class="tag"><a name="%s" a href="%s" class="lnkocn"></a></label>
+ <p class="%s" attrib="h%si%s">
+ %s
+ </p>
+ </div>
+ ¶",
+ obj.anchor_tags[0],
+ obj.anchor_tags[0],
+ obj.is_a,
+ obj.para_attrib.indent_start,
+ obj.para_attrib.indent_rest,
+ obj.object
+ );
+ return o;
+}
+#+END_SRC
+
+***** html 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" attrib="h%si%s">
+ %s
+ </p>
+ </div>
+ ¶",
+ obj.is_a,
+ obj.para_attrib.indent_start,
+ obj.para_attrib.indent_rest,
+ obj.object
+ );
+ return o;
+}
+#+END_SRC
+
+***** html nugget
+
+#+name: output_html
+#+BEGIN_SRC d
+auto html_nugget(O)(
+ auto ref const O obj,
+) {
+ string o;
o = format(q"¶<div class="substance">
<label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
- <p class="h%si%s" id="%s">
+ <p class="%s" id="%s">
%s
</p>
</div>
¶",
obj.obj_cite_number,
obj.obj_cite_number,
- obj.para_attrib.indent_start,
- obj.para_attrib.indent_rest,
+ obj.is_a,
obj.obj_cite_number,
obj.object
);
@@ -146,29 +239,34 @@ void scroll(C)(
case "heading":
body_html ~= html_heading(obj);
break;
+ case "toc":
+ body_html ~= html_toc(obj);
+ break;
case "para":
body_html ~= html_para(obj);
break;
case "verse":
- body_html ~= html_para(obj);
+ body_html ~= html_nugget(obj);
break;
case "group":
- body_html ~= html_para(obj);
+ body_html ~= html_nugget(obj);
break;
case "block":
- body_html ~= html_para(obj);
+ body_html ~= html_nugget(obj);
break;
case "quote":
- body_html ~= html_para(obj);
+ body_html ~= html_nugget(obj);
break;
case "table":
body_html ~= html_para(obj);
break;
case "code":
- body_html ~= html_para(obj);
+ body_html ~= html_nugget(obj);
+ break;
+ case "endnote":
+ body_html ~= html_endnote(obj);
break;
default:
- body_html ~= html_para(obj);
break;
}
}