aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/default_regex.org1
-rw-r--r--org/doc_reform.org48
-rw-r--r--org/meta_abstraction.org90
-rw-r--r--org/meta_conf_make_meta.org2
-rw-r--r--org/output_sqlite.org8
-rw-r--r--org/output_xmls.org14
6 files changed, 123 insertions, 40 deletions
diff --git a/org/default_regex.org b/org/default_regex.org
index 1496696..be628dd 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -464,6 +464,7 @@ static br_page_line = ctRegex!(`┼`, "mg");
static br_page = ctRegex!(`┿`, "mg");
static br_page_new = ctRegex!(`╂`, "mg");
#+END_SRC
+
*** inline (internal program) markup footnotes endnotes :inline:footnote:
#+name: prgmkup_rgx
diff --git a/org/doc_reform.org b/org/doc_reform.org
index acc21e9..69e23a9 100644
--- a/org/doc_reform.org
+++ b/org/doc_reform.org
@@ -75,6 +75,7 @@ import std.algorithm;
import std.parallelism;
<<mixin_doc_reform_version>>
<<mixin_pre_main>>
+string program_name = "doc-reform";
/++
name "doc_reform"
description "A SiSU inspired document parser writen in D."
@@ -219,8 +220,9 @@ static auto rgx = Rgx();
scope(success) {
debug(checkdoc) {
writefln(
- "~ run complete, ok ~ (doc_reform-%s.%s.%s, %s D:%s, %s %s)",
- ver.major, ver.minor, ver.patch,
+ "~ run complete, ok ~ (%s-%s.%s.%s, %s D:%s, %s %s)",
+ program_name,
+ _ver.major, _ver.minor, _ver.patch,
__VENDOR__, __VERSION__,
bits, os,
);
@@ -593,8 +595,8 @@ auto _opt_action = OptActions();
#+NAME: doc_reform_args
#+BEGIN_SRC d
auto _env = [
- "pwd" : environment["PWD"],
- "home" : environment["HOME"],
+ "pwd" : environment["PWD"],
+ "home" : environment["HOME"],
];
#+END_SRC
@@ -997,6 +999,8 @@ if ((_opt_action.debug_do)
- prepare document_matters, miscellany about processing and the document of
use in downstream processing
+**** verbose message
+
#+NAME: doc_reform_each_file_do_document_matters
#+BEGIN_SRC d
if ((_opt_action.debug_do)
@@ -1005,9 +1009,21 @@ if ((_opt_action.debug_do)
writeln("step4 commence → (doc_matters)");
}
struct DocumentMatters {
+#+END_SRC
+
+**** config make & meta
+
+#+NAME: doc_reform_each_file_do_document_matters
+#+BEGIN_SRC d
auto conf_make_meta() { // TODO meld with all make instructions
return _make_and_meta_struct;
}
+#+END_SRC
+
+**** env related
+
+#+NAME: doc_reform_each_file_do_document_matters
+#+BEGIN_SRC d
auto env() {
struct Env_ {
auto pwd() {
@@ -1019,6 +1035,12 @@ struct DocumentMatters {
}
return Env_();
}
+#+END_SRC
+
+**** opt
+
+#+NAME: doc_reform_each_file_do_document_matters
+#+BEGIN_SRC d
auto opt() {
struct Opt_ {
auto action() {
@@ -1031,6 +1053,12 @@ struct DocumentMatters {
}
return Opt_();
}
+#+END_SRC
+
+**** output related
+
+#+NAME: doc_reform_each_file_do_document_matters
+#+BEGIN_SRC d
auto src() {
return _manifest.src;
}
@@ -1080,8 +1108,20 @@ struct DocumentMatters {
auto output_path() {
return _manifest.output.path;
}
+#+END_SRC
+
+**** } close
+
+#+NAME: doc_reform_each_file_do_document_matters
+#+BEGIN_SRC d
}
auto doc_matters = DocumentMatters();
+#+END_SRC
+
+**** step complete message
+
+#+NAME: doc_reform_each_file_do_document_matters
+#+BEGIN_SRC d
if ((_opt_action.debug_do)
|| (_opt_action.very_verbose)
) {
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index 8b8fe79..51b089c 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -613,7 +613,7 @@ scope(failure) {
line,
);
}
-line = (line).replaceAll(rgx.true_dollar, "$$$$");
+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))
+/
@@ -950,7 +950,7 @@ if there is a blurb section you need to:
/+ within block object: group +/
line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
- line = (line)
+ line = line
.replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
_group_block_(line, an_object, obj_type_status);
continue;
@@ -965,11 +965,11 @@ if there is a blurb section you need to:
line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
if (auto m = line.match(rgx.spaces_line_start)) {
- line = (line)
+ line = line
.replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
}
if (auto m = line.match(rgx.spaces_multiple)) {
- line = (line)
+ line = line
.replaceAll(rgx.spaces_multiple, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
}
_block_block_(line, an_object, obj_type_status);
@@ -3517,7 +3517,7 @@ void _biblio_block_(
tmp ~= au.str;
}
}
- tmp = (tmp).replace(rgx.trailing_comma, "");
+ tmp = tmp.replace(rgx.trailing_comma, "");
j["author"].str = tmp;
goto default;
case "editor_raw": // editor_arr editor (fn sn)
@@ -3532,7 +3532,7 @@ void _biblio_block_(
tmp ~= ed.str;
}
}
- tmp = (tmp).replace(rgx.trailing_comma, "");
+ tmp = tmp.replace(rgx.trailing_comma, "");
j["editor"].str = tmp;
goto default;
case "fulltitle": // title & subtitle
@@ -4927,7 +4927,7 @@ auto font_faces_line(T)(
) {
static auto rgx = Rgx();
if (textline.match(rgx.inline_faces_line)) {
- textline = (textline)
+ textline = textline
.replaceFirst(rgx.inline_emphasis_line, ("*{$1}*$2"))
.replaceFirst(rgx.inline_bold_line, ("!{$1}!$2"))
.replaceFirst(rgx.inline_underscore_line, ("_{$1}_$2"))
@@ -5269,7 +5269,7 @@ static struct ObjInlineMarkupMunge {
if (obj_txt_in.match(rgx.smid_inline_url_generic)) {
/+ link: naked url: http://url +/
if (obj_txt_in.match(rgx.smid_inline_link_naked_url)) {
- obj_txt_in = (obj_txt_in).replaceAll(
+ obj_txt_in = obj_txt_in.replaceAll(
rgx.smid_inline_link_naked_url,
("$1"
~ mkup.lnk_o ~ "$2" ~ mkup.lnk_c
@@ -5283,7 +5283,7 @@ static struct ObjInlineMarkupMunge {
{ link which includes url as footnote }http://url~{ { http://url }http://url }~
+/
if (obj_txt_in.match(rgx.smid_inline_link_endnote_url_helper)) {
- obj_txt_in = (obj_txt_in)
+ obj_txt_in = obj_txt_in
.replaceAll(
rgx.smid_inline_link_endnote_url_helper_punctuated,
(mkup.lnk_o ~ "$1" ~ mkup.lnk_c
@@ -5305,7 +5305,7 @@ static struct ObjInlineMarkupMunge {
{ linked text or image }http://url
+/
if (obj_txt_in.match(rgx.smid_inline_link_markup_regular)) {
- obj_txt_in = (obj_txt_in).replaceAll(
+ obj_txt_in = obj_txt_in.replaceAll(
rgx.smid_inline_link_markup_regular,
("$1"
~ mkup.lnk_o ~ "$2" ~ mkup.lnk_c
@@ -5334,7 +5334,7 @@ static struct ObjInlineMarkupMunge {
writeln("Image: ", obj_txt_in);
}
if (obj_txt_in.match(rgx.smid_image_with_dimensions)) {
- obj_txt_in = (obj_txt_in).replaceAll(
+ obj_txt_in = obj_txt_in.replaceAll(
rgx.smid_image_with_dimensions,
("$1"
~ mkup.img ~ "$2,w$3h$4 "
@@ -5344,7 +5344,7 @@ static struct ObjInlineMarkupMunge {
writeln("IMAGE with size: ", obj_txt_in); // decide on representation
}
} else if (obj_txt_in.match(rgx.smid_image)) {
- obj_txt_in = (obj_txt_in).replaceAll(
+ obj_txt_in = obj_txt_in.replaceAll(
rgx.smid_image,
("$1"
~ mkup.img ~ "$2,w0h0 "
@@ -5372,7 +5372,7 @@ static struct ObjInlineMarkupMunge {
bool flg_notes_reg = false;
bool flg_notes_star = false;
bool flg_notes_plus = false;
- obj_txt_in = (obj_txt_in).replaceAll(
+ obj_txt_in = obj_txt_in.replaceAll(
rgx.inline_notes_curly,
(mkup.en_a_o ~ " $1" ~ mkup.en_a_c)
);
@@ -5471,7 +5471,7 @@ static struct ObjInlineMarkupMunge {
obj_txt_in = url_links(obj_txt_in);
}
if (auto m = obj_txt_in.match(rgx.para_inline_link_anchor)) {
- obj_txt_in = (obj_txt_in)
+ obj_txt_in = obj_txt_in
.replaceAll(rgx.para_inline_link_anchor, "┋$1┋");
}
auto ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers);
@@ -5520,7 +5520,7 @@ static struct ObjInlineMarkupMunge {
}
}
body {
- obj_txt["munge"]=(obj_txt_in)
+ obj_txt["munge"] = obj_txt_in
.replaceFirst(rgx.heading, "")
.replaceFirst(rgx.object_number_off_all, "")
.strip;
@@ -5677,7 +5677,7 @@ static struct ObjInlineMarkupMunge {
}
}
body {
- obj_txt_in = (obj_txt_in).replaceAll(rgx.space, mkup.nbsp);
+ obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp);
obj_txt["munge"] = obj_txt_in;
return obj_txt["munge"];
}
@@ -6081,7 +6081,7 @@ private:
}
if ((!empty(heading_number_auto_composite))
&& (obj_["lev_markup_number"].to!uint >= conf_make_meta.make.auto_num_top_lv)) {
- munge_=(munge_)
+ munge_ = munge_
.replaceFirst(rgx.heading,
"$1~$2 " ~ heading_number_auto_composite ~ ". ")
.replaceFirst(rgx.heading_marker_missing_tag,
@@ -6109,16 +6109,16 @@ private:
if (!(munge_.match(rgx.heading_anchor_tag))) {
if (munge_.match(rgx.heading_identify_anchor_tag)) {
if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) {
- munge_=(munge_).replaceFirst(
+ munge_ = munge_.replaceFirst(
rgx.heading_marker_missing_tag,
"$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " ");
if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) {
auto tag_remunge_ = n.captures[2]
.replaceAll(rgx.heading_marker_tag_has_colon, "..");
- munge_=(munge_).replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " ");
+ munge_=munge_.replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " ");
}
} else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) {
- munge_=(munge_).replaceFirst(
+ munge_ = munge_.replaceFirst(
rgx.heading_marker_missing_tag,
"$1~" ~ "s" ~ m.captures[1] ~ " ");
}
@@ -6127,7 +6127,7 @@ private:
heading_num_lev1 = 0;
}
heading_num_lev1 ++;
- munge_=(munge_).replaceFirst(
+ munge_ = munge_.replaceFirst(
rgx.heading_marker_missing_tag,
"$1~" ~ "x" ~ heading_num_lev1.to!string ~ " ");
}
@@ -6689,7 +6689,7 @@ struct BookIndexReportSection {
foreach (mainkey; mainkeys) {
write("_0_1 !{", mainkey, "}! ");
foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) {
- auto go = (ref_).replaceAll(rgx.book_index_go, "$1");
+ auto go = ref_.replaceAll(rgx.book_index_go, "$1");
write(" {", ref_, "}#", go, ", ");
}
writeln(" \\\\");
@@ -6699,7 +6699,7 @@ struct BookIndexReportSection {
foreach (subkey; subkeys) {
write(" ", subkey, ", ");
foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) {
- auto go = (ref_).replaceAll(rgx.book_index_go, "$1");
+ auto go = ref_.replaceAll(rgx.book_index_go, "$1");
write(" {", ref_, "}#", go, ", ");
}
writeln(" \\\\");
@@ -6823,7 +6823,7 @@ struct BookIndexReportSection {
bi_tmp ~= " \\\\\n ";
++skn;
}
- bi_tmp = (bi_tmp).replaceFirst(rgx.trailing_linebreak, "");
+ bi_tmp = bi_tmp.replaceFirst(rgx.trailing_linebreak, "");
comp_obj_para = comp_obj_para.init;
comp_obj_para.metainfo.is_of_part = "backmatter";
comp_obj_para.metainfo.is_of_section = "bookindex";
@@ -7863,18 +7863,36 @@ struct DocObj_MetaInfo_ {
int parent_ocn = 0;
int last_decendant_ocn = 0;
}
+#+END_SRC
+
+**** object text attributes
+
+#+name: meta_structs_init
+#+BEGIN_SRC d
struct DocObj_TxtAttrib_ {
int indent_base = 0;
int indent_hang = 0;
bool bullet = false;
string language = ""; // not implemented, consider
}
+#+END_SRC
+
+**** object has within it
+
+#+name: meta_structs_init
+#+BEGIN_SRC d
struct DocObj_Has_ { // has
bool inline_links = false;
bool inline_notes_reg = false;
bool inline_notes_star = false;
bool contains_image_without_dimensions = false;
}
+#+END_SRC
+
+**** table attributes
+
+#+name: meta_structs_init
+#+BEGIN_SRC d
struct DocObj_Table_ {
int number_of_columns = 0;
double[] column_widths = [];
@@ -7882,14 +7900,32 @@ struct DocObj_Table_ {
bool heading = false;
bool walls = false; // not implemented
}
+#+END_SRC
+
+**** code attributes
+
+#+name: meta_structs_init
+#+BEGIN_SRC d
struct DocObj_CodeBlock_ {
string syntax = "";
}
+#+END_SRC
+
+**** pointers
+
+#+name: meta_structs_init
+#+BEGIN_SRC d
struct DocObj_Pointer_ {
int doc_object = 0;
int html_segnames = 0;
int heading = 0;
}
+#+END_SRC
+
+**** tags
+
+#+name: meta_structs_init
+#+BEGIN_SRC d
struct DocObj_Tags_ {
string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; // TODO redundant? see markedup and collapsed ancestors DONE
string anchor_tag_html = "";
@@ -7903,6 +7939,12 @@ struct DocObj_Tags_ {
string[] lev4_subtoc = [];
string[] anchor_tags = [];
}
+#+END_SRC
+
+**** composite object the parts
+
+#+name: meta_structs_init
+#+BEGIN_SRC d
struct ObjGenericComposite {
string text = "";
DocObj_MetaInfo_ metainfo;
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index f7b6fd1..852f144 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -76,7 +76,7 @@ auto _mkup = InlineMarkup();
#+name: meta_defaults_template_structs
#+BEGIN_SRC d
auto url_markup(string line) {
- auto line_ = (line)
+ auto line_ = line
.replaceAll(
_rgx.smid_inline_link_markup_regular,
("$1"
diff --git a/org/output_sqlite.org b/org/output_sqlite.org
index 7d49461..61390a3 100644
--- a/org/output_sqlite.org
+++ b/org/output_sqlite.org
@@ -535,7 +535,7 @@ auto inline_links(M,O)(
if (obj.has.inline_links) {
if ((_txt.match(rgx.mark_internal_site_lnk))
&& (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_seg_link,
"$1");
}
@@ -589,7 +589,7 @@ auto inline_links(M,O)(
);
}
}
- _txt = (_txt)
+ _txt = _txt
.replaceAll(
rgx.inline_link_fn_suffix,
("$1.html"))
@@ -636,7 +636,7 @@ auto inline_notes_scroll(M,O)(
) {
if (obj.has.inline_notes_reg) {
// _txt = font_face(_txt);
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_notes_delimiter_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
@@ -683,7 +683,7 @@ auto inline_notes_seg(M,O)(
"</p>"
);
}
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_notes_delimiter_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
diff --git a/org/output_xmls.org b/org/output_xmls.org
index c58f775..e44a9c9 100644
--- a/org/output_xmls.org
+++ b/org/output_xmls.org
@@ -94,7 +94,7 @@ string special_characters(O)(
const O obj,
string _txt
){
- _txt = (_txt)
+ _txt = _txt
.replaceAll(rgx.xhtml_ampersand, "&#38;")
.replaceAll(rgx.xhtml_quotation, "&#34;")
.replaceAll(rgx.xhtml_less_than, "&#60;")
@@ -113,7 +113,7 @@ string special_characters(O)(
#+name: xhtml_format_objects
#+BEGIN_SRC d
string special_characters_text(string _txt){
- _txt = (_txt)
+ _txt = _txt
.replaceAll(rgx.xhtml_ampersand, "&#38;")
.replaceAll(rgx.xhtml_quotation, "&#34;")
.replaceAll(rgx.xhtml_less_than, "&#60;")
@@ -128,7 +128,7 @@ string special_characters_text(string _txt){
#+name: xhtml_format_objects
#+BEGIN_SRC d
string font_face(string _txt){
- _txt = (_txt)
+ _txt = _txt
.replaceAll(rgx.inline_emphasis, ("<em>$1</em>"))
.replaceAll(rgx.inline_bold, ("<b>$1</b>"))
.replaceAll(rgx.inline_underscore, ("<u>$1</u>"))
@@ -475,7 +475,7 @@ auto inline_links(M,O)(
if (obj.has.inline_links) {
if ((_txt.match(rgx.mark_internal_site_lnk))
&& (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_seg_link,
"$1");
}
@@ -514,7 +514,7 @@ auto inline_links(M,O)(
}
}
}
- _txt = (_txt)
+ _txt = _txt
.replaceAll(
rgx.inline_link_fn_suffix,
("$1" ~ _suffix))
@@ -561,7 +561,7 @@ auto inline_notes_scroll(M,O)(
) {
if (obj.has.inline_notes_reg) {
_txt = font_face(_txt);
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_notes_delimiter_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
@@ -609,7 +609,7 @@ auto inline_notes_seg(M,O)(
"</p>"
);
}
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_notes_delimiter_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);