aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/output_sisupod.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/output_sisupod.org')
-rw-r--r--org/output_sisupod.org160
1 files changed, 100 insertions, 60 deletions
diff --git a/org/output_sisupod.org b/org/output_sisupod.org
index 8e6aeb7..1031456 100644
--- a/org/output_sisupod.org
+++ b/org/output_sisupod.org
@@ -61,14 +61,14 @@ debug(asserts) {
// static assert(is(typeof(doc_matters) == tuple));
}
mixin SiSUoutputRgxInit;
-string pwd = doc_matters.environment.pwd;
-auto src_path_info = doc_matters.src_path_info;
-auto pth_sisudoc_src = doc_matters.src_path_info;
-auto pths_sisupod = SiSUpathsSisupods!()();
+string pwd = doc_matters.env.pwd;
+auto src_path_info = doc_matters.src.path_info;
+auto pth_sisudoc_src = doc_matters.src.path_info;
+auto pths_sisupod = SiSUpathsSisupods!()(doc_matters);
mixin SiSUlanguageCodes;
auto lang = Lang();
static auto rgx = Rgx();
-assert (doc_matters.source_filename.match(rgx.src_fn));
+assert (doc_matters.src.filename.match(rgx.src_fn));
#+END_SRC
#+name: source_sisupod_mkdirs
@@ -78,24 +78,24 @@ if (!exists(pths_sisupod.sisupod_dir_())) {
// used both by sisupod zipped (& sisupod filesystem (unzipped) which makes its own recursive dirs)
pths_sisupod.sisupod_dir_().mkdirRecurse;
}
-if (doc_matters.opt_action.source) {
- if (!exists(pths_sisupod.text_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.text_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+if (doc_matters.opt.action.source) {
+ if (!exists(pths_sisupod.text_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.text_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.conf_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.conf_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.media_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.media_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.media_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.media_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.css(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.css(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.css(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.image_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.image_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod)) {
- pths_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) {
+ pths_sisupod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse;
}
}
#+END_SRC
@@ -106,28 +106,35 @@ if (doc_matters.opt_action.source) {
#+BEGIN_SRC d
debug(sisupod) {
writeln(__LINE__, ": ",
- doc_matters.source_filename, " -> ",
- pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod
+ doc_matters.src.filename, " -> ",
+ pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod
);
}
auto zip = new ZipArchive();
-auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.source_filename).zpod;
+auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod;
{ /+ bundle images +/
- foreach (image; doc_matters.image_list) {
+ foreach (image; doc_matters.src.image_list) {
debug(sisupodimages) {
writeln(
pth_sisudoc_src.image_root.to!string, "/", image, " -> ",
- pths_sisupod.image_root(doc_matters.source_filename).zpod, "/", image
+ pths_sisupod.image_root(doc_matters.src.filename).zpod, "/", image
);
}
auto fn_src_in = pth_sisudoc_src.image_root.to!string ~ "/" ~ image;
- auto fn_src_out_sisupod_zip_base = pths_sisupod.image_root(doc_matters.source_filename).zpod.to!string ~ "/" ~ image;
- auto fn_src_out_filesystem = pths_sisupod.image_root(doc_matters.source_filename).filesystem_open_zpod.to!string ~ "/" ~ image;
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.image_root(doc_matters.src.filename).zpod.to!string
+ ~ "/" ~ image;
+ auto fn_src_out_filesystem
+ = pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ image;
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.source) {
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -135,17 +142,28 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.source_filename).zpo
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (image): ", fn_src_in);
+ }
}
}
} { /+ bundle sisu_document_make +/
- auto fn_src_in = pth_sisudoc_src.conf_root.to!string ~ "/" ~ "sisu_document_make"; // check (_sisu/sisu_document_make)
- auto fn_src_out_sisupod_zip_base = pths_sisupod.conf_root(doc_matters.source_filename).zpod.to!string ~ "/" ~ "sisu_document_make";
- auto fn_src_out_filesystem = pths_sisupod.conf_root(doc_matters.source_filename).filesystem_open_zpod.to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src_in
+ = pth_sisudoc_src.conf_root.to!string ~ "/" ~ "sisu_document_make"; // check (_sisu/sisu_document_make)
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src_out_filesystem
+ = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ "sisu_document_make"; // TODO
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.source) {
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -153,25 +171,36 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.source_filename).zpo
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (document make): ", fn_src_in);
+ }
}
} { /+ TODO bundle primary file +/
- auto fn_src_in = doc_matters.source_filename;
- auto fn_src_out_sisupod_zip_base = pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).zpod.to!string;
- auto fn_src_out_filesystem = pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod.to!string; // needed without root path:
- auto fn_src_out_inside_pod = pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).zpod.to!string; // needed without root path:
+ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path:
+ auto fn_src_out_inside_pod
+ = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path:
string[] filelist_src_out_sisupod_arr;
string[] filelist_src_zpod_arr;
if (exists(fn_src_in)) {
- filelist_src_out_sisupod_arr ~= fn_src_out_sisupod_zip_base;
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ filelist_src_out_sisupod_arr ~= fn_src_out_sisupod_zip_base;
filelist_src_zpod_arr ~= fn_src_out_inside_pod;
- if (doc_matters.opt_action.source) {
- auto filelist = File(pths_sisupod.fn_pod_filelist(doc_matters.source_filename).filesystem_open_zpod, "w");
+ if (doc_matters.opt.action.source) {
+ auto filelist
+ = File(pths_sisupod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w");
foreach (source_pth_and_fn; filelist_src_zpod_arr) {
filelist.writeln(source_pth_and_fn);
}
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -179,38 +208,45 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.source_filename).zpo
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (markup source): ", fn_src_in);
+ }
}
} { /+ bundle insert files +/
- if (doc_matters.file_insert_list.length > 0) {
- foreach (insert_file; doc_matters.file_insert_list) {
+ if (doc_matters.src.file_insert_list.length > 0) {
+ foreach (insert_file; doc_matters.src.file_insert_list) {
debug(sisupod) {
writeln(
insert_file, " -> ",
pths_sisupod.fn_doc_insert(
- doc_matters.source_filename,
+ doc_matters.src.filename,
insert_file,
- doc_matters.language,
+ doc_matters.src.language,
).zpod
);
}
auto fn_src_in = insert_file;
- auto fn_src_out_sisupod_zip_base =
- pths_sisupod.fn_doc_insert(
- doc_matters.source_filename,
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.fn_doc_insert(
+ doc_matters.src.filename,
insert_file,
- doc_matters.language,
+ doc_matters.src.language,
).zpod.to!string;
- auto fn_src_out_filesystem =
- pths_sisupod.fn_doc_insert(
- doc_matters.source_filename,
+ auto fn_src_out_filesystem
+ = pths_sisupod.fn_doc_insert(
+ doc_matters.src.filename,
insert_file,
- doc_matters.language,
+ doc_matters.src.language,
).filesystem_open_zpod.to!string;
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.source) {
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -219,13 +255,17 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.source_filename).zpo
zip.addMember(zip_arc_member_file);
createZipFile!()(fn_sisupod, zip.build());
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (insert file): ", fn_src_in);
+ }
}
}
}
} {
- auto fn_src_in = doc_matters.source_filename;
+ auto fn_src_in = doc_matters.src.filename;
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
createZipFile!()(fn_sisupod, zip.build());
}
}
@@ -251,22 +291,22 @@ if (exists(fn_sisupod)) {
catch (ZipException ex) {
// Handle errors
}
- if (doc_matters.source_filename == "sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") {
+ if (doc_matters.src.filename == "sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") {
assert(
((data).sha256Of).toHexString
== "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E",
"\nsisupod: sha256 value for "
- ~ doc_matters.source_filename
+ ~ doc_matters.src.filename
~ " has changed, is now: "
~ ((data).sha256Of).toHexString
);
}
- if (doc_matters.source_filename == "sisudoc/media/text/en/sisu_markup_stress_test.sst") {
+ if (doc_matters.src.filename == "sisudoc/media/text/en/sisu_markup_stress_test.sst") {
assert(
((data).sha256Of).toHexString
== "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91",
"\nsisupod: sha256 value for "
- ~ doc_matters.source_filename
+ ~ doc_matters.src.filename
~ " has changed, is now: "
~ ((data).sha256Of).toHexString
);