aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--org/default_regex.org1
-rw-r--r--org/meta_conf_make_meta.org16
-rw-r--r--src/doc_reform/meta/conf_make_meta_json.d11
-rw-r--r--src/doc_reform/meta/conf_make_meta_structs.d5
-rw-r--r--src/doc_reform/meta/rgx.d1
5 files changed, 18 insertions, 16 deletions
diff --git a/org/default_regex.org b/org/default_regex.org
index 6fbe87b..7f0c724 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -257,6 +257,7 @@ static note_ref = ctRegex!(`^\S+?noteref_(
#+name: meta_rgx
#+BEGIN_SRC d
+static webserv_url_doc_root = ctRegex!(`(?P<url>(?P<domain>https?:\/\/[^ /]+)\/(?P<path>\S*))`, "mg");
static smid_inline_url_generic = ctRegex!(`(?:^|[}(\[ ])(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_#]`, "mg");
static smid_inline_url = ctRegex!(`((?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_]\S*)`, "mg");
static smid_inline_link_naked_url = ctRegex!(`(?P<pre>^|[ ])(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤)\S+?)(?P<post>[.,;:?!'"]?(?:[ ]|$))`, "mg"); // issue with #link #32
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index fcae4bb..0a6074b 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -213,8 +213,9 @@ struct ConfCompositeMakeInit {
#+name: meta_defaults_template_structs
#+BEGIN_SRC d
struct ConfCompositeSiteLocal {
- string webserv_url_root;
- string webserv_path;
+ string webserv_url_doc_root;
+ string webserv_url_domain;
+ string webserv_url_doc_path;
string webserv_images;
string webserv_cgi;
string webserv_cgi_host;
@@ -651,12 +652,11 @@ if ("webserv" in _json.object) {
if ("url_root" in _json.object["webserv"]
&& (_json.object["webserv"]["url_root"].type().to!string == "STRING")
) {
- _struct_composite.conf.webserv_url_root = _json.object["webserv"]["url_root"].str;
- }
- if ("path" in _json.object["webserv"]
- && (_json.object["webserv"]["path"].type().to!string == "STRING")
- ) {
- _struct_composite.conf.webserv_path = _json.object["webserv"]["path"].str;
+ _struct_composite.conf.webserv_url_doc_root = _json.object["webserv"]["url_root"].str;
+ if (auto m = _struct_composite.conf.webserv_url_doc_root.match(_rgx.webserv_url_doc_root)) {
+ _struct_composite.conf.webserv_url_domain = m.captures[2].to!string;
+ _struct_composite.conf.webserv_url_doc_path = m.captures[3].to!string;
+ }
}
if ("images" in _json.object["webserv"]
&& (_json.object["webserv"]["images"].type().to!string == "STRING")
diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d
index 30aaedc..cf4c21a 100644
--- a/src/doc_reform/meta/conf_make_meta_json.d
+++ b/src/doc_reform/meta/conf_make_meta_json.d
@@ -211,12 +211,11 @@ static template contentJSONtoDocReformStruct() {
if ("url_root" in _json.object["webserv"]
&& (_json.object["webserv"]["url_root"].type().to!string == "STRING")
) {
- _struct_composite.conf.webserv_url_root = _json.object["webserv"]["url_root"].str;
- }
- if ("path" in _json.object["webserv"]
- && (_json.object["webserv"]["path"].type().to!string == "STRING")
- ) {
- _struct_composite.conf.webserv_path = _json.object["webserv"]["path"].str;
+ _struct_composite.conf.webserv_url_doc_root = _json.object["webserv"]["url_root"].str;
+ if (auto m = _struct_composite.conf.webserv_url_doc_root.match(_rgx.webserv_url_doc_root)) {
+ _struct_composite.conf.webserv_url_domain = m.captures[2].to!string;
+ _struct_composite.conf.webserv_url_doc_path = m.captures[3].to!string;
+ }
}
if ("images" in _json.object["webserv"]
&& (_json.object["webserv"]["images"].type().to!string == "STRING")
diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d
index a05acf7..7158f86 100644
--- a/src/doc_reform/meta/conf_make_meta_structs.d
+++ b/src/doc_reform/meta/conf_make_meta_structs.d
@@ -141,8 +141,9 @@ struct ConfCompositeMakeInit {
string texpdf_font;
}
struct ConfCompositeSiteLocal {
- string webserv_url_root;
- string webserv_path;
+ string webserv_url_doc_root;
+ string webserv_url_domain;
+ string webserv_url_doc_path;
string webserv_images;
string webserv_cgi;
string webserv_cgi_host;
diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d
index 39f2479..4657384 100644
--- a/src/doc_reform/meta/rgx.d
+++ b/src/doc_reform/meta/rgx.d
@@ -145,6 +145,7 @@ static template DocReformRgxInit() {
static inline_curly_delimiter_close_regular = ctRegex!(`\s*\}~`, "m");
static inline_text_and_note_curly = ctRegex!(`(?P<text>.+?)(?:(?:[~])[{][*+ ]*)(?P<note>.+?)(?:[}][~])`, "mg");
static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73
+ static webserv_url_doc_root = ctRegex!(`(?P<url>(?P<domain>https?:\/\/[^ /]+)\/(?P<path>\S*))`, "mg");
static smid_inline_url_generic = ctRegex!(`(?:^|[}(\[ ])(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_#]`, "mg");
static smid_inline_url = ctRegex!(`((?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)[a-zA-Z0-9_]\S*)`, "mg");
static smid_inline_link_naked_url = ctRegex!(`(?P<pre>^|[ ])(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤)\S+?)(?P<post>[.,;:?!'"]?(?:[ ]|$))`, "mg"); // issue with #link #32