aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta/metadoc_from_src.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-01-13 14:19:04 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-17 16:59:38 -0400
commit87d62f48d6c8a2ccf9807f56c23a6ca71d1102e6 (patch)
treee367aff1a05f89104c7c81ac8a6c618a4f38b021 /src/doc_reform/meta/metadoc_from_src.d
parent0.4.2 xmls output, internal (diff)
0.4.3 stow (most) uri/links in array, separate from object text
- munge independently - no need to consider special munging of uri with text - uri can easily be munged independently (encoded as need be)
Diffstat (limited to 'src/doc_reform/meta/metadoc_from_src.d')
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index 9d2935c..de2df2b 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -1731,6 +1731,25 @@ template DocReformDocAbstraction() {
}
return obj;
}
+ auto _links(O)(O obj) {
+ if (auto m = obj.text.match(rgx.inline_link_stow_uri)) {
+ debug(links) {
+ writeln("number of link matches to stow: ", (obj.text.match(rgx.inline_link_stow_uri)).count);
+ writeln("links to stow: ", (obj.text.match(rgx.inline_link_stow_uri)));
+ }
+ int _n_matches = (obj.text.match(rgx.inline_link_stow_uri)).count.to!int;
+ for(int i=0; i < _n_matches; ++i) {
+ if (obj.text.match(rgx.inline_link_stow_uri)) {
+ obj.stow.link ~= obj.text.matchFirst(rgx.inline_link_stow_uri)[2];
+ obj.text = obj.text.replaceFirst(
+ rgx.inline_link_stow_uri,
+ format(q"¶┥%s┝┤%s├¶", "$1", i)
+ );
+ }
+ }
+ }
+ return obj;
+ }
foreach (ref obj; the_document_head_section) {
if (obj.metainfo.is_a == "heading") {
debug(dom) {
@@ -1760,6 +1779,7 @@ template DocReformDocAbstraction() {
}
obj = obj_heading_ancestors(obj, lv_ancestors_txt);
}
+ obj = _links(obj);
}
if (the_table_of_contents_section.length > 1) {
/+ scroll +/
@@ -1787,6 +1807,7 @@ template DocReformDocAbstraction() {
}
obj = obj_heading_ancestors(obj, lv_ancestors_txt);
}
+ obj = _links(obj);
}
}
/+ multiple 1~ levels, loop through document body +/
@@ -1833,6 +1854,7 @@ template DocReformDocAbstraction() {
_images ~= extract_images(obj.text);
obj = _image_dimensions(manifest_matter, obj);
}
+ obj = _links(obj);
}
}
auto images=uniq(_images.sort());
@@ -1873,6 +1895,7 @@ template DocReformDocAbstraction() {
}
obj = obj_heading_ancestors(obj, lv_ancestors_txt);
}
+ obj = _links(obj);
}
}
/+ optional only one 1~ level +/
@@ -1912,6 +1935,7 @@ template DocReformDocAbstraction() {
obj.metainfo.ocn = obj_cite_digits.object_number;
obj.metainfo.identifier = obj_cite_digits.identifier;
}
+ obj = _links(obj);
}
}
/+ optional only one 1~ level +/
@@ -1951,6 +1975,7 @@ template DocReformDocAbstraction() {
obj.metainfo.ocn = obj_cite_digits.object_number;
obj.metainfo.identifier = obj_cite_digits.identifier;
}
+ obj = _links(obj);
}
}
/+ optional only one 1~ level +/
@@ -1999,6 +2024,7 @@ template DocReformDocAbstraction() {
obj.metainfo.o_n_book_index = obj_cite_digits.bkidx;
obj.metainfo.object_number_type = OCNtype.bkidx;
}
+ obj = _links(obj);
}
/+ TODO assert failure, reinstate
assert(obj_cite_digit_bkidx == ocn_bidx_
@@ -2042,6 +2068,7 @@ template DocReformDocAbstraction() {
obj.metainfo.object_number_off = obj_cite_digits.off;
obj.metainfo.object_number_type = OCNtype.non;
}
+ obj = _links(obj);
}
}
if (the_document_body_section.length > 1) {