aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/source_sisupod.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/source_sisupod.d')
-rw-r--r--src/sdp/source_sisupod.d103
1 files changed, 58 insertions, 45 deletions
diff --git a/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d
index cf15348..9b48ddb 100644
--- a/src/sdp/source_sisupod.d
+++ b/src/sdp/source_sisupod.d
@@ -25,60 +25,70 @@ template SiSUpod() {
create_zip_file,
defaults,
output_rgx,
- output_xhtmls;
+ output_xhtmls,
+ paths_output;
void SiSUpod(T)(T doc_matters) {
debug(asserts) {
// static assert(is(typeof(doc_matters) == tuple));
}
mixin SiSUoutputRgxInit;
- mixin SiSUpaths;
- auto pth_sisupod = SiSUpodPathsZipped();
- auto pth_sisupod_filesystem = SiSUpodPathsFilesystemArchive();
+ string pwd = doc_matters.environment["pwd"];
+ auto src_path_info = doc_matters.src_path_info;
+ string lng = doc_matters.language;
+ auto pth_sisudoc_src = doc_matters.src_path_info;
+ auto pth_sisupod = SiSUpathsSisupodZipped!()(src_path_info, lng);
+ auto pth_sisupod_filesystem = SiSUpathsSisupodFileSystem!()(src_path_info, lng);
mixin SiSUlanguageCodes;
auto lang = Lang();
auto rgx = Rgx();
assert (doc_matters.source_filename.match(rgx.src_fn));
try {
/+ create directory structure +/
- if (!exists(pth_sisupod_filesystem.doc(doc_matters.source_filename))) {
- pth_sisupod_filesystem.doc(doc_matters.source_filename).mkdirRecurse;
- }
- if (!exists(pth_sisupod_filesystem.conf(doc_matters.source_filename))) {
- pth_sisupod_filesystem.conf(doc_matters.source_filename).mkdirRecurse;
- }
- if (!exists(pth_sisupod_filesystem.css(doc_matters.source_filename))) {
- pth_sisupod_filesystem.css(doc_matters.source_filename).mkdirRecurse;
- }
- if (!exists(pth_sisupod_filesystem.image(doc_matters.source_filename))) {
- pth_sisupod_filesystem.image(doc_matters.source_filename).mkdirRecurse;
- }
- if (!exists(pth_sisupod_filesystem.doc_lng(doc_matters.source_filename, doc_matters.language))) {
- pth_sisupod_filesystem.doc_lng(doc_matters.source_filename, doc_matters.language).mkdirRecurse;
+ if (doc_matters.opt_action_bool["source"]) {
+ if (!exists(pth_sisupod_filesystem.text_root(doc_matters.source_filename))) {
+ pth_sisupod_filesystem.text_root(doc_matters.source_filename).mkdirRecurse;
+ }
+ if (!exists(pth_sisupod_filesystem.conf_root(doc_matters.source_filename))) {
+ pth_sisupod_filesystem.conf_root(doc_matters.source_filename).mkdirRecurse;
+ }
+ if (!exists(pth_sisupod_filesystem.media_root(doc_matters.source_filename))) {
+ pth_sisupod_filesystem.media_root(doc_matters.source_filename).mkdirRecurse;
+ }
+ if (!exists(pth_sisupod_filesystem.css(doc_matters.source_filename))) {
+ pth_sisupod_filesystem.css(doc_matters.source_filename).mkdirRecurse;
+ }
+ if (!exists(pth_sisupod_filesystem.image_root(doc_matters.source_filename))) {
+ pth_sisupod_filesystem.image_root(doc_matters.source_filename).mkdirRecurse;
+ }
+ if (!exists(pth_sisupod_filesystem.doc_lng(doc_matters.source_filename))) {
+ pth_sisupod_filesystem.doc_lng(doc_matters.source_filename).mkdirRecurse;
+ }
}
debug(sisupod) {
writeln(__LINE__, ": ",
doc_matters.source_filename, " -> ",
pth_sisupod_filesystem.fn_doc(
doc_matters.source_filename,
- doc_matters.language
));
}
- auto zip = new ZipArchive();
+ auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
auto fn_sisupod = pth_sisupod.sisupod_filename(doc_matters.source_filename);
{ /+ bundle images +/
foreach (image; doc_matters.image_list) {
debug(sisupodimages) {
writeln(
- "_sisu/image/", image, " -> ",
- pth_sisupod.image(doc_matters.source_filename), "/", image
+ pth_sisudoc_src.image_root.to!string, "/", image, " -> ",
+ pth_sisupod.image_root(doc_matters.source_filename), "/", image
);
}
- auto fn_src = "_sisu/image/"~ image;
- auto fn_out = pth_sisupod.image(doc_matters.source_filename).to!string ~ "/" ~ image;
- auto fn_out_filesystem = pth_sisupod_filesystem.image(doc_matters.source_filename).to!string ~ "/" ~ image;
+ auto fn_src = pth_sisudoc_src.image_root.to!string ~ "/" ~ image;
+ auto fn_out = pth_sisupod.image_root(doc_matters.source_filename).to!string ~ "/" ~ image;
+ auto fn_out_filesystem = pth_sisupod_filesystem.image_root(doc_matters.source_filename).to!string ~ "/" ~ image;
if (exists(fn_src)) {
- fn_src.copy(fn_out_filesystem);
- {
+ if (doc_matters.opt_action_bool["source"]) {
+ fn_src.copy(fn_out_filesystem);
+ }
+ if (doc_matters.opt_action_bool["sisupod"]) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_out;
auto zip_data = new OutBuffer();
@@ -91,12 +101,14 @@ template SiSUpod() {
}
}
{ /+ bundle sisu_document_make +/
- auto fn_src = "_sisu/sisu_document_make"; // check (_sisu/sisu_document_make)
- auto fn_out = pth_sisupod.conf(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make";
- auto fn_out_filesystem = pth_sisupod_filesystem.conf(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src = pth_sisudoc_src.conf_root.to!string ~ "/" ~ "sisu_document_make"; // check (_sisu/sisu_document_make)
+ auto fn_out = pth_sisupod.conf_root(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make";
+ auto fn_out_filesystem = pth_sisupod_filesystem.conf_root(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make";
if (exists(fn_src)) {
- fn_src.copy(fn_out_filesystem);
- {
+ if (doc_matters.opt_action_bool["source"]) {
+ fn_src.copy(fn_out_filesystem);
+ }
+ if (doc_matters.opt_action_bool["sisupod"]) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_out;
auto zip_data = new OutBuffer();
@@ -109,11 +121,13 @@ template SiSUpod() {
}
{ /+ bundle primary file +/
auto fn_src = doc_matters.source_filename;
- auto fn_out = pth_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).to!string;
- auto fn_out_filesystem = pth_sisupod_filesystem.fn_doc(doc_matters.source_filename, doc_matters.language).to!string;
+ auto fn_out = pth_sisupod.fn_doc(doc_matters.source_filename).to!string;
+ auto fn_out_filesystem = pth_sisupod_filesystem.fn_doc(doc_matters.source_filename).to!string;
if (exists(fn_src)) {
- fn_src.copy(fn_out_filesystem);
- {
+ if (doc_matters.opt_action_bool["source"]) {
+ fn_src.copy(fn_out_filesystem);
+ }
+ if (doc_matters.opt_action_bool["sisupod"]) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_out;
auto zip_data = new OutBuffer();
@@ -133,23 +147,22 @@ template SiSUpod() {
pth_sisupod.fn_doc_insert(
doc_matters.source_filename,
insert_file,
- doc_matters.language
));
}
auto fn_src = insert_file;
auto fn_out = pth_sisupod.fn_doc_insert(
doc_matters.source_filename,
insert_file,
- doc_matters.language
).to!string;
auto fn_out_filesystem = pth_sisupod_filesystem.fn_doc_insert(
doc_matters.source_filename,
insert_file,
- doc_matters.language
).to!string;
if (exists(fn_src)) {
- fn_src.copy(fn_out_filesystem);
- {
+ if (doc_matters.opt_action_bool["source"]) {
+ fn_src.copy(fn_out_filesystem);
+ }
+ if (doc_matters.opt_action_bool["sisupod"]) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = insert_file;
auto zip_data = new OutBuffer();
@@ -178,20 +191,20 @@ template SiSUpod() {
catch (ZipException ex) {
// Handle errors
}
- if (doc_matters.source_filename == "en/the_wealth_of_networks.yochai_benkler.sst") {
+ if (doc_matters.source_filename == "sisudoc/text/en/the_wealth_of_networks.yochai_benkler.sst") {
assert(
((data).sha256Of).toHexString
- == "DDE0013C13C6A4F06D4BE72087E2CDEF47697CA38A6A2D65BA7207DB6B144271",
+ == "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E",
"\nsisupod: sha256 value for "
~ doc_matters.source_filename
~ " has changed, is now: "
~ ((data).sha256Of).toHexString
);
}
- if (doc_matters.source_filename == "en/sisu_markup_stress_test.sst") {
+ if (doc_matters.source_filename == "sisudoc/text/en/sisu_markup_stress_test.sst") {
assert(
((data).sha256Of).toHexString
- == "112C0AEDD2518A1803D91A7CF5785274A3116C0779A631782D0C0813B212C68A",
+ == "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91",
"\nsisupod: sha256 value for "
~ doc_matters.source_filename
~ " has changed, is now: "