aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-03-01 12:51:58 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitb243ba3e00bf6cd5e9298903bc69d8efc7a03414 (patch)
treedb70f147c4aa744166bbb559ab238ccf316f8727
parentheader make unmarked headings (diff)
conf, make, meta, init and tidy substitution
-rw-r--r--dub.sdl11
-rw-r--r--maker.org4
-rw-r--r--org/meta_abstraction.org63
-rw-r--r--org/meta_conf_make_meta.org281
-rw-r--r--src/sdp/meta/conf_make_meta_json.d6
-rw-r--r--src/sdp/meta/conf_make_meta_structs.d275
-rw-r--r--src/sdp/meta/metadoc_from_src.d63
7 files changed, 313 insertions, 390 deletions
diff --git a/dub.sdl b/dub.sdl
index a3c0937..1b773ae 100644
--- a/dub.sdl
+++ b/dub.sdl
@@ -13,15 +13,6 @@ dependency "toml:json" version="~>0.4.0-rc.2"
dependency "d2sqlite3" version="~>0.13.1" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3.html
subconfiguration "d2sqlite3" "all-included"
dependency "archive" version="~>0.6.0" # http://code.dlang.org/packages/archive https://github.com/rcythr/archive
-configuration "build" {
- name "build"
- targetType "executable"
- platforms "posix"
- targetName "bin/sdp"
- dflags "-J=views" "-I=src/sdp"
- buildOptions "verbose" "releaseMode" "optimize" "inline"
- postGenerateCommands "/usr/bin/notify-send -t 0 'D release executable ready' 'sdp'"
-}
configuration "reggae" {
name "build"
targetType "executable"
@@ -29,7 +20,7 @@ configuration "reggae" {
targetName "bin/sdp-rg"
dflags "-J=views" "-I=src/sdp"
buildOptions "verbose" "releaseMode" "optimize" "inline"
- postGenerateCommands "/usr/bin/notify-send -t 0 'D release executable ready' 'sdp'"
+ postGenerateCommands "/usr/bin/notify-send -t 0 'D release executable ready' 'sdp-rg'"
}
configuration "sdp-release" {
name "release"
diff --git a/maker.org b/maker.org
index 23589ab..fc2b740 100644
--- a/maker.org
+++ b/maker.org
@@ -813,7 +813,7 @@ dependency "archive" version="~>0.6.0" # http://code.dlang.org/pac
** generic :generic:
*** build (sdp) :release:
-#+BEGIN_SRC sh :tangle dub.sdl
+#+BEGIN_SRC sh
configuration "build" {
name "build"
targetType "executable"
@@ -835,7 +835,7 @@ configuration "reggae" {
targetName "bin/sdp-rg"
dflags "-J=views" "-I=src/sdp"
buildOptions "verbose" "releaseMode" "optimize" "inline"
- postGenerateCommands "/usr/bin/notify-send -t 0 'D release executable ready' 'sdp'"
+ postGenerateCommands "/usr/bin/notify-send -t 0 'D release executable ready' 'sdp-rg'"
}
#+END_SRC
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index 03da5cf..959de0c 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -538,6 +538,7 @@ int cnt1 = 1; int cnt2 = 1; int cnt3 = 1;
#+name: make_tests
#+BEGIN_SRC d
+enum Substitute { match, markup, }
debug (substitutions) {
writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:");
if (!(conf_make_meta.make.headings.empty)) {
@@ -545,21 +546,21 @@ debug (substitutions) {
}
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
- writeln("regex to match: ", substitution_pair[0]);
- writeln("substitution to make: ", substitution_pair[1]);
+ writeln("regex to match: ", substitution_pair[Substitute.match]);
+ writeln("substitution to make: ", substitution_pair[Substitute.markup]);
}
}
- if (!(conf_make_meta.make.bold_rgxmatch == "=NULL" || conf_make_meta.make.bold_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.bold_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.bold_substitute_html);
+ if (conf_make_meta.make.bold) {
+ writeln("regex to match: ", conf_make_meta.make.bold[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.bold[Substitute.markup]);
}
- if (!(conf_make_meta.make.emphasis_rgxmatch == "=NULL" || conf_make_meta.make.emphasis_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.emphasis_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.emphasis_substitute_html);
+ if (conf_make_meta.make.emphasis) {
+ writeln("regex to match: ", conf_make_meta.make.emphasis[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.emphasis[Substitute.markup]);
}
- if (!(conf_make_meta.make.italics_rgxmatch == "=NULL" || conf_make_meta.make.italics_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.italics_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.italics_substitute_html);
+ if (conf_make_meta.make.italics) {
+ writeln("regex to match: ", conf_make_meta.make.italics[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.italics[Substitute.markup]);
}
}
#+END_SRC
@@ -857,6 +858,7 @@ if there is a blurb section you need to:
#+BEGIN_SRC d
} else if (obj_type_status["quote"] == TriState.on) {
/+ within block object: quote +/
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_quote_block_(line, an_object, obj_type_status);
continue;
@@ -869,6 +871,7 @@ if there is a blurb section you need to:
/+ within block object: group +/
} else if (obj_type_status["group"] == TriState.on) {
/+ 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)
.replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
@@ -882,6 +885,7 @@ if there is a blurb section you need to:
#+BEGIN_SRC d
} else if (obj_type_status["block"] == TriState.on) {
/+ within block object: block +/
+ 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)
@@ -938,7 +942,6 @@ if (line.matchFirst(rgx.block_poem_open)) {
processing.remove("verse");
obj_cite_number_poem["start"] = obj_cite_digits.on.to!string;
}
-line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_start_block_(line, obj_type_status, obj_cite_number_poem);
continue;
#+END_SRC
@@ -1044,10 +1047,12 @@ if (line.matchFirst(rgx.book_index)
+/
if (line.matchFirst(rgx.heading)) {
/+ heading match +/
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
_heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta);
} else if (line_occur["para"] == State.off) {
/+ para match +/
an_object_key="body_nugget";
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
}
@@ -1075,6 +1080,7 @@ if (line.matchFirst(rgx.book_index)
debug(para) {
writeln(an_object_key, "-> ", line);
}
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
an_object[an_object_key] ~= " " ~ line;
++line_occur["para"];
@@ -2574,11 +2580,12 @@ auto _doc_header_and_make_substitutions_(L,CMM)(
debug(asserts) {
static assert(is(typeof(line) == char[]));
}
+ enum Substitute { match, markup, }
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
line = line.replaceAll(
- regex(substitution_pair[0]),
- substitution_pair[1]
+ regex(substitution_pair[Substitute.match]),
+ substitution_pair[Substitute.markup]
);
}
}
@@ -2597,31 +2604,23 @@ auto _doc_header_and_make_substitutions_fontface_(L,CMM)(
debug(asserts) {
static assert(is(typeof(line) == char[]));
}
- if (!(
- conf_make_meta.make.bold_rgxmatch == "=NULL"
- || conf_make_meta.make.bold_rgxmatch.empty
- )) {
+ enum Substitute { match, markup, }
+ if ( conf_make_meta.make.bold) {
line = line.replaceAll(
- regex(conf_make_meta.make.bold_rgxmatch),
- conf_make_meta.make.bold_substitute_sisu_markup
+ regex(conf_make_meta.make.bold[Substitute.match]),
+ conf_make_meta.make.bold[Substitute.markup]
);
}
- if (!(
- conf_make_meta.make.emphasis_rgxmatch == "=NULL"
- || conf_make_meta.make.emphasis_rgxmatch.empty
- )) {
+ if (conf_make_meta.make.emphasis) {
line = line.replaceAll(
- regex(conf_make_meta.make.emphasis_rgxmatch),
- conf_make_meta.make.emphasis_substitute_sisu_markup
+ regex(conf_make_meta.make.emphasis[Substitute.match]),
+ conf_make_meta.make.emphasis[Substitute.markup]
);
}
- if (!(
- conf_make_meta.make.italics_rgxmatch == "=NULL"
- || conf_make_meta.make.italics_rgxmatch.empty
- )) {
+ if (conf_make_meta.make.italics) {
line = line.replaceAll(
- regex(conf_make_meta.make.italics_rgxmatch),
- conf_make_meta.make.italics_substitute_sisu_markup
+ regex(conf_make_meta.make.italics[Substitute.match]),
+ conf_make_meta.make.italics[Substitute.markup]
);
}
return line;
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index c6c4b2c..fff5275 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -64,36 +64,28 @@ import
#+name: meta_defaults_template_structs
#+BEGIN_SRC d
struct ConfCompositeMakeStr {
- string bold = "";
- string breaks = "";
- string cover_image = "";
- string css = "";
- string emphasis = "";
- string footer = "";
+ string bold;
+ string breaks;
+ string cover_image;
+ string css;
+ string emphasis;
+ string footer;
string[] headings;
- string home_button_image = "";
- string home_button_text = "";
- string italics = "";
- string num_top = "";
- string num_depth = "";
+ string home_button_image;
+ string home_button_text;
+ string italics;
+ string num_top;
+ string num_depth;
string[][] substitute;
- string texpdf_font = "";
+ string texpdf_font;
}
struct confCompositeMakeBuild {
- auto bold_rgxmatch(string _mk) {
- auto _rgxtxt = (_mk.empty)
- ? `=NULL`
- : `(` ~ _mk.dup ~ `)`;
- return (cast(char[]) (_rgxtxt));
- }
- auto bold_substitute_abstract() {
- return "*{$1}*";
- }
- auto bold_substitute_sisu_markup() {
- return "*{$1}*";
- }
- auto bold_substitute_html() {
- return "<b>$1</b>";
+ auto bold(string _mk) {
+ string[] _out;
+ if (_mk) {
+ _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "*{$1}*", "<b>$1</b>"];
+ }
+ return _out;
}
auto breaks(string _mk) {
return _mk;
@@ -104,20 +96,12 @@ struct confCompositeMakeBuild {
auto css(string _mk) {
return _mk;
}
- auto emphasis_rgxmatch(string _mk) {
- auto _rgxtxt = (_mk.empty)
- ? `=NULL`
- : `(` ~ _mk.dup ~ `)`;
- return (cast(char[]) (_rgxtxt));
- }
- auto emphasis_substitute_abstract() {
- return "!{$1}!";
- }
- auto emphasis_substitute_sisu_markup() {
- return "!{$1}!";
- }
- auto emphasis_substitute_html() {
- return "<em>$1</em>";
+ auto emphasis(string _mk) {
+ string[] _out;
+ if (_mk) {
+ _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "!{$1}!", "<em>$1</em>" ];
+ }
+ return _out;
}
auto footer(string _mk) {
return _mk;
@@ -131,20 +115,12 @@ struct confCompositeMakeBuild {
auto home_button_text(string _mk) {
return _mk;
}
- auto italics_rgxmatch(string _mk) {
- auto _rgxtxt = (_mk.empty)
- ? `=NULL`
- : `(` ~ _mk.dup ~ `)`;
- return (cast(char[]) (_rgxtxt));
- }
- auto italics_substitute_abstract() {
- return "/{$1}/";
- }
- auto italics_substitute_sisu_markup() {
- return "/{$1}/";
- }
- auto italics_substitute_html() {
- return "<i>$1</i>";
+ auto italics(string _mk) {
+ string[] _out;
+ if (_mk) {
+ _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "/{$1}/", "<i>$1</i>" ];
+ }
+ return _out;
}
auto num_top(string _mk) {
return _mk;
@@ -167,29 +143,20 @@ struct confCompositeMakeBuild {
#+name: meta_defaults_template_structs
#+BEGIN_SRC d
struct ConfCompositeMakeInit {
- char[] bold_rgxmatch = `=NULL`.dup;
- auto bold_substitute_abstract = "*{$1}*";
- auto bold_substitute_sisu_markup = "*{$1}*";
- auto bold_substitute_html = "<b>$1</b>";
- string breaks = "";
- string cover_image = "";
- string css = "";
- char[] emphasis_rgxmatch = `=NULL`.dup;
- auto emphasis_substitute_abstract = "!{$1}!";
- auto emphasis_substitute_sisu_markup = "!{$1}!";
- auto emphasis_substitute_html = "<em>$1</em>";
- string footer = "";
+ string[] bold;
+ string breaks;
+ string cover_image;
+ string css;
+ string[] emphasis;
+ string footer;
string[] headings;
- string home_button_image = "";
- string home_button_text = "";
- char[] italics_rgxmatch = `=NULL`.dup;
- auto italics_substitute_abstract = "/{$1}/";
- auto italics_substitute_sisu_markup = "/{$1}/";
- auto italics_substitute_html = "<i>$1</i>";
- string num_top = "";
- string num_depth = "";
+ string home_button_image;
+ string home_button_text;
+ string[] italics;
+ string num_top;
+ string num_depth;
string[][] substitute;
- string texpdf_font = "";
+ string texpdf_font;
}
#+END_SRC
@@ -198,38 +165,38 @@ struct ConfCompositeMakeInit {
#+name: meta_defaults_template_structs
#+BEGIN_SRC d
struct ConfCompositeSiteLocal {
- string webserv_url_root = "";
- string webserv_path = "";
- string webserv_images = "";
- string webserv_cgi = "";
- string webserv_cgi_host = "";
- string webserv_cgi_host_path = "";
- string webserv_cgi_port = "";
- string webserv_cgi_user = "";
- string webserv_cgi_file_links = "";
- string processing_path = "";
- string processing_dir = "";
- string processing_concord_max = "";
- string flag_act0 = "";
- string flag_act1 = "";
- string flag_act2 = "";
- string flag_act3 = "";
- string flag_act4 = "";
- string flag_act5 = "";
- string flag_act6 = "";
- string flag_act7 = "";
- string flag_act8 = "";
- string flag_act9 = "";
- string default_papersize = "";
- string default_text_wrap = "";
- string default_emphasis = "";
- string default_language = "";
- string default_digest = "";
- string permission_share_source = "";
- string search_flag = "";
- string search_action = "";
- string search_db = "";
- string search_title = "";
+ string webserv_url_root;
+ string webserv_path;
+ string webserv_images;
+ string webserv_cgi;
+ string webserv_cgi_host;
+ string webserv_cgi_host_path;
+ string webserv_cgi_port;
+ string webserv_cgi_user;
+ string webserv_cgi_file_links;
+ string processing_path;
+ string processing_dir;
+ string processing_concord_max;
+ string flag_act0;
+ string flag_act1;
+ string flag_act2;
+ string flag_act3;
+ string flag_act4;
+ string flag_act5;
+ string flag_act6;
+ string flag_act7;
+ string flag_act8;
+ string flag_act9;
+ string default_papersize;
+ string default_text_wrap;
+ string default_emphasis;
+ string default_language;
+ string default_digest;
+ string permission_share_source;
+ string search_flag;
+ string search_action;
+ string search_db;
+ string search_title;
}
#+END_SRC
@@ -238,53 +205,53 @@ struct ConfCompositeSiteLocal {
#+name: meta_defaults_template_structs
#+BEGIN_SRC d
struct MetaComposite {
- string classify_dewey = "";
- string classify_keywords = "";
- string classify_loc = "";
- string classify_subject = "";
- string classify_topic_register = "";
- string creator_author = "";
- string creator_author_email = "";
- string creator_illustrator = "";
- string creator_translator = "";
- string date_added_to_site = "";
- string date_available = "";
- string date_created = "";
- string date_issued = "";
- string date_modified = "";
- string date_published = "";
- string date_valid = "";
- string identifier_isbn = "";
- string identifier_oclc = "";
- string identifier_pg = "";
- string language_document = "";
- string language_document_char = "";
- string links = "";
- string notes_abstract = "";
- string notes_description = "";
- string original_language = "";
- string original_language_char = "";
- string original_publisher = "";
- string original_source = "";
- string original_title = "";
- string publisher = "";
- string rights_copyright = "";
- string rights_copyright_audio = "";
- string rights_copyright_cover = "";
- string rights_copyright_illustrations = "";
- string rights_copyright_photographs = "";
- string rights_copyright_text = "";
- string rights_copyright_translation = "";
- string rights_copyright_video = "";
- string rights_license = "";
- string title_edition = "";
- string title_full = "";
- string title_language = "";
- string title_main = "";
- string title_note = "";
- string title_short = "";
- string title_sub = "";
- string title_subtitle = "";
+ string classify_dewey;
+ string classify_keywords;
+ string classify_loc;
+ string classify_subject;
+ string classify_topic_register;
+ string creator_author;
+ string creator_author_email;
+ string creator_illustrator;
+ string creator_translator;
+ string date_added_to_site;
+ string date_available;
+ string date_created;
+ string date_issued;
+ string date_modified;
+ string date_published;
+ string date_valid;
+ string identifier_isbn;
+ string identifier_oclc;
+ string identifier_pg;
+ string language_document;
+ string language_document_char;
+ string links;
+ string notes_abstract;
+ string notes_description;
+ string original_language;
+ string original_language_char;
+ string original_publisher;
+ string original_source;
+ string original_title;
+ string publisher;
+ string rights_copyright;
+ string rights_copyright_audio;
+ string rights_copyright_cover;
+ string rights_copyright_illustrations;
+ string rights_copyright_photographs;
+ string rights_copyright_text;
+ string rights_copyright_translation;
+ string rights_copyright_video;
+ string rights_license;
+ string title_edition;
+ string title_full;
+ string title_language;
+ string title_main;
+ string title_note;
+ string title_short;
+ string title_sub;
+ string title_subtitle;
}
#+END_SRC
@@ -557,16 +524,16 @@ if ("make" in _json.object) {
) {
_struct_composite.make_str.texpdf_font = _json.object["make"]["texpdf_font"].str;
}
- _struct_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_struct_composite.make_str.bold);
+ _struct_composite.make.bold = _mk.bold(_struct_composite.make_str.bold);
_struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks);
_struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image);
_struct_composite.make.css = _mk.css(_struct_composite.make_str.css);
- _struct_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_struct_composite.make_str.emphasis);
+ _struct_composite.make.emphasis = _mk.emphasis(_struct_composite.make_str.emphasis);
_struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer);
_struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings);
_struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image);
_struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text);
- _struct_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_struct_composite.make_str.italics);
+ _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics);
_struct_composite.make.num_top = _mk.num_top(_struct_composite.make_str.num_top);
_struct_composite.make.num_depth = _mk.num_depth(_struct_composite.make_str.num_depth);
_struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute);
diff --git a/src/sdp/meta/conf_make_meta_json.d b/src/sdp/meta/conf_make_meta_json.d
index 916dd33..abb9b46 100644
--- a/src/sdp/meta/conf_make_meta_json.d
+++ b/src/sdp/meta/conf_make_meta_json.d
@@ -137,16 +137,16 @@ static template contentJSONtoSiSUstruct() {
) {
_struct_composite.make_str.texpdf_font = _json.object["make"]["texpdf_font"].str;
}
- _struct_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_struct_composite.make_str.bold);
+ _struct_composite.make.bold = _mk.bold(_struct_composite.make_str.bold);
_struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks);
_struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image);
_struct_composite.make.css = _mk.css(_struct_composite.make_str.css);
- _struct_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_struct_composite.make_str.emphasis);
+ _struct_composite.make.emphasis = _mk.emphasis(_struct_composite.make_str.emphasis);
_struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer);
_struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings);
_struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image);
_struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text);
- _struct_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_struct_composite.make_str.italics);
+ _struct_composite.make.italics = _mk.italics(_struct_composite.make_str.italics);
_struct_composite.make.num_top = _mk.num_top(_struct_composite.make_str.num_top);
_struct_composite.make.num_depth = _mk.num_depth(_struct_composite.make_str.num_depth);
_struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute);
diff --git a/src/sdp/meta/conf_make_meta_structs.d b/src/sdp/meta/conf_make_meta_structs.d
index d46b462..add72d6 100644
--- a/src/sdp/meta/conf_make_meta_structs.d
+++ b/src/sdp/meta/conf_make_meta_structs.d
@@ -10,36 +10,28 @@ import
std.utf,
std.conv : to;
struct ConfCompositeMakeStr {
- string bold = "";
- string breaks = "";
- string cover_image = "";
- string css = "";
- string emphasis = "";
- string footer = "";
+ string bold;
+ string breaks;
+ string cover_image;
+ string css;
+ string emphasis;
+ string footer;
string[] headings;
- string home_button_image = "";
- string home_button_text = "";
- string italics = "";
- string num_top = "";
- string num_depth = "";
+ string home_button_image;
+ string home_button_text;
+ string italics;
+ string num_top;
+ string num_depth;
string[][] substitute;
- string texpdf_font = "";
+ string texpdf_font;
}
struct confCompositeMakeBuild {
- auto bold_rgxmatch(string _mk) {
- auto _rgxtxt = (_mk.empty)
- ? `=NULL`
- : `(` ~ _mk.dup ~ `)`;
- return (cast(char[]) (_rgxtxt));
- }
- auto bold_substitute_abstract() {
- return "*{$1}*";
- }
- auto bold_substitute_sisu_markup() {
- return "*{$1}*";
- }
- auto bold_substitute_html() {
- return "<b>$1</b>";
+ auto bold(string _mk) {
+ string[] _out;
+ if (_mk) {
+ _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "*{$1}*", "<b>$1</b>"];
+ }
+ return _out;
}
auto breaks(string _mk) {
return _mk;
@@ -50,20 +42,12 @@ struct confCompositeMakeBuild {
auto css(string _mk) {
return _mk;
}
- auto emphasis_rgxmatch(string _mk) {
- auto _rgxtxt = (_mk.empty)
- ? `=NULL`
- : `(` ~ _mk.dup ~ `)`;
- return (cast(char[]) (_rgxtxt));
- }
- auto emphasis_substitute_abstract() {
- return "!{$1}!";
- }
- auto emphasis_substitute_sisu_markup() {
- return "!{$1}!";
- }
- auto emphasis_substitute_html() {
- return "<em>$1</em>";
+ auto emphasis(string _mk) {
+ string[] _out;
+ if (_mk) {
+ _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "!{$1}!", "<em>$1</em>" ];
+ }
+ return _out;
}
auto footer(string _mk) {
return _mk;
@@ -77,20 +61,12 @@ struct confCompositeMakeBuild {
auto home_button_text(string _mk) {
return _mk;
}
- auto italics_rgxmatch(string _mk) {
- auto _rgxtxt = (_mk.empty)
- ? `=NULL`
- : `(` ~ _mk.dup ~ `)`;
- return (cast(char[]) (_rgxtxt));
- }
- auto italics_substitute_abstract() {
- return "/{$1}/";
- }
- auto italics_substitute_sisu_markup() {
- return "/{$1}/";
- }
- auto italics_substitute_html() {
- return "<i>$1</i>";
+ auto italics(string _mk) {
+ string[] _out;
+ if (_mk) {
+ _out = [ (cast(string) (`(` ~ _mk.dup ~ `)`)), "/{$1}/", "<i>$1</i>" ];
+ }
+ return _out;
}
auto num_top(string _mk) {
return _mk;
@@ -106,112 +82,103 @@ struct confCompositeMakeBuild {
}
}
struct ConfCompositeMakeInit {
- char[] bold_rgxmatch = `=NULL`.dup;
- auto bold_substitute_abstract = "*{$1}*";
- auto bold_substitute_sisu_markup = "*{$1}*";
- auto bold_substitute_html = "<b>$1</b>";
- string breaks = "";
- string cover_image = "";
- string css = "";
- char[] emphasis_rgxmatch = `=NULL`.dup;
- auto emphasis_substitute_abstract = "!{$1}!";
- auto emphasis_substitute_sisu_markup = "!{$1}!";
- auto emphasis_substitute_html = "<em>$1</em>";
- string footer = "";
+ string[] bold;
+ string breaks;
+ string cover_image;
+ string css;
+ string[] emphasis;
+ string footer;
string[] headings;
- string home_button_image = "";
- string home_button_text = "";
- char[] italics_rgxmatch = `=NULL`.dup;
- auto italics_substitute_abstract = "/{$1}/";
- auto italics_substitute_sisu_markup = "/{$1}/";
- auto italics_substitute_html = "<i>$1</i>";
- string num_top = "";
- string num_depth = "";
+ string home_button_image;
+ string home_button_text;
+ string[] italics;
+ string num_top;
+ string num_depth;
string[][] substitute;
- string texpdf_font = "";
+ string texpdf_font;
}
struct ConfCompositeSiteLocal {
- string webserv_url_root = "";
- string webserv_path = "";
- string webserv_images = "";
- string webserv_cgi = "";
- string webserv_cgi_host = "";
- string webserv_cgi_host_path = "";
- string webserv_cgi_port = "";
- string webserv_cgi_user = "";
- string webserv_cgi_file_links = "";
- string processing_path = "";
- string processing_dir = "";
- string processing_concord_max = "";
- string flag_act0 = "";
- string flag_act1 = "";
- string flag_act2 = "";
- string flag_act3 = "";
- string flag_act4 = "";
- string flag_act5 = "";
- string flag_act6 = "";
- string flag_act7 = "";
- string flag_act8 = "";
- string flag_act9 = "";
- string default_papersize = "";
- string default_text_wrap = "";
- string default_emphasis = "";
- string default_language = "";
- string default_digest = "";
- string permission_share_source = "";
- string search_flag = "";
- string search_action = "";
- string search_db = "";
- string search_title = "";
+ string webserv_url_root;
+ string webserv_path;
+ string webserv_images;
+ string webserv_cgi;
+ string webserv_cgi_host;
+ string webserv_cgi_host_path;
+ string webserv_cgi_port;
+ string webserv_cgi_user;
+ string webserv_cgi_file_links;
+ string processing_path;
+ string processing_dir;
+ string processing_concord_max;
+ string flag_act0;
+ string flag_act1;
+ string flag_act2;
+ string flag_act3;
+ string flag_act4;
+ string flag_act5;
+ string flag_act6;
+ string flag_act7;
+ string flag_act8;
+ string flag_act9;
+ string default_papersize;
+ string default_text_wrap;
+ string default_emphasis;
+ string default_language;
+ string default_digest;
+ string permission_share_source;
+ string search_flag;
+ string search_action;
+ string search_db;
+ string search_title;
}
struct MetaComposite {
- string classify_dewey = "";
- string classify_keywords = "";
- string classify_loc = "";
- string classify_subject = "";
- string classify_topic_register = "";
- string creator_author = "";
- string creator_author_email = "";
- string creator_illustrator = "";
- string creator_translator = "";
- string date_added_to_site = "";
- string date_available = "";
- string date_created = "";
- string date_issued = "";
- string date_modified = "";
- string date_published = "";
- string date_valid = "";
- string identifier_isbn = "";
- string identifier_oclc = "";
- string identifier_pg = "";
- string language_document = "";
- string language_document_char = "";
- string links = "";
- string notes_abstract = "";
- string notes_description = "";
- string original_language = "";
- string original_language_char = "";
- string original_publisher = "";
- string original_source = "";
- string original_title = "";
- string publisher = "";
- string rights_copyright = "";
- string rights_copyright_audio = "";
- string rights_copyright_cover = "";
- string rights_copyright_illustrations = "";
- string rights_copyright_photographs = "";
- string rights_copyright_text = "";
- string rights_copyright_translation = "";
- string rights_copyright_video = "";
- string rights_license = "";
- string title_edition = "";
- string title_full = "";
- string title_language = "";
- string title_main = "";
- string title_note = "";
- string title_short = "";
- string title_sub = "";
- string title_subtitle = "";
+ string classify_dewey;
+ string classify_keywords;
+ string classify_loc;
+ string classify_subject;
+ string classify_topic_register;
+ string creator_author;
+ string creator_author_email;
+ string creator_illustrator;
+ string creator_translator;
+ string date_added_to_site;
+ string date_available;
+ string date_created;
+ string date_issued;
+ string date_modified;
+ string date_published;
+ string date_valid;
+ string identifier_isbn;
+ string identifier_oclc;
+ string identifier_pg;
+ string language_document;
+ string language_document_char;
+ string links;
+ string notes_abstract;
+ string notes_description;
+ string original_language;
+ string original_language_char;
+ string original_publisher;
+ string original_source;
+ string original_title;
+ string publisher;
+ string rights_copyright;
+ string rights_copyright_audio;
+ string rights_copyright_cover;
+ string rights_copyright_illustrations;
+ string rights_copyright_photographs;
+ string rights_copyright_text;
+ string rights_copyright_translation;
+ string rights_copyright_video;
+ string rights_license;
+ string title_edition;
+ string title_full;
+ string title_language;
+ string title_main;
+ string title_note;
+ string title_short;
+ string title_sub;
+ string title_subtitle;
}
struct ConfComposite {
MetaComposite meta;
diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d
index 54bedfe..627b37a 100644
--- a/src/sdp/meta/metadoc_from_src.d
+++ b/src/sdp/meta/metadoc_from_src.d
@@ -358,6 +358,7 @@ template SiSUdocAbstraction() {
string[] html_segnames=["toc"];
int cnt1 = 1; int cnt2 = 1; int cnt3 = 1;
/+ abstraction init ↑ +/
+ enum Substitute { match, markup, }
debug (substitutions) {
writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:");
if (!(conf_make_meta.make.headings.empty)) {
@@ -365,21 +366,21 @@ template SiSUdocAbstraction() {
}
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
- writeln("regex to match: ", substitution_pair[0]);
- writeln("substitution to make: ", substitution_pair[1]);
+ writeln("regex to match: ", substitution_pair[Substitute.match]);
+ writeln("substitution to make: ", substitution_pair[Substitute.markup]);
}
}
- if (!(conf_make_meta.make.bold_rgxmatch == "=NULL" || conf_make_meta.make.bold_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.bold_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.bold_substitute_html);
+ if (conf_make_meta.make.bold) {
+ writeln("regex to match: ", conf_make_meta.make.bold[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.bold[Substitute.markup]);
}
- if (!(conf_make_meta.make.emphasis_rgxmatch == "=NULL" || conf_make_meta.make.emphasis_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.emphasis_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.emphasis_substitute_html);
+ if (conf_make_meta.make.emphasis) {
+ writeln("regex to match: ", conf_make_meta.make.emphasis[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.emphasis[Substitute.markup]);
}
- if (!(conf_make_meta.make.italics_rgxmatch == "=NULL" || conf_make_meta.make.italics_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.italics_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.italics_substitute_html);
+ if (conf_make_meta.make.italics) {
+ writeln("regex to match: ", conf_make_meta.make.italics[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.italics[Substitute.markup]);
}
}
/+ ↓ loop markup document/text line by line +/
@@ -626,12 +627,14 @@ template SiSUdocAbstraction() {
continue;
} else if (obj_type_status["quote"] == TriState.on) {
/+ within block object: quote +/
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_quote_block_(line, an_object, obj_type_status);
continue;
/+ within block object: group +/
} else if (obj_type_status["group"] == TriState.on) {
/+ 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)
.replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
@@ -639,6 +642,7 @@ template SiSUdocAbstraction() {
continue;
} else if (obj_type_status["block"] == TriState.on) {
/+ within block object: block +/
+ 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)
@@ -673,7 +677,6 @@ template SiSUdocAbstraction() {
processing.remove("verse");
obj_cite_number_poem["start"] = obj_cite_digits.on.to!string;
}
- line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_start_block_(line, obj_type_status, obj_cite_number_poem);
continue;
} else if (!line.empty) {
@@ -751,10 +754,12 @@ template SiSUdocAbstraction() {
+/
if (line.matchFirst(rgx.heading)) {
/+ heading match +/
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
_heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta);
} else if (line_occur["para"] == State.off) {
/+ para match +/
an_object_key="body_nugget";
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
}
@@ -770,6 +775,7 @@ template SiSUdocAbstraction() {
debug(para) {
writeln(an_object_key, "-> ", line);
}
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
an_object[an_object_key] ~= " " ~ line;
++line_occur["para"];
@@ -1955,11 +1961,12 @@ template SiSUdocAbstraction() {
debug(asserts) {
static assert(is(typeof(line) == char[]));
}
+ enum Substitute { match, markup, }
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
line = line.replaceAll(
- regex(substitution_pair[0]),
- substitution_pair[1]
+ regex(substitution_pair[Substitute.match]),
+ substitution_pair[Substitute.markup]
);
}
}
@@ -1972,31 +1979,23 @@ template SiSUdocAbstraction() {
debug(asserts) {
static assert(is(typeof(line) == char[]));
}
- if (!(
- conf_make_meta.make.bold_rgxmatch == "=NULL"
- || conf_make_meta.make.bold_rgxmatch.empty
- )) {
+ enum Substitute { match, markup, }
+ if ( conf_make_meta.make.bold) {
line = line.replaceAll(
- regex(conf_make_meta.make.bold_rgxmatch),
- conf_make_meta.make.bold_substitute_sisu_markup
+ regex(conf_make_meta.make.bold[Substitute.match]),
+ conf_make_meta.make.bold[Substitute.markup]
);
}
- if (!(
- conf_make_meta.make.emphasis_rgxmatch == "=NULL"
- || conf_make_meta.make.emphasis_rgxmatch.empty
- )) {
+ if (conf_make_meta.make.emphasis) {
line = line.replaceAll(
- regex(conf_make_meta.make.emphasis_rgxmatch),
- conf_make_meta.make.emphasis_substitute_sisu_markup
+ regex(conf_make_meta.make.emphasis[Substitute.match]),
+ conf_make_meta.make.emphasis[Substitute.markup]
);
}
- if (!(
- conf_make_meta.make.italics_rgxmatch == "=NULL"
- || conf_make_meta.make.italics_rgxmatch.empty
- )) {
+ if (conf_make_meta.make.italics) {
line = line.replaceAll(
- regex(conf_make_meta.make.italics_rgxmatch),
- conf_make_meta.make.italics_substitute_sisu_markup
+ regex(conf_make_meta.make.italics[Substitute.match]),
+ conf_make_meta.make.italics[Substitute.markup]
);
}
return line;