aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-11-18 10:17:40 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:13 -0400
commita881c428c12f4948e4ea65b9315a3fabef8c7b4f (patch)
tree8c6c1cf05126f86fe955a4601cd92fb0a9a399bb /org
parentminor reorganise same (diff)
munge links & urls for sections: toc, endnotes, book index
Diffstat (limited to 'org')
-rw-r--r--org/ao_abstract_doc_source.org58
-rw-r--r--org/ao_defaults.org11
2 files changed, 48 insertions, 21 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org
index 7c10dca..4934a5a 100644
--- a/org/ao_abstract_doc_source.org
+++ b/org/ao_abstract_doc_source.org
@@ -203,6 +203,8 @@ the_table_of_contents_section = [
"seg": [toc_head],
"scroll": [toc_head],
];
+auto mkup = InlineMarkup();
+auto munge = ObjInlineMarkupMunge();
#+END_SRC
** _2. loop: process document body_ [+6] :loop:
@@ -1079,6 +1081,7 @@ if (the_endnotes_section["seg"].length > 1) {
"Endnotes",
"endnotes", // segment_object_belongs_to
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1095,6 +1098,7 @@ if (the_endnotes_section["scroll"].length > 1) {
"Endnotes",
"endnotes", // _anchor_tag
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1111,6 +1115,7 @@ if (the_glossary_section.length > 1) {
"Glossary",
"glossary", // segment_object_belongs_to
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1125,6 +1130,7 @@ if (the_glossary_section.length > 1) {
"Glossary",
"glossary", // _anchor_tag
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1141,6 +1147,7 @@ if (the_bibliography_section.length > 1){
"Bibliography",
"bibliography", // segment_object_belongs_to
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1155,6 +1162,7 @@ if (the_bibliography_section.length > 1){
"Bibliography",
"bibliography", // _anchor_tag
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1171,6 +1179,7 @@ if (the_bookindex_section["seg"].length > 1) {
"Book Index",
"bookindex", // segment_object_belongs_to
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1187,6 +1196,7 @@ if (the_bookindex_section["scroll"].length > 1) {
"Book Index",
"bookindex", // _anchor_tag
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1203,6 +1213,7 @@ if (the_blurb_section.length > 1) {
"Blurb",
"blurb", // segment_object_belongs_to
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
set_abstract_object.contents_para(
"toc",
@@ -1217,6 +1228,7 @@ if (the_blurb_section.length > 1) {
"Blurb",
"blurb", // _anchor_tag
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
set_abstract_object.contents_para(
"toc",
@@ -3128,7 +3140,12 @@ struct ObjInlineMarkup {
char[] heading_toc_,
) {
auto m = matchFirst(cast(char[]) heading_toc_, rgx.heading);
- heading_toc_ = m.post;
+ heading_toc_ =
+ replaceAll(
+ m.post,
+ rgx.inline_notes_curly_gen,
+ ("")
+ );
return heading_toc_;
};
auto table_of_contents_gather_headings(
@@ -3152,6 +3169,7 @@ struct ObjInlineMarkup {
heading_toc_,
_anchor_tag,
);
+ toc_txt_= munge.url_links(toc_txt_);
indent=[
"hang_position" : to!int(obj_["lev_markup_number"]),
"base_position" : to!int(obj_["lev_markup_number"]),
@@ -3161,6 +3179,7 @@ struct ObjInlineMarkup {
heading_toc_,
_anchor_tag,
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["scroll"] ~=
set_abstract_object.contents_para(
"toc",
@@ -3191,10 +3210,12 @@ struct ObjInlineMarkup {
"hang_position" : 0,
"base_position" : 0,
];
+ 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(
"toc",
- "{ Table of Contents }../toc.fn_suffix",
+ toc_txt_,
"", // attrib
0,
indent,
@@ -3210,6 +3231,7 @@ struct ObjInlineMarkup {
"%s",
heading_toc_,
);
+ toc_txt_= munge.url_links(toc_txt_);
the_table_of_contents_section["seg"] ~=
set_abstract_object.contents_para(
"toc",
@@ -3226,6 +3248,7 @@ struct ObjInlineMarkup {
heading_toc_,
segment_object_belongs_to,
);
+ toc_txt_= munge.url_links(toc_txt_);
indent=[
"hang_position" : to!int(obj_["lev_markup_number"]),
"base_position" : to!int(obj_["lev_markup_number"]),
@@ -3247,6 +3270,7 @@ struct ObjInlineMarkup {
segment_object_belongs_to,
_anchor_tag,
);
+ toc_txt_= munge.url_links(toc_txt_);
indent=[
"hang_position" : to!int(obj_["lev_markup_number"]),
"base_position" : to!int(obj_["lev_markup_number"]),
@@ -3895,6 +3919,7 @@ struct BookIndexReportIndent {
struct BookIndexReportSection {
int mkn, skn;
auto rgx = Rgx();
+ auto munge = ObjInlineMarkupMunge();
#+END_SRC
***** bookindex write section
@@ -4007,10 +4032,10 @@ struct BookIndexReportSection {
bi_tmp_seg = "!{" ~ mainkey ~ "}! ";
foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) {
auto go = replaceAll(ref_, rgx.book_index_go, "$1");
- bi_tmp_scroll ~= (" {" ~ ref_ ~ "}#" ~ go ~ ", ");
+ bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ");
bi_tmp_seg ~= (segment_object_belongs_to.empty)
- ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ")
- : (" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
+ ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ")
+ : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
}
bi_tmp_scroll ~= " \\\\\n ";
bi_tmp_seg ~= " \\\\\n ";
@@ -4022,10 +4047,10 @@ struct BookIndexReportSection {
bi_tmp_seg ~= subkey ~ ", ";
foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) {
auto go = replaceAll(ref_, rgx.book_index_go, "$1");
- bi_tmp_scroll ~= (" {" ~ ref_ ~ "}#" ~ go ~ ", ");
+ bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ");
bi_tmp_seg ~= (segment_object_belongs_to.empty)
- ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ")
- : (" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
+ ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ")
+ : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
}
bi_tmp_scroll ~= " \\\\\n ";
bi_tmp_seg ~= " \\\\\n ";
@@ -4128,6 +4153,7 @@ struct NotesSection {
);
}
body {
+ auto munge = ObjInlineMarkupMunge();
foreach(m;
matchAll(contents_am[counter].object,
rgx.inline_notes_delimiter_al_regular_number_note)) {
@@ -4138,16 +4164,16 @@ struct NotesSection {
}
// TODO NEXT you need anchor for segments at this point ->
object_notes["seg"] ~=
- "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
- m.captures[1] ~ " " ~ m.captures[2] ~ "』";
+ munge.url_links("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
+ m.captures[1]) ~ " " ~ m.captures[2] ~ "』";
object_notes["seg"] ~= (segment_object_belongs_to.empty)
- ? ("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
- m.captures[1] ~ " " ~ m.captures[2] ~ "』")
- : ("{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_object_belongs_to ~ ".fn_suffix#noteref_" ~
- m.captures[1] ~ " " ~ m.captures[2] ~ "』");
+ ? (munge.url_links("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
+ m.captures[1]) ~ " " ~ m.captures[2] ~ "』")
+ : (munge.url_links("{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_object_belongs_to ~ ".fn_suffix#noteref_" ~
+ m.captures[1]) ~ " " ~ m.captures[2] ~ "』");
object_notes["scroll"] ~=
- "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
- m.captures[1] ~ " " ~ m.captures[2] ~ "』";
+ munge.url_links("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
+ m.captures[1]) ~ " " ~ m.captures[2] ~ "』";
}
return object_notes;
}
diff --git a/org/ao_defaults.org b/org/ao_defaults.org
index 4ed98a6..20952fb 100644
--- a/org/ao_defaults.org
+++ b/org/ao_defaults.org
@@ -701,11 +701,12 @@ static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)
#+name: ao_rgx
#+BEGIN_SRC d
-static inline_url = ctRegex!(`((?:https?|git):\/\/\S+)`, "mg");
-static inline_link_naked_url = ctRegex!(`(^|[ ])((?:https?|git):\/\/\S+?)([.,;:?!]?(?:[ ]|$))`, "mg");
-static inline_link_markup_regular = ctRegex!(`(^|[ ])\{\s*(.+?)\s*\}((?:https?|git):\/\/\S+?)([.,;:?!]?(?:[ ]|$))`, "mg");
-static inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(.+?)\}((?:https?|git):\/\/\S+?)([.,;:?!]?(?:[ ]|$))`, "mg");
-static inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(.+?)\}((?:https?|git):\/\/\S+)`, "mg");
+static inline_url = ctRegex!(`((?:(?:https?|git):\/\/|\.\.\/|\.\/|#)\S+)`, "mg");
+static inline_link_naked_url = ctRegex!(`(^|[ ])((?:(?:https?|git):\/\/|\.\.\/|\.\/|#)\S+?)([.,;:?!]?(?:[ ]|$))`, "mg");
+static inline_link_markup_regular = ctRegex!(`(^|[ ])\{\s*(.+?)\s*\}((?:(?:https?|git):\/\/|\.\.\/|\.\/|#)\S+?)([.,;:?!]?(?:[ ]|$))`, "mg");
+static inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(.+?)\}((?:(?:https?|git):\/\/|\.\.\/|\.\/|#)\S+?)([.,;:?!]?(?:[ ]|$))`, "mg");
+static inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(.+?)\}((?:(?:https?|git):\/\/|\.\.\/|\.\/|#)\S+)`, "mg");
+static inline_a_url = ctRegex!(`(┤)(\S+?)(├)`, "mg");
#+END_SRC
** inline markup book index :inline:bookindex: