aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-03-20 13:03:02 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-17 16:59:38 -0400
commitda32ec40fc237b03f22aac329017d06735289a3a (patch)
treedf8f2ddcf1dda26914939c73f11b87db57ae6c64
parent0.5.0 per object inline munging (rather than by line) (diff)
housekeepingdoc-reform_v0.5.0
-rw-r--r--org/default_misc.org1
-rw-r--r--org/default_paths.org33
-rw-r--r--org/default_regex.org50
-rw-r--r--org/doc_reform.org38
-rw-r--r--org/meta_abstraction.org310
-rw-r--r--org/meta_debugs.org16
-rw-r--r--org/output_sqlite.org12
-rw-r--r--org/output_xmls.org28
-rwxr-xr-xsrc/doc_reform/doc_reform.d3
-rw-r--r--src/doc_reform/meta/defaults.d1
-rw-r--r--src/doc_reform/meta/doc_debugs.d16
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d310
-rw-r--r--src/doc_reform/meta/metadochead.d85
-rw-r--r--src/doc_reform/meta/rgx.d43
-rw-r--r--src/doc_reform/output/defaults.d1
-rw-r--r--src/doc_reform/output/epub3.d8
-rw-r--r--src/doc_reform/output/paths_output.d8
-rw-r--r--src/doc_reform/output/rgx.d17
-rw-r--r--src/doc_reform/output/sqlite.d12
-rw-r--r--src/doc_reform/output/xmls.d18
-rw-r--r--src/doc_reform/source/paths_source.d25
21 files changed, 635 insertions, 400 deletions
diff --git a/org/default_misc.org b/org/default_misc.org
index 320021e..769f4db 100644
--- a/org/default_misc.org
+++ b/org/default_misc.org
@@ -224,6 +224,7 @@ template InternalMarkup() {
static struct InlineMarkup {
auto en_a_o = "【"; auto en_a_c = "】";
auto en_b_o = "〖"; auto en_b_c = "〗";
+ auto quote_o = "“"; auto quote_c = "”";
auto ff_o = "┨"; auto ff_c = "┣"; // fontface
auto lnk_o = "┥"; auto lnk_c = "┝";
auto url_o = "┤"; auto url_c = "├";
diff --git a/org/default_paths.org b/org/default_paths.org
index 68c7da8..55ee430 100644
--- a/org/default_paths.org
+++ b/org/default_paths.org
@@ -166,7 +166,7 @@ template PathMatters() {
string manifest_path() {
return _manifest.pod_manifest_path;
}
- string pod_name() {
+ string pod_name_with_path() {
return _manifest.pod_manifest_path.baseName;
}
string manifest_file_with_path() {
@@ -213,9 +213,12 @@ template PathMatters() {
string path_and_fn() {
return _fns;
}
- string pod_name() {
+ string pod_name_with_path() {
return (is_pod) ? _manifest.pod_manifest_path : "";
}
+ string pod_name() {
+ return pod_name_with_path.baseName;
+ }
string filename() {
return path_and_fn.baseName;
}
@@ -234,11 +237,11 @@ template PathMatters() {
}
string doc_uid() {
string _uid;
- if (is_pod && !(pod_name.empty)) {
- if (pod_name.baseName == filename_base) {
+ if (is_pod && !(pod_name_with_path.empty)) {
+ if (pod_name_with_path.baseName == filename_base) {
_uid = filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
} else {
- _uid = pod_name.baseName ~ _sep ~ filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
+ _uid = pod_name_with_path.baseName ~ _sep ~ filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
}
} else {
_uid = _sep ~ filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
@@ -254,10 +257,10 @@ template PathMatters() {
- sqlite discrete index (multilingual, each language of a document)
+/
string _fn;
- if (pod_name.baseName == filename_base) {
+ if (pod_name_with_path.baseName == filename_base) {
_fn = filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
- } else if (!(pod_name.empty)) {
- _fn = pod_name.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
+ } else if (!(pod_name_with_path.empty)) {
+ _fn = pod_name_with_path.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
} else {
_fn = "_" ~ _sep ~ filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
}
@@ -273,10 +276,10 @@ template PathMatters() {
- sqlite discrete index (multilingual collection)
+/
string _fn;
- if (pod_name.baseName == filename_base) {
+ if (pod_name_with_path.baseName == filename_base) {
_fn = filename_base ~ _sep ~ filename_extension;
- } else if (!(pod_name.empty)) {
- _fn = pod_name.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension;
+ } else if (!(pod_name_with_path.empty)) {
+ _fn = pod_name_with_path.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension;
} else {
_fn = "_" ~ _sep ~ filename_base ~ _sep ~ filename_extension;
}
@@ -978,7 +981,7 @@ template DocReformOutPathsFnPd() {
/+ TODO stuff to work out here +/
auto DocReformOutPathsFnPd(Fn,Pn)(
Fn fn_src_pth,
- Pn pod_name
+ Pn pod_name_with_path
) {
struct _PathsStruct {
string base_filename() {
@@ -996,11 +999,11 @@ template DocReformOutPathsFnPd() {
+/
string _fn_src = fn_src_pth.baseName.stripExtension;
string _output_base_name;
- if (!(pod_name.empty)) {
- if (pod_name == _fn_src) {
+ if (!(pod_name_with_path.empty)) {
+ if (pod_name_with_path == _fn_src) {
_output_base_name = _fn_src;
} else {
- _output_base_name = pod_name ~ "." ~ _fn_src;
+ _output_base_name = pod_name_with_path ~ "." ~ _fn_src;
}
} else {
_output_base_name = _fn_src;
diff --git a/org/default_regex.org b/org/default_regex.org
index b20c564..f95be72 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -162,8 +162,8 @@ static heading_biblio_blurb = ctRegex!(`^:?(?:(1)[~][!
static heading_blurb_glossary = ctRegex!(`^:?(?:(1)[~][!](?:blurb|glossary)|[A-D1][~])`);
static para_bullet = ctRegex!(`^_[*] `);
static para_bullet_indent = ctRegex!(`^_([1-9])[*] `);
-static para_indent = ctRegex!(`^_([1-9]) `);
-static para_indent_hang = ctRegex!(`^_([0-9])_([0-9]) `);
+static para_indent = ctRegex!(`^_(?P<indent>[1-9])[ ]`);
+static para_indent_hang = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`);
static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `);
static para_inline_link_anchor = ctRegex!(`\*[~](?P<anchor>[a-z0-9_.-]+)(?= |$)`,"i");
#+END_SRC
@@ -280,10 +280,18 @@ static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<co
#+name: meta_rgx
#+BEGIN_SRC d
static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg");
-static smid_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>\S+\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+static smid_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
static smid_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
-static smid_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>\S+\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+static smid_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
static smid_mod_image_without_dimensions = ctRegex!(`[{┥](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}┝](?:image|┤.*?├|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+static smid_a_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+static smid_a_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+static smid_a_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+static smid_a_mod_image_without_dimensions = ctRegex!(`[{](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}](?:image|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+static smid_b_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+static smid_b_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+static smid_b_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+static smid_b_mod_image_without_dimensions = ctRegex!(`[┥](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[┝](?:┤.*?├|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
static smid_image_delimit = ctRegex!(`(?P<pre>^|[ ]|[^\S]?)\{\s*(?P<text>.+?)\s*\}(?:image)(?=[;:!,?.]?([ )\]]|$))`, "mg");
#+END_SRC
@@ -297,6 +305,22 @@ static book_index_open = ctRegex!(`^=\{\s*([^}]*?
static book_index_close = ctRegex!(`^(.*?)\}$`, "m");
#+END_SRC
+** switch
+*** switch off auto-heading number
+
+#+name: meta_rgx
+#+BEGIN_SRC d
+static auto_heading_numbering_lv1 = ctRegex!(`^1~`, "m");
+static auto_heading_numbering_lv2 = ctRegex!(`^2~`, "m");
+static auto_heading_numbering_lv3 = ctRegex!(`^3~`, "m");
+static auto_heading_numbering_lv4 = ctRegex!(`^4~`, "m");
+static auto_heading_numbering_off = ctRegex!(`^[A-D1-4]~\S*?-\s`, "m");
+static auto_heading_numbering_off_lv1 = ctRegex!(`^1~\S*?-\s`, "m");
+static auto_heading_numbering_off_lv2 = ctRegex!(`^2~\S*?-\s`, "m");
+static auto_heading_numbering_off_lv3 = ctRegex!(`^3~\S*?-\s`, "m");
+static auto_heading_numbering_off_lv4 = ctRegex!(`^4~\S*?-\s`, "m");
+#+END_SRC
+
** no object_number object :ocn:off:object:
#+name: meta_rgx
@@ -305,6 +329,7 @@ static book_index_close = ctRegex!(`^(.*?)\}$`, "m
static object_number_off = ctRegex!(`~#[ ]*$`, "m");
static object_number_off_dh = ctRegex!(`-#$`, "m");
static object_number_off_all = ctRegex!(`[~-]#$`, "m");
+static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`);
#+END_SRC
** no object_number block :ocn:off:block:
@@ -467,6 +492,11 @@ static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a
#+name: prgmkup_rgx
#+BEGIN_SRC d
/+ line breaks +/
+static empty_line = ctRegex!(`^\s*$`);
+static empty_block = ctRegex!(`^\s*$`, "mg");
+static br_line_natural = ctRegex!(`\n`, "mg");
+static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg");
+static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg");
static br_line = ctRegex!(`┘`, "mg");
static br_nl = ctRegex!(`┙`, "mg");
static br_paragraph = ctRegex!(`┚`, "mg");
@@ -483,15 +513,15 @@ static br_page_new = ctRegex!(`╂`, "mg");
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented
static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
+static inline_notes_al_regular = ctRegex!(`【(.+?)】`, "mg");
static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m");
static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg");
+static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg");
static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m");
static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m");
static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m");
static inline_al_delimiter_close_regular = ctRegex!(`】`, "m");
static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m");
-static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg");
-static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)】`, "mg");
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");
@@ -502,9 +532,10 @@ static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]
#+name: prgmkup_rgx
#+BEGIN_SRC d
-/+ inline markup footnotes endnotes +/
-static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
-static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+/+ inline markup links +/
+static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+static inline_image_info = ctRegex!(`☼?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg");
static inline_link_anchor = ctRegex!(`┋(?P<anchor>\S+?)┋`, "mg"); // TODO *~text_link_anchor
static inline_link_ = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>\S+?)├`, "mg");
@@ -516,6 +547,7 @@ static inline_link_hash = ctRegex!(`┥(?P<text>.+
static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg");
static url = ctRegex!(`https?://`, "mg");
+static uri = ctRegex!(`(?:https?|git)://`, "mg");
static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
static fn_suffix = ctRegex!(`\.fnSuffix`, "mg");
static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
diff --git a/org/doc_reform.org b/org/doc_reform.org
index d7ea680..2fd11ac 100644
--- a/org/doc_reform.org
+++ b/org/doc_reform.org
@@ -69,7 +69,8 @@ version (Posix) {
module doc_reform.sisu_document_parser;
import
doc_reform.conf.compile_time_info,
- doc_reform.meta.metadoc;
+ doc_reform.meta.metadoc,
+ doc_reform.meta.metadochead;
<<imports_doc_reform>>
import std.algorithm;
import std.parallelism;
@@ -832,8 +833,39 @@ writeln("no recognized filename");
break; // terminate, stop
#+END_SRC
-* 2. _document abstraction functions_ :module:doc_reform:abstraction:
-** 0. module template
+* 2. pre-processing
+** Harvest _get document head_ for harvest (separate thread)
+*** 0 module template
+- harvest, get document head
+
+#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadochead.d"
+module doc_reform.meta.metadochead;
+template DocReformHarvestGetFromHead() { // TODO
+ <<imports_doc_reform>>
+ <<doc_reform_mixin>>
+ enum headBody { header, body_content, insert_file_list, image_list }
+ enum makeMeta { make, meta }
+ enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images }
+ static auto rgx = Rgx();
+ auto DocReformHarvestGetFromHead(E,O,M)( // TODO
+ E _env,
+ O _opt_action,
+ M _manifest
+ ){
+ <<doc_reform_conf_files_in_toml>>
+ <<doc_reform_each_file_do_read_and_split_sisu_markup_file_content_into_header_and_body>>
+ <<doc_reform_each_file_do_split_sisu_markup_file_header_into_make_and_meta_structs>>
+ <<doc_reform_each_file_do_document_matters_abridged>>
+ auto t = tuple(doc_matters_shared, doc_matters_abridged_collected);
+ static assert(t.length==2);
+ return t;
+ }
+}
+#+END_SRC
+
+** Output _document abstraction functions_ :module:doc_reform:abstraction:
+*** 0 module template
+- abstraction template
#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc.d"
module doc_reform.meta.metadoc;
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index 6ea5d5d..1121d15 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -415,6 +415,7 @@ static auto ocn_emit(int ocn_status_flag) {
static auto inline_markup_faces(L)(L line) {
static auto rgx = Rgx();
static auto mkup = InlineMarkup();
+ line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes);
line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono);
line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite);
foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) {
@@ -663,10 +664,6 @@ scope(failure) {
line,
);
}
-line = line.replaceAll(rgx.true_dollar, "$$$$");
- /+ dollar represented as $$ needed to stop submatching on $
- (substitutions using ${identifiers} must take into account (i.e. happen earlier))
- +/
debug(source) {
writeln(line);
}
@@ -884,8 +881,8 @@ if there is a blurb section you need to:
debug(paraindent) {
writeln(line);
}
- indent["hang_position"] = (m.captures[1]).to!int;
- indent["base_position"] = 0;
+ indent["hang_position"] = (m[1]).to!int;
+ indent["base_position"] = (m[1]).to!int;
} else if (line.matchFirst(rgx.para_bullet)) {
debug(parabullet) {
writeln(line);
@@ -896,16 +893,16 @@ if there is a blurb section you need to:
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : (m.captures[2]).to!int,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[2]).to!int,
];
} else if (auto m = line.matchFirst(rgx.para_bullet_indent)) {
debug(parabulletindent) {
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : 0,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[1]).to!int,
];
bullet = true;
}
@@ -1290,7 +1287,7 @@ if ((obj_type_status["heading"] == State.on)
an_object["is"] = "heading";
an_object_key="body_nugget";
auto substantive_object_and_anchor_tags_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, _new_doc);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, ((_new_doc) ? Yes._new_doc : No._new_doc));
an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content];
anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag];
if (_new_doc) {
@@ -1412,6 +1409,10 @@ if ((obj_type_status["heading"] == State.on)
} else if ((obj_type_status["para"] == State.on)
&& (line_occur["para"] > State.off)) {
/+ paragraph object (current line empty) +/
+ /+ repeated character paragraph separator +/
+ if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) {
+ obj_type_status["ocn_status"] = OCNstatus.off;
+ }
obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
an_object["bookindex_nugget"]
= ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
@@ -1430,7 +1431,7 @@ if ((obj_type_status["heading"] == State.on)
an_object["is"],
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_para = comp_obj_para.init;
@@ -1493,7 +1494,7 @@ if (the_document_body_section.length > 0) {
foreach (i; previous_length .. the_document_body_section.length) {
if (the_document_body_section[i].metainfo.is_a == "verse") {
if ((the_document_body_section[i].text).match(
- rgx.inline_notes_delimiter_al_regular_number_note
+ rgx.inline_notes_al_regular_number_note
)) {
note_section.gather_notes_for_endnote_section(
the_document_body_section,
@@ -1507,7 +1508,7 @@ if (the_document_body_section.length > 0) {
/+ scan object for endnotes +/
previous_length = the_document_body_section.length.to!int;
if ((the_document_body_section[$-1].text).match(
- rgx.inline_notes_delimiter_al_regular_number_note
+ rgx.inline_notes_al_regular_number_note
)) {
previous_count=(the_document_body_section.length -1).to!int;
note_section.gather_notes_for_endnote_section(
@@ -2269,20 +2270,20 @@ auto get_decendants(S)(S document_sections) {
foreach (_lg, ref obj; document_sections) {
if (obj.metainfo.is_a == "heading") {
foreach (_dts_lv, dom_tag_status; obj.metainfo.dom_structure_markedup_tags_status) {
- switch (dom_tag_status) {
- case DomTags.none: break;
- case DomTags.open:
+ switch (dom_tag_status) with (DomTags) {
+ case none: break;
+ case open:
_ocn_open_key[_dts_lv] = (obj.metainfo.ocn).to!string;
_heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn;
break;
- case DomTags.close:
+ case close:
if (_ocn_open_key[_dts_lv].empty) {
_ocn_open_key[_dts_lv] = "0";
}
_heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn - 1;
_ocn_open_key[_dts_lv] = (0).to!string;
break;
- case DomTags.close_and_open:
+ case close_and_open:
if (_ocn_open_key[_dts_lv].empty) {
_ocn_open_key[_dts_lv] = "0";
}
@@ -2290,7 +2291,7 @@ auto get_decendants(S)(S document_sections) {
_ocn_open_key[_dts_lv] = (obj.metainfo.ocn).to!string;
_heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn;
break;
- case DomTags.open_still: break;
+ case open_still: break;
default: break;
}
}
@@ -2338,9 +2339,9 @@ auto _image_dimensions(O,M)(O obj, M manifest_matter) {
int max_width = 640;
foreach (m; obj.text.matchAll(rgx.inline_image_without_dimensions)) {
debug(images) {
- writeln(manifest_matter.src.image_dir_path ~ "/" ~ m.captures["img"]);
+ writeln(manifest_matter.src.image_dir_path ~ "/" ~ m["img"]);
}
- read_image_info(manifest_matter.src.image_dir_path ~ "/" ~ m.captures["img"], w, h, chans);
+ read_image_info(manifest_matter.src.image_dir_path ~ "/" ~ m["img"], w, h, chans);
// calculate, decide max width and proportionally reduce to keep w & h within it
debug(images) {
writeln("width: ", w, ", height: ", h);
@@ -2939,40 +2940,40 @@ auto document_the = [
#+name: abs_post
#+BEGIN_SRC d
string[][string] document_section_keys_sequenced = [
- "seg": ["head", "toc", "body",],
"scroll": ["head", "toc", "body",],
+ "seg": ["head", "toc", "body",],
"sql": ["head", "body",]
];
if (document_the["endnotes"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "endnotes";
document_section_keys_sequenced["scroll"] ~= "endnotes";
+ document_section_keys_sequenced["seg"] ~= "endnotes";
}
if (document_the["glossary"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "glossary";
document_section_keys_sequenced["scroll"] ~= "glossary";
+ document_section_keys_sequenced["seg"] ~= "glossary";
document_section_keys_sequenced["sql"] ~= "glossary";
}
if (document_the["bibliography"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "bibliography";
document_section_keys_sequenced["scroll"] ~= "bibliography";
+ document_section_keys_sequenced["seg"] ~= "bibliography";
document_section_keys_sequenced["sql"] ~= "bibliography";
}
if (document_the["bookindex"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "bookindex";
document_section_keys_sequenced["scroll"] ~= "bookindex";
+ document_section_keys_sequenced["seg"] ~= "bookindex";
document_section_keys_sequenced["sql"] ~= "bookindex";
}
if (document_the["blurb"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "blurb";
document_section_keys_sequenced["scroll"] ~= "blurb";
+ document_section_keys_sequenced["seg"] ~= "blurb";
document_section_keys_sequenced["sql"] ~= "blurb";
}
if ((opt_action.html)
|| (opt_action.html_scroll)
|| (opt_action.html_seg)
|| (opt_action.epub)) {
- document_section_keys_sequenced["seg"] ~= "tail";
document_section_keys_sequenced["scroll"] ~= "tail";
+ document_section_keys_sequenced["seg"] ~= "tail";
}
auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced);
#+END_SRC
@@ -3230,8 +3231,8 @@ void _start_block_(L,T,N)(
#+BEGIN_SRC d
if (auto m = line.matchFirst(rgx.block_curly_code_open)) {
/+ curly code open +/
- code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
- code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering))
+ code_block_syntax = (m[1]) ? m[1].to!string : "";
+ code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
? true : false;
debug(codecurly) { // code (curly) open
writefln(
@@ -3326,7 +3327,7 @@ void _start_block_(L,T,N)(
line
);
}
- an_object["table_head"] = m.captures[1].to!string;
+ an_object["table_head"] = m[1].to!string;
an_object["block_type"] = "curly";
obj_type_status["blocks"] = TriState.on;
obj_type_status["table"] = TriState.on;
@@ -3339,7 +3340,7 @@ void _start_block_(L,T,N)(
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) {
/+ table: special table block markup syntax! +/
- an_object["table_head"] = m.captures[1].to!string;
+ an_object["table_head"] = m[1].to!string;
an_object["block_type"] = "special";
obj_type_status["blocks"] = TriState.on;
obj_type_status["table"] = TriState.on;
@@ -3353,8 +3354,8 @@ void _start_block_(L,T,N)(
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_tic_code_open)) {
/+ tic code open +/
- code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
- code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering))
+ code_block_syntax = (m[1]) ? m[1].to!string : "";
+ code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
? true : false;
debug(codetic) { // code (tic) open
writefln(
@@ -3449,7 +3450,7 @@ void _start_block_(L,T,N)(
line
);
}
- an_object["table_head"] = m.captures[1].to!string;
+ an_object["table_head"] = m[1].to!string;
an_object["block_type"] = "tic";
obj_type_status["blocks"] = TriState.on;
obj_type_status["table"] = TriState.on;
@@ -3919,7 +3920,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)(
}
an_object["is"] = "verse";
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -3982,7 +3983,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)(
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -4028,7 +4029,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)(
processing.remove("verse");
an_object["is"] = "verse";
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -4091,7 +4092,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)(
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -4241,7 +4242,7 @@ void _table_closed_make_special_notation_table_(N,CMM)(
);
an_object["is"] = "table";
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
@@ -4318,7 +4319,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)(
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -4373,7 +4374,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)(
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -4428,7 +4429,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)(
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
// anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -4525,7 +4526,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)(
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_code = comp_obj_code.init;
@@ -4580,7 +4581,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)(
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
@@ -4631,7 +4632,7 @@ auto _book_index_(L,I,O,T,B)(
debug(bookindexmatch) {
writefln(
"* [bookindex] %s\n",
- m.captures[1].to!string,
+ m[1].to!string,
);
}
an_object["bookindex_nugget"] = m.captures[1].to!string;
@@ -5033,8 +5034,8 @@ void _para_match_(L,O,K,I,B,T,C)(
debug(paraindent) {
writeln(line);
}
- indent["hang_position"] = (m.captures[1]).to!int;
- indent["base_position"] = 0;
+ indent["hang_position"] = (m[1]).to!int;
+ indent["base_position"] = (m[1]).to!int;
} else if (line.matchFirst(rgx.para_bullet)) {
debug(parabullet) {
writeln(line);
@@ -5045,16 +5046,16 @@ void _para_match_(L,O,K,I,B,T,C)(
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : (m.captures[2]).to!int,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[2]).to!int,
];
} else if (auto m = line.matchFirst(rgx.para_bullet_indent)) {
debug(parabulletindent) {
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : 0,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[1]).to!int,
];
bullet = true;
}
@@ -5338,28 +5339,28 @@ pure struct OCNemitter {
ocn_object_number = ocn_bkidx = 0;
object_identifier = "";
ocn_is_off = false;
- switch(ocn_status_flag) {
- case OCNstatus.reset:
+ switch(ocn_status_flag) with (OCNstatus) {
+ case reset:
ocn_digit = ocn_on_ = 1;
object_identifier = "1";
ocn_is_off = false;
ocn_off_ = ocn_bkidx_ = 0;
break;
- case OCNstatus.on:
+ case on:
ocn_digit = ocn_object_number = ++ocn_on_;
object_identifier = ocn_digit.to!string;
ocn_is_off = false;
break;
- case OCNstatus.off:
+ case off:
ocn_digit = 0;
ocn_off_ = ++ocn_off_;
object_identifier = "a" ~ ocn_off_.to!string;
ocn_is_off = true;
break;
- case OCNstatus.bkidx:
+ case bkidx:
ocn_bkidx = ++ocn_bkidx_;
break;
- case OCNstatus.closing:
+ case closing:
break;
default:
ocn_digit = 0;
@@ -5560,7 +5561,7 @@ static struct ObjInlineMarkupMunge {
debug(footnotesdone) {
foreach(m; matchAll(obj_txt_out,
(mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) {
- writeln(m.captures[1]);
+ writeln(m[1]);
writeln(m.hit);
}
}
@@ -5827,7 +5828,7 @@ static struct ObjInlineMarkup {
O obj_,
K obj_key_,
CMM conf_make_meta,
- bool _new_doc
+ Flag!"_new_doc" _new_doc
)
in {
debug(asserts) {
@@ -5993,26 +5994,6 @@ static struct ObjInlineMarkup {
comp_obj_toc.text = toc_txt_.to!string.strip;
comp_obj_toc.has.inline_links = true;
the_table_of_contents_section ~= comp_obj_toc;
- } else {
- indent=[
- "hang_position" : 0,
- "base_position" : 0,
- ];
- comp_obj_toc = comp_obj_toc.init;
- comp_obj_toc.metainfo.is_of_part = "frontmatter";
- comp_obj_toc.metainfo.is_of_section = "toc";
- comp_obj_toc.metainfo.is_of_type = "para";
- comp_obj_toc.metainfo.is_a = "toc";
- comp_obj_toc.metainfo.ocn = 0;
- comp_obj_toc.metainfo.identifier = "";
- comp_obj_toc.metainfo.object_number_off = true;
- comp_obj_toc.metainfo.object_number_type = 0;
- comp_obj_toc.attrib.indent_hang = indent["hang_position"];
- comp_obj_toc.attrib.indent_base = indent["base_position"];
- comp_obj_toc.attrib.bullet = false;
- comp_obj_toc.text = "Table of Contents";
- comp_obj_toc.has.inline_links = true;
- the_table_of_contents_section ~= comp_obj_toc;
}
comp_obj_toc = comp_obj_toc.init;
comp_obj_toc.metainfo.is_of_part = "frontmatter";
@@ -6065,11 +6046,12 @@ private:
static int[] heading_num = [ 0, 0, 0, 0 ];
static string heading_number_auto_composite = "";
static string heading_number_auto_composite_segname = "";
+ static bool[] auto_heading_numbering = [ true, true, true, true];
static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)(
- M munge_,
- O obj_,
- CMM conf_make_meta,
- bool _new_doc
+ M munge_,
+ O obj_,
+ CMM conf_make_meta,
+ bool _new_doc,
) {
debug(asserts) {
static assert(is(typeof(munge_) == string));
@@ -6078,6 +6060,7 @@ private:
if (_new_doc) {
heading_num = [ 0, 0, 0, 0 ];
heading_number_auto_composite = "";
+ auto_heading_numbering = [ true, true, true, true];
}
if (conf_make_meta.make.auto_num_top_lv) {
if (obj_["lev_markup_number"].to!int == 0) {
@@ -6100,7 +6083,11 @@ private:
conf_make_meta.make.auto_num_top_lv
== obj_["lev_markup_number"].to!uint
) {
- heading_num[0] ++;
+ auto_heading_numbering[0] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv1)) ? false : true;
+ if (auto_heading_numbering[0]) {
+ heading_num[0] ++;
+ }
heading_num[1] = 0;
heading_num[2] = 0;
heading_num[3] = 0;
@@ -6108,55 +6095,86 @@ private:
conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 1)
) {
- heading_num[1] ++;
+ auto_heading_numbering[1] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv2)) ? false : true;
+ if (auto_heading_numbering[0]
+ && auto_heading_numbering[1]) {
+ heading_num[1] ++;
+ }
heading_num[2] = 0;
heading_num[3] = 0;
} else if (
conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 2)
) {
- heading_num[2] ++;
+ auto_heading_numbering[2] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv3)) ? false : true;
+ if (auto_heading_numbering[0]
+ && auto_heading_numbering[1]
+ && auto_heading_numbering[2]) {
+ heading_num[2] ++;
+ }
heading_num[3] = 0;
} else if (
conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 3)
) {
- heading_num[3] ++;
- }
- if (heading_num[3] > 0) {
- heading_number_auto_composite
- = (conf_make_meta.make.auto_num_depth.to!uint == 3)
- ? ( heading_num[0].to!string ~ "."
- ~ heading_num[1].to!string ~ "."
- ~ heading_num[2].to!string ~ "."
- ~ heading_num[3].to!string
- )
- : "";
- } else if (heading_num[2] > 0) {
- heading_number_auto_composite
- = ((conf_make_meta.make.auto_num_depth.to!uint >= 2)
- && (conf_make_meta.make.auto_num_depth.to!uint <= 3))
- ? ( heading_num[0].to!string ~ "."
- ~ heading_num[1].to!string ~ "."
- ~ heading_num[2].to!string
- )
- : "";
- } else if (heading_num[1] > 0) {
- heading_number_auto_composite
- = ((conf_make_meta.make.auto_num_depth.to!uint >= 1)
- && (conf_make_meta.make.auto_num_depth.to!uint <= 3))
- ? ( heading_num[0].to!string ~ "."
- ~ heading_num[1].to!string
- )
- : "";
- } else if (heading_num[0] > 0) {
- heading_number_auto_composite
- = ((conf_make_meta.make.auto_num_depth.to!uint >= 0)
- && (conf_make_meta.make.auto_num_depth.to!uint <= 3))
- ? (heading_num[0].to!string)
- : "";
- } else {
- heading_number_auto_composite = "";
+ auto_heading_numbering[3] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv4)) ? false : true;
+ if (auto_heading_numbering[0]
+ && auto_heading_numbering[1]
+ && auto_heading_numbering[2]
+ && auto_heading_numbering[3]) {
+ heading_num[3] ++;
+ }
+ }
+ if (auto_heading_numbering[0]) {
+ if (heading_num[3] > 0) {
+ heading_number_auto_composite
+ = (conf_make_meta.make.auto_num_depth.to!uint == 3
+ && auto_heading_numbering[3])
+ ? (format(q"┋%s.%s.%s.%s┋",
+ heading_num[0].to!string,
+ heading_num[1].to!string,
+ heading_num[2].to!string,
+ heading_num[3].to!string
+ ))
+ : "";
+ } else if (heading_num[2] > 0) {
+ heading_number_auto_composite
+ = ((conf_make_meta.make.auto_num_depth.to!uint >= 2)
+ && (conf_make_meta.make.auto_num_depth.to!uint <= 3)
+ && auto_heading_numbering[2])
+ ? (format(q"┋%s.%s.%s┋",
+ heading_num[0].to!string,
+ heading_num[1].to!string,
+ heading_num[2].to!string
+ ))
+ : "";
+ } else if (heading_num[1] > 0) {
+ heading_number_auto_composite
+ = ((conf_make_meta.make.auto_num_depth.to!uint >= 1)
+ && (conf_make_meta.make.auto_num_depth.to!uint <= 3)
+ && auto_heading_numbering[1])
+ ? (format(q"┋%s.%s┋",
+ heading_num[0].to!string,
+ heading_num[1].to!string
+ ))
+ : "";
+ } else if (heading_num[0] > 0
+ && munge_.match(rgx.auto_heading_numbering_lv1)
+ ) {
+ heading_number_auto_composite
+ = ((conf_make_meta.make.auto_num_depth.to!uint >= 0)
+ && (conf_make_meta.make.auto_num_depth.to!uint <= 3)
+ && auto_heading_numbering[0])
+ ? (format(q"┋%s┋",
+ heading_num[0].to!string
+ ))
+ : "";
+ } else {
+ heading_number_auto_composite = "";
+ }
}
heading_number_auto_composite_segname =
(heading_number_auto_composite.empty)
@@ -6388,16 +6406,16 @@ struct ObjAttributes {
~ " \"indent_base\": 0,";
} else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) {
_obj_attributes =" \"bullet\": \"true\","
- ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ ","
- ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ",";
+ ~ " \"indent_hang\": " ~ m[1].to!string ~ ","
+ ~ " \"indent_base\": " ~ m[1].to!string ~ ",";
} else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) {
_obj_attributes =" \"bullet\": \"false\","
- ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ ","
- ~ " \"indent_base\": " ~ m.captures[2].to!string ~ ",";
+ ~ " \"indent_hang\": " ~ m[1].to!string ~ ","
+ ~ " \"indent_base\": " ~ m[2].to!string ~ ",";
} else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) {
_obj_attributes =" \"bullet\": \"false\","
- ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ ","
- ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ",";
+ ~ " \"indent_hang\": " ~ m[1].to!string ~ ","
+ ~ " \"indent_base\": " ~ m[1].to!string ~ ",";
} else {
_obj_attributes =" \"bullet\": \"false\","
~ " \"indent_hang\": 0,"
@@ -6987,7 +7005,7 @@ struct NotesSection {
assert(cntr >= previous_count);
assert(
(contents_am[cntr].text).match(
- rgx.inline_notes_delimiter_al_regular_number_note)
+ rgx.inline_notes_al_regular_number_note)
);
}
body {
@@ -6997,31 +7015,31 @@ struct NotesSection {
static auto munge = ObjInlineMarkupMunge();
foreach(m;
(contents_am[cntr].text).matchAll(
- rgx.inline_notes_delimiter_al_regular_number_note)
+ rgx.inline_notes_al_regular_number_note)
) {
debug(endnotes_build) {
writeln(
- "{^", mkup.ff_o, m.captures[1], ".", mkup.ff_c, "^}"
+ "{^", mkup.ff_o, m[1], ".", mkup.ff_c, "^}"
~ mkup.mark_internal_site_lnk,
tag_in_seg["seg_lv4"],
- ".fnSuffix#noteref_\n ", m.captures[1], " ",
- m.captures[2]); // sometimes need segment name (segmented html & epub)
+ ".fnSuffix#noteref_\n ", m[1], " ",
+ m[2]); // sometimes need segment name (segmented html & epub)
}
// you need anchor for segments at this point ->
- object_notes["anchor"] ~= "note_" ~ m.captures[1] ~ "』";
+ object_notes["anchor"] ~= "note_" ~ m[1] ~ "』";
object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty)
? (links_and_images(
- "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_"
- ~ m.captures[1]) ~ " "
- ~ m.captures[2] ~ "』"
+ "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_"
+ ~ m[1]) ~ " "
+ ~ m[2] ~ "』"
)
: (links_and_images(
- "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}"
+ "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}"
~ mkup.mark_internal_site_lnk
~ tag_in_seg["seg_lv4"]
~ ".fnSuffix#noteref_"
- ~ m.captures[1]) ~ " "
- ~ m.captures[2] ~ "』"
+ ~ m[1]) ~ " "
+ ~ m[2] ~ "』"
);
}
return object_notes;
@@ -7145,7 +7163,7 @@ struct NotesSection {
comp_obj_endnote_.attrib.bullet = false;
foreach (i, endnote; endnotes_["notes"]) {
auto m = endnote.matchFirst(rgx.note_ref);
- string notenumber = m.captures[1].to!string;
+ string notenumber = m[1].to!string;
string anchor_tag = "note_" ~ notenumber;
comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ];
comp_obj_endnote_.has.inline_links = true;
@@ -7824,12 +7842,12 @@ pure void assertions_flag_types_block_status_none_or_closed(T)(T obj_type_status
template docSectKeysSeq() {
auto docSectKeysSeq(string[][string] document_section_keys_sequenced) {
struct doc_sect_keys_seq {
- auto seg() {
- return document_section_keys_sequenced["seg"];
- }
auto scroll() {
return document_section_keys_sequenced["scroll"];
}
+ auto seg() {
+ return document_section_keys_sequenced["seg"];
+ }
auto sql() {
return document_section_keys_sequenced["sql"];
}
diff --git a/org/meta_debugs.org b/org/meta_debugs.org
index 8412048..735085f 100644
--- a/org/meta_debugs.org
+++ b/org/meta_debugs.org
@@ -289,17 +289,17 @@ debug(toc_nav_dom) {
foreach (obj; contents[sect]) {
if (obj.metainfo.is_a == "heading") {
foreach_reverse (k; 0 .. 7) {
- switch (obj.dom_structure_markedup_tags_status[k]) {
- case DomTags.close :
+ switch (obj.dom_structure_markedup_tags_status[k]) with (DomTags) {
+ case close :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
break;
- case DomTags.close_and_open :
+ case close_and_open :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
break;
- case DomTags.open :
+ case open :
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
@@ -316,17 +316,17 @@ debug(toc_nav_dom) {
foreach (obj; contents[sect]) {
if (obj.metainfo.is_a == "heading") {
foreach_reverse (k; 0 .. 7) {
- switch (obj.dom_structure_collapsed_tags_status[k]) {
- case DomTags.close :
+ switch (obj.dom_structure_collapsed_tags_status[k]) with (DomTags) {
+ case close :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
break;
- case DomTags.close_and_open :
+ case close_and_open :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
break;
- case DomTags.open :
+ case open :
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
diff --git a/org/output_sqlite.org b/org/output_sqlite.org
index 52839d3..5a1b090 100644
--- a/org/output_sqlite.org
+++ b/org/output_sqlite.org
@@ -644,17 +644,17 @@ auto inline_notes_scroll(M,O)(
if (obj.has.inline_notes_reg) {
// _txt = font_face(_txt);
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
}
debug(markup_endnotes) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
debug(markup) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
@@ -674,7 +674,7 @@ auto inline_notes_seg(M,O)(
string[] _endnotes;
if (obj.has.inline_notes_reg) {
/+ need markup for text, and separated footnote +/
- foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) {
_endnotes ~= format(
"%s%s%s%s\n %s%s%s%s%s\n %s\n%s",
"<p class=\"endnote\">",
@@ -691,10 +691,10 @@ auto inline_notes_seg(M,O)(
);
}
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
- } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
debug(markup) {
writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
diff --git a/org/output_xmls.org b/org/output_xmls.org
index 1e4f91a..4a40323 100644
--- a/org/output_xmls.org
+++ b/org/output_xmls.org
@@ -103,7 +103,7 @@ string special_characters_text(string _txt){
}
#+END_SRC
-**** special characters text
+**** special characters
#+name: xhtml_format_objects
#+BEGIN_SRC d
@@ -413,7 +413,7 @@ auto epub3_seg_head(M)(
#+BEGIN_SRC d
auto tail() {
string o;
- o = format(q"┋ </div>
+ o = format(q"┋
<a name="bottom" id="bottom"></a>
<a name="end" id="end"></a>
</body>
@@ -443,8 +443,8 @@ auto inline_images(O,M)(
_img_pth = "../../../image/";
}
if (_txt.match(rgx.inline_image)) {
- _txt = _txt.replaceAll(
- rgx.inline_image,
+ _txt = _txt
+ .replaceAll(rgx.inline_image,
("$1<img src=\""
~ _img_pth
~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6"))
@@ -563,17 +563,17 @@ auto inline_notes_scroll(O,M)(
if (obj.has.inline_notes_reg) {
_txt = font_face(_txt);
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
}
debug(markup_endnotes) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
debug(markup) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
@@ -594,7 +594,7 @@ auto inline_notes_seg(O,M)(
if (obj.has.inline_notes_reg) {
_txt = font_face(_txt);
/+ need markup for text, and separated footnote +/
- foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) {
_endnotes ~= format(
"%s%s%s%s\n %s%s%s%s%s\n %s\n%s",
"<p class=\"endnote\">",
@@ -611,10 +611,10 @@ auto inline_notes_seg(O,M)(
);
}
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
- } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
debug(markup) {
writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
@@ -2426,7 +2426,11 @@ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) {
}
}
}
- toc ~= format(q"┋ </navMap>
+ toc ~= format(q"┋
+ </navPoint>
+ </navPoint>
+ </navPoint>
+ </navMap>
</ncx>┋");
return toc;
}
@@ -2822,7 +2826,7 @@ void epub3_write_output_files(W,I)(
? zip_data.write(contents.dup)
: zip_data.write(contents.dup
.replaceAll(rgx.spaces_line_start, "")
- .replaceAll(rgx.newline, "")
+ .replaceAll(rgx.newline, " ")
.strip
);
zip_arc_member_file.expandedData = zip_data.toBytes();
diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d
index bac1f44..b9d34e7 100755
--- a/src/doc_reform/doc_reform.d
+++ b/src/doc_reform/doc_reform.d
@@ -2,7 +2,8 @@
module doc_reform.sisu_document_parser;
import
doc_reform.conf.compile_time_info,
- doc_reform.meta.metadoc;
+ doc_reform.meta.metadoc,
+ doc_reform.meta.metadochead;
import
std.datetime,
std.getopt,
diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d
index fbde36e..1bfc859 100644
--- a/src/doc_reform/meta/defaults.d
+++ b/src/doc_reform/meta/defaults.d
@@ -127,6 +127,7 @@ template InternalMarkup() {
static struct InlineMarkup {
auto en_a_o = "【"; auto en_a_c = "】";
auto en_b_o = "〖"; auto en_b_c = "〗";
+ auto quote_o = "“"; auto quote_c = "”";
auto ff_o = "┨"; auto ff_c = "┣"; // fontface
auto lnk_o = "┥"; auto lnk_c = "┝";
auto url_o = "┤"; auto url_c = "├";
diff --git a/src/doc_reform/meta/doc_debugs.d b/src/doc_reform/meta/doc_debugs.d
index 8765c06..5ca5c39 100644
--- a/src/doc_reform/meta/doc_debugs.d
+++ b/src/doc_reform/meta/doc_debugs.d
@@ -104,17 +104,17 @@ template DocReformDebugs() {
foreach (obj; contents[sect]) {
if (obj.metainfo.is_a == "heading") {
foreach_reverse (k; 0 .. 7) {
- switch (obj.dom_structure_markedup_tags_status[k]) {
- case DomTags.close :
+ switch (obj.dom_structure_markedup_tags_status[k]) with (DomTags) {
+ case close :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
break;
- case DomTags.close_and_open :
+ case close_and_open :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
break;
- case DomTags.open :
+ case open :
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
@@ -131,17 +131,17 @@ template DocReformDebugs() {
foreach (obj; contents[sect]) {
if (obj.metainfo.is_a == "heading") {
foreach_reverse (k; 0 .. 7) {
- switch (obj.dom_structure_collapsed_tags_status[k]) {
- case DomTags.close :
+ switch (obj.dom_structure_collapsed_tags_status[k]) with (DomTags) {
+ case close :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
break;
- case DomTags.close_and_open :
+ case close_and_open :
writeln(markup.indent_by_spaces_provided(k), "</", k, ">");
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
break;
- case DomTags.open :
+ case open :
writeln(markup.indent_by_spaces_provided(k),
"<", k, ">", obj.text,
" file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn);
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index 38370db..f089a15 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -236,6 +236,7 @@ template DocReformDocAbstraction() {
static auto inline_markup_faces(L)(L line) {
static auto rgx = Rgx();
static auto mkup = InlineMarkup();
+ line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes);
line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono);
line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m[2] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite);
foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) {
@@ -472,10 +473,6 @@ template DocReformDocAbstraction() {
line,
);
}
- line = line.replaceAll(rgx.true_dollar, "$$$$");
- /+ dollar represented as $$ needed to stop submatching on $
- (substitutions using ${identifiers} must take into account (i.e. happen earlier))
- +/
debug(source) {
writeln(line);
}
@@ -645,8 +642,8 @@ template DocReformDocAbstraction() {
debug(paraindent) {
writeln(line);
}
- indent["hang_position"] = (m.captures[1]).to!int;
- indent["base_position"] = 0;
+ indent["hang_position"] = (m[1]).to!int;
+ indent["base_position"] = (m[1]).to!int;
} else if (line.matchFirst(rgx.para_bullet)) {
debug(parabullet) {
writeln(line);
@@ -657,16 +654,16 @@ template DocReformDocAbstraction() {
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : (m.captures[2]).to!int,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[2]).to!int,
];
} else if (auto m = line.matchFirst(rgx.para_bullet_indent)) {
debug(parabulletindent) {
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : 0,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[1]).to!int,
];
bullet = true;
}
@@ -955,7 +952,7 @@ template DocReformDocAbstraction() {
an_object["is"] = "heading";
an_object_key="body_nugget";
auto substantive_object_and_anchor_tags_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, _new_doc);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, ((_new_doc) ? Yes._new_doc : No._new_doc));
an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content];
anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag];
if (_new_doc) {
@@ -1071,6 +1068,10 @@ template DocReformDocAbstraction() {
} else if ((obj_type_status["para"] == State.on)
&& (line_occur["para"] > State.off)) {
/+ paragraph object (current line empty) +/
+ /+ repeated character paragraph separator +/
+ if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) {
+ obj_type_status["ocn_status"] = OCNstatus.off;
+ }
obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]);
an_object["bookindex_nugget"]
= ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
@@ -1089,7 +1090,7 @@ template DocReformDocAbstraction() {
an_object["is"],
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_para = comp_obj_para.init;
@@ -1149,7 +1150,7 @@ template DocReformDocAbstraction() {
foreach (i; previous_length .. the_document_body_section.length) {
if (the_document_body_section[i].metainfo.is_a == "verse") {
if ((the_document_body_section[i].text).match(
- rgx.inline_notes_delimiter_al_regular_number_note
+ rgx.inline_notes_al_regular_number_note
)) {
note_section.gather_notes_for_endnote_section(
the_document_body_section,
@@ -1163,7 +1164,7 @@ template DocReformDocAbstraction() {
/+ scan object for endnotes +/
previous_length = the_document_body_section.length.to!int;
if ((the_document_body_section[$-1].text).match(
- rgx.inline_notes_delimiter_al_regular_number_note
+ rgx.inline_notes_al_regular_number_note
)) {
previous_count=(the_document_body_section.length -1).to!int;
note_section.gather_notes_for_endnote_section(
@@ -1714,20 +1715,20 @@ template DocReformDocAbstraction() {
foreach (_lg, ref obj; document_sections) {
if (obj.metainfo.is_a == "heading") {
foreach (_dts_lv, dom_tag_status; obj.metainfo.dom_structure_markedup_tags_status) {
- switch (dom_tag_status) {
- case DomTags.none: break;
- case DomTags.open:
+ switch (dom_tag_status) with (DomTags) {
+ case none: break;
+ case open:
_ocn_open_key[_dts_lv] = (obj.metainfo.ocn).to!string;
_heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn;
break;
- case DomTags.close:
+ case close:
if (_ocn_open_key[_dts_lv].empty) {
_ocn_open_key[_dts_lv] = "0";
}
_heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn - 1;
_ocn_open_key[_dts_lv] = (0).to!string;
break;
- case DomTags.close_and_open:
+ case close_and_open:
if (_ocn_open_key[_dts_lv].empty) {
_ocn_open_key[_dts_lv] = "0";
}
@@ -1735,7 +1736,7 @@ template DocReformDocAbstraction() {
_ocn_open_key[_dts_lv] = (obj.metainfo.ocn).to!string;
_heading_ocn_decendants[_ocn_open_key[_dts_lv]] = obj.metainfo.ocn;
break;
- case DomTags.open_still: break;
+ case open_still: break;
default: break;
}
}
@@ -1771,9 +1772,9 @@ template DocReformDocAbstraction() {
int max_width = 640;
foreach (m; obj.text.matchAll(rgx.inline_image_without_dimensions)) {
debug(images) {
- writeln(manifest_matter.src.image_dir_path ~ "/" ~ m.captures["img"]);
+ writeln(manifest_matter.src.image_dir_path ~ "/" ~ m["img"]);
}
- read_image_info(manifest_matter.src.image_dir_path ~ "/" ~ m.captures["img"], w, h, chans);
+ read_image_info(manifest_matter.src.image_dir_path ~ "/" ~ m["img"], w, h, chans);
// calculate, decide max width and proportionally reduce to keep w & h within it
debug(images) {
writeln("width: ", w, ", height: ", h);
@@ -2279,40 +2280,40 @@ template DocReformDocAbstraction() {
"tail": the_dom_tail_section,
];
string[][string] document_section_keys_sequenced = [
- "seg": ["head", "toc", "body",],
"scroll": ["head", "toc", "body",],
+ "seg": ["head", "toc", "body",],
"sql": ["head", "body",]
];
if (document_the["endnotes"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "endnotes";
document_section_keys_sequenced["scroll"] ~= "endnotes";
+ document_section_keys_sequenced["seg"] ~= "endnotes";
}
if (document_the["glossary"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "glossary";
document_section_keys_sequenced["scroll"] ~= "glossary";
+ document_section_keys_sequenced["seg"] ~= "glossary";
document_section_keys_sequenced["sql"] ~= "glossary";
}
if (document_the["bibliography"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "bibliography";
document_section_keys_sequenced["scroll"] ~= "bibliography";
+ document_section_keys_sequenced["seg"] ~= "bibliography";
document_section_keys_sequenced["sql"] ~= "bibliography";
}
if (document_the["bookindex"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "bookindex";
document_section_keys_sequenced["scroll"] ~= "bookindex";
+ document_section_keys_sequenced["seg"] ~= "bookindex";
document_section_keys_sequenced["sql"] ~= "bookindex";
}
if (document_the["blurb"].length > 1) {
- document_section_keys_sequenced["seg"] ~= "blurb";
document_section_keys_sequenced["scroll"] ~= "blurb";
+ document_section_keys_sequenced["seg"] ~= "blurb";
document_section_keys_sequenced["sql"] ~= "blurb";
}
if ((opt_action.html)
|| (opt_action.html_scroll)
|| (opt_action.html_seg)
|| (opt_action.epub)) {
- document_section_keys_sequenced["seg"] ~= "tail";
document_section_keys_sequenced["scroll"] ~= "tail";
+ document_section_keys_sequenced["seg"] ~= "tail";
}
auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced);
auto segnames_lv4 = segnames["html"].dup;
@@ -2500,8 +2501,8 @@ template DocReformDocAbstraction() {
bool code_block_numbered = false;
if (auto m = line.matchFirst(rgx.block_curly_code_open)) {
/+ curly code open +/
- code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
- code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering))
+ code_block_syntax = (m[1]) ? m[1].to!string : "";
+ code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
? true : false;
debug(codecurly) { // code (curly) open
writefln(
@@ -2566,22 +2567,22 @@ template DocReformDocAbstraction() {
line
);
}
- an_object["table_head"] = m.captures[1].to!string;
+ an_object["table_head"] = m[1].to!string;
an_object["block_type"] = "curly";
obj_type_status["blocks"] = TriState.on;
obj_type_status["table"] = TriState.on;
obj_type_status["curly_table"] = TriState.on;
} else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) {
/+ table: special table block markup syntax! +/
- an_object["table_head"] = m.captures[1].to!string;
+ an_object["table_head"] = m[1].to!string;
an_object["block_type"] = "special";
obj_type_status["blocks"] = TriState.on;
obj_type_status["table"] = TriState.on;
obj_type_status["curly_table_special_markup"] = TriState.on;
} else if (auto m = line.matchFirst(rgx.block_tic_code_open)) {
/+ tic code open +/
- code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : "";
- code_block_numbered = (m.captures[2].matchFirst(rgx.code_numbering))
+ code_block_syntax = (m[1]) ? m[1].to!string : "";
+ code_block_numbered = (m[2].matchFirst(rgx.code_numbering))
? true : false;
debug(codetic) { // code (tic) open
writefln(
@@ -2646,7 +2647,7 @@ template DocReformDocAbstraction() {
line
);
}
- an_object["table_head"] = m.captures[1].to!string;
+ an_object["table_head"] = m[1].to!string;
an_object["block_type"] = "tic";
obj_type_status["blocks"] = TriState.on;
obj_type_status["table"] = TriState.on;
@@ -2830,7 +2831,7 @@ template DocReformDocAbstraction() {
}
an_object["is"] = "verse";
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -2893,7 +2894,7 @@ template DocReformDocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -2939,7 +2940,7 @@ template DocReformDocAbstraction() {
processing.remove("verse");
an_object["is"] = "verse";
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -3002,7 +3003,7 @@ template DocReformDocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -3315,7 +3316,7 @@ template DocReformDocAbstraction() {
);
an_object["is"] = "table";
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
comp_obj_block.metainfo.identifier = obj_cite_digits.identifier;
@@ -3378,7 +3379,7 @@ template DocReformDocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -3427,7 +3428,7 @@ template DocReformDocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -3476,7 +3477,7 @@ template DocReformDocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
// anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
@@ -3561,7 +3562,7 @@ template DocReformDocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_code = comp_obj_code.init;
@@ -3610,7 +3611,7 @@ template DocReformDocAbstraction() {
an_object["is"]
);
auto substantive_obj_misc_tuple
- = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
+ = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.ocn = obj_cite_digits.object_number;
@@ -3649,7 +3650,7 @@ template DocReformDocAbstraction() {
debug(bookindexmatch) {
writefln(
"* [bookindex] %s\n",
- m.captures[1].to!string,
+ m[1].to!string,
);
}
an_object["bookindex_nugget"] = m.captures[1].to!string;
@@ -4026,8 +4027,8 @@ template DocReformDocAbstraction() {
debug(paraindent) {
writeln(line);
}
- indent["hang_position"] = (m.captures[1]).to!int;
- indent["base_position"] = 0;
+ indent["hang_position"] = (m[1]).to!int;
+ indent["base_position"] = (m[1]).to!int;
} else if (line.matchFirst(rgx.para_bullet)) {
debug(parabullet) {
writeln(line);
@@ -4038,16 +4039,16 @@ template DocReformDocAbstraction() {
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : (m.captures[2]).to!int,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[2]).to!int,
];
} else if (auto m = line.matchFirst(rgx.para_bullet_indent)) {
debug(parabulletindent) {
writeln(line);
}
indent=[
- "hang_position" : (m.captures[1]).to!int,
- "base_position" : 0,
+ "hang_position" : (m[1]).to!int,
+ "base_position" : (m[1]).to!int,
];
bullet = true;
}
@@ -4280,28 +4281,28 @@ template DocReformDocAbstraction() {
ocn_object_number = ocn_bkidx = 0;
object_identifier = "";
ocn_is_off = false;
- switch(ocn_status_flag) {
- case OCNstatus.reset:
+ switch(ocn_status_flag) with (OCNstatus) {
+ case reset:
ocn_digit = ocn_on_ = 1;
object_identifier = "1";
ocn_is_off = false;
ocn_off_ = ocn_bkidx_ = 0;
break;
- case OCNstatus.on:
+ case on:
ocn_digit = ocn_object_number = ++ocn_on_;
object_identifier = ocn_digit.to!string;
ocn_is_off = false;
break;
- case OCNstatus.off:
+ case off:
ocn_digit = 0;
ocn_off_ = ++ocn_off_;
object_identifier = "a" ~ ocn_off_.to!string;
ocn_is_off = true;
break;
- case OCNstatus.bkidx:
+ case bkidx:
ocn_bkidx = ++ocn_bkidx_;
break;
- case OCNstatus.closing:
+ case closing:
break;
default:
ocn_digit = 0;
@@ -4479,7 +4480,7 @@ template DocReformDocAbstraction() {
debug(footnotesdone) {
foreach(m; matchAll(obj_txt_out,
(mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) {
- writeln(m.captures[1]);
+ writeln(m[1]);
writeln(m.hit);
}
}
@@ -4636,7 +4637,7 @@ template DocReformDocAbstraction() {
O obj_,
K obj_key_,
CMM conf_make_meta,
- bool _new_doc
+ Flag!"_new_doc" _new_doc
)
in {
debug(asserts) {
@@ -4796,26 +4797,6 @@ template DocReformDocAbstraction() {
comp_obj_toc.text = toc_txt_.to!string.strip;
comp_obj_toc.has.inline_links = true;
the_table_of_contents_section ~= comp_obj_toc;
- } else {
- indent=[
- "hang_position" : 0,
- "base_position" : 0,
- ];
- comp_obj_toc = comp_obj_toc.init;
- comp_obj_toc.metainfo.is_of_part = "frontmatter";
- comp_obj_toc.metainfo.is_of_section = "toc";
- comp_obj_toc.metainfo.is_of_type = "para";
- comp_obj_toc.metainfo.is_a = "toc";
- comp_obj_toc.metainfo.ocn = 0;
- comp_obj_toc.metainfo.identifier = "";
- comp_obj_toc.metainfo.object_number_off = true;
- comp_obj_toc.metainfo.object_number_type = 0;
- comp_obj_toc.attrib.indent_hang = indent["hang_position"];
- comp_obj_toc.attrib.indent_base = indent["base_position"];
- comp_obj_toc.attrib.bullet = false;
- comp_obj_toc.text = "Table of Contents";
- comp_obj_toc.has.inline_links = true;
- the_table_of_contents_section ~= comp_obj_toc;
}
comp_obj_toc = comp_obj_toc.init;
comp_obj_toc.metainfo.is_of_part = "frontmatter";
@@ -4856,11 +4837,12 @@ template DocReformDocAbstraction() {
static int[] heading_num = [ 0, 0, 0, 0 ];
static string heading_number_auto_composite = "";
static string heading_number_auto_composite_segname = "";
+ static bool[] auto_heading_numbering = [ true, true, true, true];
static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)(
- M munge_,
- O obj_,
- CMM conf_make_meta,
- bool _new_doc
+ M munge_,
+ O obj_,
+ CMM conf_make_meta,
+ bool _new_doc,
) {
debug(asserts) {
static assert(is(typeof(munge_) == string));
@@ -4869,6 +4851,7 @@ template DocReformDocAbstraction() {
if (_new_doc) {
heading_num = [ 0, 0, 0, 0 ];
heading_number_auto_composite = "";
+ auto_heading_numbering = [ true, true, true, true];
}
if (conf_make_meta.make.auto_num_top_lv) {
if (obj_["lev_markup_number"].to!int == 0) {
@@ -4891,7 +4874,11 @@ template DocReformDocAbstraction() {
conf_make_meta.make.auto_num_top_lv
== obj_["lev_markup_number"].to!uint
) {
- heading_num[0] ++;
+ auto_heading_numbering[0] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv1)) ? false : true;
+ if (auto_heading_numbering[0]) {
+ heading_num[0] ++;
+ }
heading_num[1] = 0;
heading_num[2] = 0;
heading_num[3] = 0;
@@ -4899,55 +4886,86 @@ template DocReformDocAbstraction() {
conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 1)
) {
- heading_num[1] ++;
+ auto_heading_numbering[1] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv2)) ? false : true;
+ if (auto_heading_numbering[0]
+ && auto_heading_numbering[1]) {
+ heading_num[1] ++;
+ }
heading_num[2] = 0;
heading_num[3] = 0;
} else if (
conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 2)
) {
- heading_num[2] ++;
+ auto_heading_numbering[2] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv3)) ? false : true;
+ if (auto_heading_numbering[0]
+ && auto_heading_numbering[1]
+ && auto_heading_numbering[2]) {
+ heading_num[2] ++;
+ }
heading_num[3] = 0;
} else if (
conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 3)
) {
- heading_num[3] ++;
- }
- if (heading_num[3] > 0) {
- heading_number_auto_composite
- = (conf_make_meta.make.auto_num_depth.to!uint == 3)
- ? ( heading_num[0].to!string ~ "."
- ~ heading_num[1].to!string ~ "."
- ~ heading_num[2].to!string ~ "."
- ~ heading_num[3].to!string
- )
- : "";
- } else if (heading_num[2] > 0) {
- heading_number_auto_composite
- = ((conf_make_meta.make.auto_num_depth.to!uint >= 2)
- && (conf_make_meta.make.auto_num_depth.to!uint <= 3))
- ? ( heading_num[0].to!string ~ "."
- ~ heading_num[1].to!string ~ "."
- ~ heading_num[2].to!string
- )
- : "";
- } else if (heading_num[1] > 0) {
- heading_number_auto_composite
- = ((conf_make_meta.make.auto_num_depth.to!uint >= 1)
- && (conf_make_meta.make.auto_num_depth.to!uint <= 3))
- ? ( heading_num[0].to!string ~ "."
- ~ heading_num[1].to!string
- )
- : "";
- } else if (heading_num[0] > 0) {
- heading_number_auto_composite
- = ((conf_make_meta.make.auto_num_depth.to!uint >= 0)
- && (conf_make_meta.make.auto_num_depth.to!uint <= 3))
- ? (heading_num[0].to!string)
- : "";
- } else {
- heading_number_auto_composite = "";
+ auto_heading_numbering[3] =
+ (munge_.match(rgx.auto_heading_numbering_off_lv4)) ? false : true;
+ if (auto_heading_numbering[0]
+ && auto_heading_numbering[1]
+ && auto_heading_numbering[2]
+ && auto_heading_numbering[3]) {
+ heading_num[3] ++;
+ }
+ }
+ if (auto_heading_numbering[0]) {
+ if (heading_num[3] > 0) {
+ heading_number_auto_composite
+ = (conf_make_meta.make.auto_num_depth.to!uint == 3
+ && auto_heading_numbering[3])
+ ? (format(q"┋%s.%s.%s.%s┋",
+ heading_num[0].to!string,
+ heading_num[1].to!string,
+ heading_num[2].to!string,
+ heading_num[3].to!string
+ ))
+ : "";
+ } else if (heading_num[2] > 0) {
+ heading_number_auto_composite
+ = ((conf_make_meta.make.auto_num_depth.to!uint >= 2)
+ && (conf_make_meta.make.auto_num_depth.to!uint <= 3)
+ && auto_heading_numbering[2])
+ ? (format(q"┋%s.%s.%s┋",
+ heading_num[0].to!string,
+ heading_num[1].to!string,
+ heading_num[2].to!string
+ ))
+ : "";
+ } else if (heading_num[1] > 0) {
+ heading_number_auto_composite
+ = ((conf_make_meta.make.auto_num_depth.to!uint >= 1)
+ && (conf_make_meta.make.auto_num_depth.to!uint <= 3)
+ && auto_heading_numbering[1])
+ ? (format(q"┋%s.%s┋",
+ heading_num[0].to!string,
+ heading_num[1].to!string
+ ))
+ : "";
+ } else if (heading_num[0] > 0
+ && munge_.match(rgx.auto_heading_numbering_lv1)
+ ) {
+ heading_number_auto_composite
+ = ((conf_make_meta.make.auto_num_depth.to!uint >= 0)
+ && (conf_make_meta.make.auto_num_depth.to!uint <= 3)
+ && auto_heading_numbering[0])
+ ? (format(q"┋%s┋",
+ heading_num[0].to!string
+ ))
+ : "";
+ } else {
+ heading_number_auto_composite = "";
+ }
}
heading_number_auto_composite_segname =
(heading_number_auto_composite.empty)
@@ -5137,16 +5155,16 @@ template DocReformDocAbstraction() {
~ " \"indent_base\": 0,";
} else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) {
_obj_attributes =" \"bullet\": \"true\","
- ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ ","
- ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ",";
+ ~ " \"indent_hang\": " ~ m[1].to!string ~ ","
+ ~ " \"indent_base\": " ~ m[1].to!string ~ ",";
} else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) {
_obj_attributes =" \"bullet\": \"false\","
- ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ ","
- ~ " \"indent_base\": " ~ m.captures[2].to!string ~ ",";
+ ~ " \"indent_hang\": " ~ m[1].to!string ~ ","
+ ~ " \"indent_base\": " ~ m[2].to!string ~ ",";
} else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) {
_obj_attributes =" \"bullet\": \"false\","
- ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ ","
- ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ",";
+ ~ " \"indent_hang\": " ~ m[1].to!string ~ ","
+ ~ " \"indent_base\": " ~ m[1].to!string ~ ",";
} else {
_obj_attributes =" \"bullet\": \"false\","
~ " \"indent_hang\": 0,"
@@ -5622,7 +5640,7 @@ template DocReformDocAbstraction() {
assert(cntr >= previous_count);
assert(
(contents_am[cntr].text).match(
- rgx.inline_notes_delimiter_al_regular_number_note)
+ rgx.inline_notes_al_regular_number_note)
);
}
body {
@@ -5632,31 +5650,31 @@ template DocReformDocAbstraction() {
static auto munge = ObjInlineMarkupMunge();
foreach(m;
(contents_am[cntr].text).matchAll(
- rgx.inline_notes_delimiter_al_regular_number_note)
+ rgx.inline_notes_al_regular_number_note)
) {
debug(endnotes_build) {
writeln(
- "{^", mkup.ff_o, m.captures[1], ".", mkup.ff_c, "^}"
+ "{^", mkup.ff_o, m[1], ".", mkup.ff_c, "^}"
~ mkup.mark_internal_site_lnk,
tag_in_seg["seg_lv4"],
- ".fnSuffix#noteref_\n ", m.captures[1], " ",
- m.captures[2]); // sometimes need segment name (segmented html & epub)
+ ".fnSuffix#noteref_\n ", m[1], " ",
+ m[2]); // sometimes need segment name (segmented html & epub)
}
// you need anchor for segments at this point ->
- object_notes["anchor"] ~= "note_" ~ m.captures[1] ~ "』";
+ object_notes["anchor"] ~= "note_" ~ m[1] ~ "』";
object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty)
? (links_and_images(
- "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_"
- ~ m.captures[1]) ~ " "
- ~ m.captures[2] ~ "』"
+ "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_"
+ ~ m[1]) ~ " "
+ ~ m[2] ~ "』"
)
: (links_and_images(
- "{" ~ mkup.superscript ~ mkup.ff_o ~ m.captures[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}"
+ "{" ~ mkup.superscript ~ mkup.ff_o ~ m[1] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}"
~ mkup.mark_internal_site_lnk
~ tag_in_seg["seg_lv4"]
~ ".fnSuffix#noteref_"
- ~ m.captures[1]) ~ " "
- ~ m.captures[2] ~ "』"
+ ~ m[1]) ~ " "
+ ~ m[2] ~ "』"
);
}
return object_notes;
@@ -5768,7 +5786,7 @@ template DocReformDocAbstraction() {
comp_obj_endnote_.attrib.bullet = false;
foreach (i, endnote; endnotes_["notes"]) {
auto m = endnote.matchFirst(rgx.note_ref);
- string notenumber = m.captures[1].to!string;
+ string notenumber = m[1].to!string;
string anchor_tag = "note_" ~ notenumber;
comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ];
comp_obj_endnote_.has.inline_links = true;
@@ -6366,12 +6384,12 @@ template DocReformDocAbstraction() {
template docSectKeysSeq() {
auto docSectKeysSeq(string[][string] document_section_keys_sequenced) {
struct doc_sect_keys_seq {
- auto seg() {
- return document_section_keys_sequenced["seg"];
- }
auto scroll() {
return document_section_keys_sequenced["scroll"];
}
+ auto seg() {
+ return document_section_keys_sequenced["seg"];
+ }
auto sql() {
return document_section_keys_sequenced["sql"];
}
diff --git a/src/doc_reform/meta/metadochead.d b/src/doc_reform/meta/metadochead.d
new file mode 100644
index 0000000..42f4845
--- /dev/null
+++ b/src/doc_reform/meta/metadochead.d
@@ -0,0 +1,85 @@
+module doc_reform.meta.metadochead;
+template DocReformHarvestGetFromHead() { // TODO
+ import
+ std.datetime,
+ std.getopt,
+ std.file,
+ std.path,
+ std.process;
+ import
+ doc_reform.meta,
+ doc_reform.meta.metadoc_summary,
+ doc_reform.meta.metadoc_from_src,
+ doc_reform.meta.conf_make_meta_structs,
+ doc_reform.meta.conf_make_meta_toml,
+ doc_reform.meta.conf_make_meta_json,
+ doc_reform.meta.defaults,
+ doc_reform.meta.doc_debugs,
+ doc_reform.meta.rgx,
+ doc_reform.source.paths_source,
+ doc_reform.source.read_config_files,
+ doc_reform.source.read_source_files,
+ doc_reform.output.hub;
+ mixin DocReformRgxInit;
+ mixin contentJSONtoDocReformStruct;
+ mixin DocReformBiblio;
+ mixin DocReformRgxInitFlags;
+ mixin outputHub;
+ enum headBody { header, body_content, insert_file_list, image_list }
+ enum makeMeta { make, meta }
+ enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images }
+ static auto rgx = Rgx();
+ auto DocReformHarvestGetFromHead(E,O,M)( // TODO
+ E _env,
+ O _opt_action,
+ M _manifest
+ ){
+ auto _config_document_struct = readConfigDoc!()(_manifest, _env); // document config file
+ auto _config_local_site_struct = readConfigSite!()(_manifest, _env); // local site config
+ ConfCompositePlus _make_and_meta_struct;
+ _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_document_struct);
+ _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_local_site_struct);
+ /+ ↓ read file (filename with path) +/
+ /+ ↓ file tuple of header and content +/
+ if ((_opt_action.debug_do)
+ || (_opt_action.very_verbose)
+ ) {
+ writeln("step1 commence → (get document header & body & insert file list & if needed image list)"
+ );
+ }
+ auto _header_body_insertfilelist_imagelist
+ = DocReformRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn);
+ static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist));
+ static assert(_header_body_insertfilelist_imagelist.length==4);
+ if ((_opt_action.debug_do)
+ || (_opt_action.very_verbose)
+ ) {
+ writeln("- step1 complete");
+ }
+ debug(header_and_body) {
+ writeln(header);
+ writeln(_header_body_insertfilelist_imagelist.length);
+ writeln(_header_body_insertfilelist_imagelist.length[headBody.body_content][0]);
+ }
+ /+ ↓ split header into make and meta +/
+ if ((_opt_action.debug_do)
+ || (_opt_action.very_verbose)
+ ) {
+ writeln("step2 commence → (read document header - toml, return struct)");
+ }
+ _make_and_meta_struct =
+ docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
+ _make_and_meta_struct,
+ _header_body_insertfilelist_imagelist[headBody.header]
+ );
+ if ((_opt_action.debug_do)
+ || (_opt_action.very_verbose)
+ ) {
+ writeln("- step2 complete");
+ }
+
+ auto t = tuple(doc_matters_shared, doc_matters_abridged_collected);
+ static assert(t.length==2);
+ return t;
+ }
+}
diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d
index 2bdb3ec..73900b6 100644
--- a/src/doc_reform/meta/rgx.d
+++ b/src/doc_reform/meta/rgx.d
@@ -88,8 +88,8 @@ static template DocReformRgxInit() {
static heading_blurb_glossary = ctRegex!(`^:?(?:(1)[~][!](?:blurb|glossary)|[A-D1][~])`);
static para_bullet = ctRegex!(`^_[*] `);
static para_bullet_indent = ctRegex!(`^_([1-9])[*] `);
- static para_indent = ctRegex!(`^_([1-9]) `);
- static para_indent_hang = ctRegex!(`^_([0-9])_([0-9]) `);
+ static para_indent = ctRegex!(`^_(?P<indent>[1-9])[ ]`);
+ static para_indent_hang = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`);
static para_attribs = ctRegex!(`^_(?:(?:[0-9])(?:_([0-9]))?|(?:[1-9])?[*]) `);
static para_inline_link_anchor = ctRegex!(`\*[~](?P<anchor>[a-z0-9_.-]+)(?= |$)`,"i");
/+ blocked markup +/
@@ -155,19 +155,37 @@ static template DocReformRgxInit() {
static smid_inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[.,;:?!]?([ ]|$))`, "mg");
static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<content>.+?)\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg");
static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg");
- static smid_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>\S+\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+ static smid_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
static smid_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
- static smid_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>\S+\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+ static smid_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
static smid_mod_image_without_dimensions = ctRegex!(`[{┥](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}┝](?:image|┤.*?├|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+ static smid_a_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+ static smid_a_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+ static smid_a_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[{](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}](?:image|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+ static smid_a_mod_image_without_dimensions = ctRegex!(`[{](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[}](?:image|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+ static smid_b_image = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+ static smid_b_image_generic = ctRegex!(`(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
+ static smid_b_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ]|[^\S]?)[┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[┝](?:┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
+ static smid_b_mod_image_without_dimensions = ctRegex!(`[┥](?:~\^\s+|\s*)☼\S+\.(?:png|gif|jpg),w0h0.*[┝](?:┤.*?├|(?:https?|git):\/\/\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
static smid_image_delimit = ctRegex!(`(?P<pre>^|[ ]|[^\S]?)\{\s*(?P<text>.+?)\s*\}(?:image)(?=[;:!,?.]?([ )\]]|$))`, "mg");
/+ inline markup book index +/
static book_index = ctRegex!(`^=\{\s*(.+?)\}$`, "m");
static book_index_open = ctRegex!(`^=\{\s*([^}]*?)$`);
static book_index_close = ctRegex!(`^(.*?)\}$`, "m");
+ static auto_heading_numbering_lv1 = ctRegex!(`^1~`, "m");
+ static auto_heading_numbering_lv2 = ctRegex!(`^2~`, "m");
+ static auto_heading_numbering_lv3 = ctRegex!(`^3~`, "m");
+ static auto_heading_numbering_lv4 = ctRegex!(`^4~`, "m");
+ static auto_heading_numbering_off = ctRegex!(`^[A-D1-4]~\S*?-\s`, "m");
+ static auto_heading_numbering_off_lv1 = ctRegex!(`^1~\S*?-\s`, "m");
+ static auto_heading_numbering_off_lv2 = ctRegex!(`^2~\S*?-\s`, "m");
+ static auto_heading_numbering_off_lv3 = ctRegex!(`^3~\S*?-\s`, "m");
+ static auto_heading_numbering_off_lv4 = ctRegex!(`^4~\S*?-\s`, "m");
/+ no object_number object +/
static object_number_off = ctRegex!(`~#[ ]*$`, "m");
static object_number_off_dh = ctRegex!(`-#$`, "m");
static object_number_off_all = ctRegex!(`[~-]#$`, "m");
+ static repeated_character_line_separator = ctRegex!(`^(?:(?:(?:[.][ ]?){4,}|(?:[-][ ]?|[~][ ]?|[*][ ]?|[$][ ]?|[#][ ]?|[\\][ ]?|[/][ ]?){2,})\s*?)*$`);
/+ no object_number block +/
static object_number_off_block = ctRegex!(`^--~#$`);
static object_number_off_block_dh = ctRegex!(`^---#$`);
@@ -231,6 +249,11 @@ static template DocReformRgxInit() {
static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
/+ line breaks +/
+ static empty_line = ctRegex!(`^\s*$`);
+ static empty_block = ctRegex!(`^\s*$`, "mg");
+ static br_line_natural = ctRegex!(`\n`, "mg");
+ static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg");
+ static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg");
static br_line = ctRegex!(`┘`, "mg");
static br_nl = ctRegex!(`┙`, "mg");
static br_paragraph = ctRegex!(`┚`, "mg");
@@ -241,22 +264,23 @@ static template DocReformRgxInit() {
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented
static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
+ static inline_notes_al_regular = ctRegex!(`【(.+?)】`, "mg");
static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m");
static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg");
+ static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg");
static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m");
static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m");
static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m");
static inline_al_delimiter_close_regular = ctRegex!(`】`, "m");
static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m");
- static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg");
- static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)】`, "mg");
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!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
- /+ inline markup footnotes endnotes +/
- static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
- static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ /+ inline markup links +/
+ static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_image_info = ctRegex!(`☼?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg");
static inline_link_anchor = ctRegex!(`┋(?P<anchor>\S+?)┋`, "mg"); // TODO *~text_link_anchor
static inline_link_ = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>\S+?)├`, "mg");
@@ -268,6 +292,7 @@ static template DocReformRgxInit() {
static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg");
static url = ctRegex!(`https?://`, "mg");
+ static uri = ctRegex!(`(?:https?|git)://`, "mg");
static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
static fn_suffix = ctRegex!(`\.fnSuffix`, "mg");
static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
diff --git a/src/doc_reform/output/defaults.d b/src/doc_reform/output/defaults.d
index a038802..b8ff322 100644
--- a/src/doc_reform/output/defaults.d
+++ b/src/doc_reform/output/defaults.d
@@ -8,6 +8,7 @@ template InternalMarkup() {
static struct InlineMarkup {
auto en_a_o = "【"; auto en_a_c = "】";
auto en_b_o = "〖"; auto en_b_c = "〗";
+ auto quote_o = "“"; auto quote_c = "”";
auto ff_o = "┨"; auto ff_c = "┣"; // fontface
auto lnk_o = "┥"; auto lnk_c = "┝";
auto url_o = "┤"; auto url_c = "├";
diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d
index 97d8427..e02637c 100644
--- a/src/doc_reform/output/epub3.d
+++ b/src/doc_reform/output/epub3.d
@@ -288,7 +288,11 @@ template outputEPub3() {
}
}
}
- toc ~= format(q"┋ </navMap>
+ toc ~= format(q"┋
+ </navPoint>
+ </navPoint>
+ </navPoint>
+ </navMap>
</ncx>┋");
return toc;
}
@@ -630,7 +634,7 @@ template outputEPub3() {
? zip_data.write(contents.dup)
: zip_data.write(contents.dup
.replaceAll(rgx.spaces_line_start, "")
- .replaceAll(rgx.newline, "")
+ .replaceAll(rgx.newline, " ")
.strip
);
zip_arc_member_file.expandedData = zip_data.toBytes();
diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d
index c35fa55..7980594 100644
--- a/src/doc_reform/output/paths_output.d
+++ b/src/doc_reform/output/paths_output.d
@@ -46,7 +46,7 @@ template DocReformOutPathsFnPd() {
/+ TODO stuff to work out here +/
auto DocReformOutPathsFnPd(Fn,Pn)(
Fn fn_src_pth,
- Pn pod_name
+ Pn pod_name_with_path
) {
struct _PathsStruct {
string base_filename() {
@@ -64,11 +64,11 @@ template DocReformOutPathsFnPd() {
+/
string _fn_src = fn_src_pth.baseName.stripExtension;
string _output_base_name;
- if (!(pod_name.empty)) {
- if (pod_name == _fn_src) {
+ if (!(pod_name_with_path.empty)) {
+ if (pod_name_with_path == _fn_src) {
_output_base_name = _fn_src;
} else {
- _output_base_name = pod_name ~ "." ~ _fn_src;
+ _output_base_name = pod_name_with_path ~ "." ~ _fn_src;
}
} else {
_output_base_name = _fn_src;
diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d
index bf1d766..8cb4581 100644
--- a/src/doc_reform/output/rgx.d
+++ b/src/doc_reform/output/rgx.d
@@ -38,6 +38,11 @@ static template DocReformOutputRgxInit() {
static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
/+ line breaks +/
+ static empty_line = ctRegex!(`^\s*$`);
+ static empty_block = ctRegex!(`^\s*$`, "mg");
+ static br_line_natural = ctRegex!(`\n`, "mg");
+ static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg");
+ static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg");
static br_line = ctRegex!(`┘`, "mg");
static br_nl = ctRegex!(`┙`, "mg");
static br_paragraph = ctRegex!(`┚`, "mg");
@@ -48,22 +53,23 @@ static template DocReformOutputRgxInit() {
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented
static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
+ static inline_notes_al_regular = ctRegex!(`【(.+?)】`, "mg");
static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m");
static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg");
+ static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg");
static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m");
static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m");
static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m");
static inline_al_delimiter_close_regular = ctRegex!(`】`, "m");
static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m");
- static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg");
- static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)】`, "mg");
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!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
- /+ inline markup footnotes endnotes +/
- static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
- static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ /+ inline markup links +/
+ static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg");
+ static inline_image_info = ctRegex!(`☼?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg");
static inline_link_anchor = ctRegex!(`┋(?P<anchor>\S+?)┋`, "mg"); // TODO *~text_link_anchor
static inline_link_ = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>\S+?)├`, "mg");
@@ -75,6 +81,7 @@ static template DocReformOutputRgxInit() {
static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg");
static url = ctRegex!(`https?://`, "mg");
+ static uri = ctRegex!(`(?:https?|git)://`, "mg");
static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg");
static fn_suffix = ctRegex!(`\.fnSuffix`, "mg");
static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d
index c57dde9..113af10 100644
--- a/src/doc_reform/output/sqlite.d
+++ b/src/doc_reform/output/sqlite.d
@@ -387,17 +387,17 @@ template SQLiteFormatAndLoadObject() {
if (obj.has.inline_notes_reg) {
// _txt = font_face(_txt);
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
}
debug(markup_endnotes) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
debug(markup) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
@@ -411,7 +411,7 @@ template SQLiteFormatAndLoadObject() {
string[] _endnotes;
if (obj.has.inline_notes_reg) {
/+ need markup for text, and separated footnote +/
- foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) {
_endnotes ~= format(
"%s%s%s%s\n %s%s%s%s%s\n %s\n%s",
"<p class=\"endnote\">",
@@ -428,10 +428,10 @@ template SQLiteFormatAndLoadObject() {
);
}
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
- } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
debug(markup) {
writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d
index 244a618..eb8debd 100644
--- a/src/doc_reform/output/xmls.d
+++ b/src/doc_reform/output/xmls.d
@@ -311,7 +311,7 @@ template outputXHTMLs() {
}
auto tail() {
string o;
- o = format(q"┋ </div>
+ o = format(q"┋
<a name="bottom" id="bottom"></a>
<a name="end" id="end"></a>
</body>
@@ -334,8 +334,8 @@ template outputXHTMLs() {
_img_pth = "../../../image/";
}
if (_txt.match(rgx.inline_image)) {
- _txt = _txt.replaceAll(
- rgx.inline_image,
+ _txt = _txt
+ .replaceAll(rgx.inline_image,
("$1<img src=\""
~ _img_pth
~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6"))
@@ -440,17 +440,17 @@ template outputXHTMLs() {
if (obj.has.inline_notes_reg) {
_txt = font_face(_txt);
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
}
debug(markup_endnotes) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
debug(markup) {
- if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
}
@@ -465,7 +465,7 @@ template outputXHTMLs() {
if (obj.has.inline_notes_reg) {
_txt = font_face(_txt);
/+ need markup for text, and separated footnote +/
- foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) {
_endnotes ~= format(
"%s%s%s%s\n %s%s%s%s%s\n %s\n%s",
"<p class=\"endnote\">",
@@ -482,10 +482,10 @@ template outputXHTMLs() {
);
}
_txt = _txt.replaceAll(
- rgx.inline_notes_delimiter_al_regular_number_note,
+ rgx.inline_notes_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
- } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) {
+ } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
debug(markup) {
writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
}
diff --git a/src/doc_reform/source/paths_source.d b/src/doc_reform/source/paths_source.d
index a6f3fc1..4b4abf7 100644
--- a/src/doc_reform/source/paths_source.d
+++ b/src/doc_reform/source/paths_source.d
@@ -114,7 +114,7 @@ template PathMatters() {
string manifest_path() {
return _manifest.pod_manifest_path;
}
- string pod_name() {
+ string pod_name_with_path() {
return _manifest.pod_manifest_path.baseName;
}
string manifest_file_with_path() {
@@ -161,9 +161,12 @@ template PathMatters() {
string path_and_fn() {
return _fns;
}
- string pod_name() {
+ string pod_name_with_path() {
return (is_pod) ? _manifest.pod_manifest_path : "";
}
+ string pod_name() {
+ return pod_name_with_path.baseName;
+ }
string filename() {
return path_and_fn.baseName;
}
@@ -182,11 +185,11 @@ template PathMatters() {
}
string doc_uid() {
string _uid;
- if (is_pod && !(pod_name.empty)) {
- if (pod_name.baseName == filename_base) {
+ if (is_pod && !(pod_name_with_path.empty)) {
+ if (pod_name_with_path.baseName == filename_base) {
_uid = filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
} else {
- _uid = pod_name.baseName ~ _sep ~ filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
+ _uid = pod_name_with_path.baseName ~ _sep ~ filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
}
} else {
_uid = _sep ~ filename_base ~ "." ~ filename_extension ~ _sep ~ lng;
@@ -202,10 +205,10 @@ template PathMatters() {
- sqlite discrete index (multilingual, each language of a document)
+/
string _fn;
- if (pod_name.baseName == filename_base) {
+ if (pod_name_with_path.baseName == filename_base) {
_fn = filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
- } else if (!(pod_name.empty)) {
- _fn = pod_name.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
+ } else if (!(pod_name_with_path.empty)) {
+ _fn = pod_name_with_path.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
} else {
_fn = "_" ~ _sep ~ filename_base ~ _sep ~ filename_extension ~ _sep ~ lng;
}
@@ -221,10 +224,10 @@ template PathMatters() {
- sqlite discrete index (multilingual collection)
+/
string _fn;
- if (pod_name.baseName == filename_base) {
+ if (pod_name_with_path.baseName == filename_base) {
_fn = filename_base ~ _sep ~ filename_extension;
- } else if (!(pod_name.empty)) {
- _fn = pod_name.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension;
+ } else if (!(pod_name_with_path.empty)) {
+ _fn = pod_name_with_path.baseName ~ _sep ~ filename_base ~ _sep ~ filename_extension;
} else {
_fn = "_" ~ _sep ~ filename_base ~ _sep ~ filename_extension;
}