aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-05-23 18:32:32 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:15 -0400
commit9c07f0aac1f5d7a7480667dca53671fcd986db5a (patch)
treefffc45bd35a0b80461b80378ed0028b5afea346a
parentimageformats dependency added (diff)
image paths
-rw-r--r--org/default_paths.org38
-rw-r--r--org/output_sisupod.org2
-rw-r--r--org/output_xmls.org6
-rw-r--r--org/sdp.org1
-rw-r--r--src/sdp/output/epub3.d4
-rw-r--r--src/sdp/output/html.d2
-rw-r--r--src/sdp/output/paths_source.d38
-rw-r--r--src/sdp/output/source_sisupod.d2
-rwxr-xr-xsrc/sdp/sdp.d1
9 files changed, 44 insertions, 50 deletions
diff --git a/org/default_paths.org b/org/default_paths.org
index 5c0dba4..16dcfaf 100644
--- a/org/default_paths.org
+++ b/org/default_paths.org
@@ -348,8 +348,24 @@ template PathMatters() {
return _dir;
}
auto image_dir_path() {
- string _dir = asNormalizedPath(base_dir_path.chainPath("media/image")).array;
- return _dir;
+ string _img_pth(string _possible_img_pth) {
+ return asNormalizedPath(file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).array;
+ }
+ string _paths;
+ string[] _possible_img_pths = [ "./image", "../image", "../../image" ];
+ string _img_pth_found = "";
+ foreach(_possible_img_pth; _possible_img_pths) {
+ if (exists(_img_pth(_possible_img_pth))) {
+ _img_pth_found = _img_pth(_possible_img_pth);
+ break;
+ } else {
+ _paths ~= " " ~ _img_pth(_possible_img_pth);
+ }
+ }
+ if (_img_pth_found.empty) {
+ writeln("WARNING not image path found, searched: ", _paths);
+ }
+ return _img_pth_found;
}
auto conf_dir_path() {
auto _dir = asNormalizedPath(base_dir_path.chainPath("conf")).array;
@@ -631,24 +647,6 @@ template SiSUpathsSRC() {
auto doc_src_with_path() {
return asNormalizedPath(pwd.chainPath(_fn_src_and_path)).array;
}
- auto src_image_root_with_path() {
- string[] _possible_img_pth = [
- asNormalizedPath(pwd.chainPath((_fn_src_and_path).dirName ~ "/image")).array,
- asNormalizedPath(pwd.chainPath((_fn_src_and_path).dirName ~ "/../image")).array,
- asNormalizedPath(pwd.chainPath((_fn_src_and_path).dirName ~ "/../../image")).array,
- ];
- string _img_pth_found = "";
- foreach(_img_pth; _possible_img_pth) {
- if (exists(_img_pth)) {
- _img_pth_found = _img_pth;
- break;
- }
- }
- if (_img_pth_found.empty) {
- writeln("WARNING not image path found, searched: ", _possible_img_pth);
- }
- return _img_pth_found;
- }
}
return SisuSrcPaths();
}
diff --git a/org/output_sisupod.org b/org/output_sisupod.org
index 46e23e7..2876dc7 100644
--- a/org/output_sisupod.org
+++ b/org/output_sisupod.org
@@ -121,7 +121,7 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod;
pths_sisupod.image_root(doc_matters.src.filename).zpod, "/", image
);
}
- auto fn_src_in = doc_matters.src_path_info.src_image_root_with_path ~ "/" ~ image;
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
auto fn_src_out_sisupod_zip_base
= pths_sisupod.image_root(doc_matters.src.filename).zpod.to!string
~ "/" ~ image;
diff --git a/org/output_xmls.org b/org/output_xmls.org
index 18f5a61..ec2e5d8 100644
--- a/org/output_xmls.org
+++ b/org/output_xmls.org
@@ -1838,7 +1838,7 @@ void images_cp(M)(
pth_html.image.mkdirRecurse;
}
foreach (image; doc_matters.srcs.image_list) {
- auto fn_src_in = doc_matters.src_path_info.src_image_root_with_path ~ "/" ~ image;
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
auto fn_src_out = pth_html.image ~ "/" ~ image;
debug(images_html) {
writeln(fn_src_in, " -> ", fn_src_out);
@@ -2653,12 +2653,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
debug(epub_output) {
debug(epub_images) {
writeln(
- doc_matters.src_path_info.src_image_root_with_path, "/", image, " -> ",
+ doc_matters.src.image_dir_path, "/", image, " -> ",
pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
);
}
}
- auto fn_src = doc_matters.src_path_info.src_image_root_with_path ~ "/" ~ image;
+ auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
auto fn_out = pth_epub3.doc_oebps_image(doc_matters.src.filename.to!string) ~ "/" ~ image;
if (exists(fn_src)) {
{
diff --git a/org/sdp.org b/org/sdp.org
index 006b01f..0f75c66 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -80,7 +80,6 @@ homepage "http://sisudoc.org"
void main(string[] args) {
<<sdp_mixin>>
<<sdp_args>>
- <<sdp_env>>
<<sdp_do_selected>>
if (_manifests.length > 1) { // _manifests[0] initialized dummy element
foreach(manifest; _manifests[1..$]) {
diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d
index eb55593..3209fae 100644
--- a/src/sdp/output/epub3.d
+++ b/src/sdp/output/epub3.d
@@ -723,12 +723,12 @@ template outputEPub3() {
debug(epub_output) {
debug(epub_images) {
writeln(
- doc_matters.src_path_info.src_image_root_with_path, "/", image, " -> ",
+ doc_matters.src.image_dir_path, "/", image, " -> ",
pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
);
}
}
- auto fn_src = doc_matters.src_path_info.src_image_root_with_path ~ "/" ~ image;
+ auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
auto fn_out = pth_epub3.doc_oebps_image(doc_matters.src.filename.to!string) ~ "/" ~ image;
if (exists(fn_src)) {
{
diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d
index 3db534b..d4770e7 100644
--- a/src/sdp/output/html.d
+++ b/src/sdp/output/html.d
@@ -465,7 +465,7 @@ template outputHTML() {
pth_html.image.mkdirRecurse;
}
foreach (image; doc_matters.srcs.image_list) {
- auto fn_src_in = doc_matters.src_path_info.src_image_root_with_path ~ "/" ~ image;
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
auto fn_src_out = pth_html.image ~ "/" ~ image;
debug(images_html) {
writeln(fn_src_in, " -> ", fn_src_out);
diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d
index 9f377bc..8f14b8e 100644
--- a/src/sdp/output/paths_source.d
+++ b/src/sdp/output/paths_source.d
@@ -295,8 +295,24 @@ template PathMatters() {
return _dir;
}
auto image_dir_path() {
- string _dir = asNormalizedPath(base_dir_path.chainPath("media/image")).array;
- return _dir;
+ string _img_pth(string _possible_img_pth) {
+ return asNormalizedPath(file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).array;
+ }
+ string _paths;
+ string[] _possible_img_pths = [ "./image", "../image", "../../image" ];
+ string _img_pth_found = "";
+ foreach(_possible_img_pth; _possible_img_pths) {
+ if (exists(_img_pth(_possible_img_pth))) {
+ _img_pth_found = _img_pth(_possible_img_pth);
+ break;
+ } else {
+ _paths ~= " " ~ _img_pth(_possible_img_pth);
+ }
+ }
+ if (_img_pth_found.empty) {
+ writeln("WARNING not image path found, searched: ", _paths);
+ }
+ return _img_pth_found;
}
auto conf_dir_path() {
auto _dir = asNormalizedPath(base_dir_path.chainPath("conf")).array;
@@ -520,24 +536,6 @@ template SiSUpathsSRC() {
auto doc_src_with_path() {
return asNormalizedPath(pwd.chainPath(_fn_src_and_path)).array;
}
- auto src_image_root_with_path() {
- string[] _possible_img_pth = [
- asNormalizedPath(pwd.chainPath((_fn_src_and_path).dirName ~ "/image")).array,
- asNormalizedPath(pwd.chainPath((_fn_src_and_path).dirName ~ "/../image")).array,
- asNormalizedPath(pwd.chainPath((_fn_src_and_path).dirName ~ "/../../image")).array,
- ];
- string _img_pth_found = "";
- foreach(_img_pth; _possible_img_pth) {
- if (exists(_img_pth)) {
- _img_pth_found = _img_pth;
- break;
- }
- }
- if (_img_pth_found.empty) {
- writeln("WARNING not image path found, searched: ", _possible_img_pth);
- }
- return _img_pth_found;
- }
}
return SisuSrcPaths();
}
diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d
index a92d087..97077de 100644
--- a/src/sdp/output/source_sisupod.d
+++ b/src/sdp/output/source_sisupod.d
@@ -65,7 +65,7 @@ template SiSUpod() {
pths_sisupod.image_root(doc_matters.src.filename).zpod, "/", image
);
}
- auto fn_src_in = doc_matters.src_path_info.src_image_root_with_path ~ "/" ~ image;
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
auto fn_src_out_sisupod_zip_base
= pths_sisupod.image_root(doc_matters.src.filename).zpod.to!string
~ "/" ~ image;
diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d
index e5d73c0..c5ee70a 100755
--- a/src/sdp/sdp.d
+++ b/src/sdp/sdp.d
@@ -336,7 +336,6 @@ void main(string[] args) {
arg_unrecognized ~= " " ~ arg;
}
}
-
if (!(_opt_action.skip_output)) {
debug(steps) {
writeln("step0 commence → (without processing files)");