diff options
Diffstat (limited to 'org')
-rw-r--r-- | org/compile_time_info.org | 2 | ||||
-rw-r--r-- | org/default_misc.org | 3 | ||||
-rw-r--r-- | org/default_paths.org | 71 | ||||
-rw-r--r-- | org/default_regex.org | 3 | ||||
-rw-r--r-- | org/imports.org | 2 | ||||
-rw-r--r-- | org/meta_abstraction.org | 2 | ||||
-rw-r--r-- | org/meta_debugs.org | 2 | ||||
-rw-r--r-- | org/meta_read_source_files.org | 13 | ||||
-rw-r--r-- | org/output_hub.org | 2 | ||||
-rw-r--r-- | org/output_sisupod.org | 48 | ||||
-rw-r--r-- | org/output_sqlite.org | 32 | ||||
-rw-r--r-- | org/output_sqlite_discrete.org | 32 | ||||
-rw-r--r-- | org/output_xmls.org | 16 | ||||
-rw-r--r-- | org/output_xmls_css.org | 2 | ||||
-rw-r--r-- | org/output_zip.org | 2 | ||||
-rw-r--r-- | org/sdp.org | 316 |
16 files changed, 268 insertions, 280 deletions
diff --git a/org/compile_time_info.org b/org/compile_time_info.org index 25f3740..281bfe1 100644 --- a/org/compile_time_info.org +++ b/org/compile_time_info.org @@ -105,3 +105,5 @@ version(D_LP64) { enum bits = "32 bit"; } #+END_SRC + +* __END__ diff --git a/org/default_misc.org b/org/default_misc.org index bbf1477..9129db2 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -709,7 +709,8 @@ template SiSUlanguageCodes() { } #+END_SRC -* +set colors for terminal+ (unused) :colors:terminal: +* __END__ +** +set colors for terminal+ (unused) :colors:terminal: #+name: meta_ansi_colors #+BEGIN_SRC d diff --git a/org/default_paths.org b/org/default_paths.org index 369e71b..5334a78 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -55,19 +55,30 @@ template PodManifest() { } auto pod_manifest_path() { string _manifest_path; - if (isValidPath(_pth) && _pth.isDir - && ((_pth.chainPath(pod_manifest_filename).array).isFile)) { + if ((isValidPath(_pth) && exists(_pth)!=0 && _pth.isDir) + && (exists(_pth.chainPath(pod_manifest_filename).array)!=0 + && (_pth.chainPath(pod_manifest_filename).array).isFile)) { _manifest_path = _pth; } else if (_pth.match(rgx.src_pth_contents) - && (_pth.isFile)) { + && exists(_pth)!=0 && _pth.isDir && (_pth.isFile)) { _manifest_path = dirName(_pth); - // } else { // _manifest_path = ""; + } else { + _manifest_path = _pth; // _manifest_path = null; } return _manifest_path; } - auto pod_manifest_file_with_path() { - string _manifest_path_and_file = pod_manifest_path.chainPath(pod_manifest_filename).array; - return _manifest_path_and_file; + string pod_manifest_file_with_path() { + string _k; + if (exists(pod_manifest_path.chainPath(pod_manifest_filename).array)!=0) { + _k = pod_manifest_path.chainPath(pod_manifest_filename).array; + } else if (exists(pod_manifest_path)!=0) { + _k = pod_manifest_path; + } + if (exists(_k)==0) { + writeln("ERROR >> Processing Skipped! Manifest not found: ", _k); + _k = null; + } + return _k; } } return ManifestFile_(); @@ -176,6 +187,9 @@ template PathMatters() { } return _k; } + auto language() { + return lng(); + } auto file_with_absolute_path() { string _pth = _env["pwd"].chainPath(path_and_fn).array; return _pth; @@ -190,13 +204,15 @@ template PathMatters() { auto m = (absolute_path_to_src) .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) ) { - _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; assert(_dir == m.captures["dir"]); } else { - _dir = asAbsolutePath(path_and_fn.chainPath("../../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../../")).array; assert(_dir == absolute_path_to_src.match(rgx.src_base_parent_dir_name).captures["dir"]); } - writeln("--> ", _dir); + if ((_opt_actions.debug_do)) { + writeln("--> (base_dir) ", _dir); + } return _dir; } auto base_parent_dir_path() { @@ -205,35 +221,42 @@ template PathMatters() { auto m = (absolute_path_to_src) .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) ) { - _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; } else { - _dir = asAbsolutePath(path_and_fn.chainPath("../../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../../")).array; } return _dir; } auto base_dir_path() { // looks like there is work to do string _dir; - if ( // TODO this should catch generated --source sisupod, untested, needs manifest + if ( auto m = (absolute_path_to_src) - .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) + .match(rgx.src_formalised_file_path_parts) + ) { + _dir = asNormalizedPath(m.captures["pth"]).array; + } else if ( // TODO this should catch generated --source sisupod, untested, needs manifest + auto m = (absolute_path_to_src) + .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) ) { - _dir = asAbsolutePath(path_and_fn.chainPath("../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../")).array; } else { - _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; + } + if ((_opt_actions.debug_do)) { + writeln("--> (base_dir_path) ", _dir); } - writeln("--> ", _dir); return _dir; } auto media_dir_path() { // TODO rework, can base directly on src fn path - auto _dir = asAbsolutePath(base_dir_path.chainPath("media")).array; + string _dir = asNormalizedPath(base_dir_path.chainPath("media")).array; return _dir; } auto image_dir_path() { - auto _dir = asAbsolutePath(base_dir_path.chainPath("media/image")).array; + string _dir = asNormalizedPath(base_dir_path.chainPath("media/image")).array; return _dir; } auto conf_dir_path() { - auto _dir = asAbsolutePath(base_dir_path.chainPath("conf")).array; + auto _dir = asNormalizedPath(base_dir_path.chainPath("conf")).array; return _dir; } auto base_parent_dir() { @@ -246,7 +269,9 @@ template PathMatters() { } else { _dir = (absolute_path_to_src).match(rgx.src_base_parent_dir_name).captures["dir"]; } - writeln("--> ", _dir); + if ((_opt_actions.debug_do)) { + writeln("--> (base_parent_dir) ", _dir); + } return _dir; } auto config_dirs() { // TODO @@ -1011,7 +1036,7 @@ template SiSUpathsSQLite() { return fn_src.baseName.stripExtension; } string base() { - return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array; } string seg(string fn_src) { return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; @@ -1024,3 +1049,5 @@ template SiSUpathsSQLite() { } } #+END_SRC + +* __END__ diff --git a/org/default_regex.org b/org/default_regex.org index 57c442b..1ad8ee5 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -427,6 +427,7 @@ static src_fn_insert = ctRegex!(`^(?P<path>[a-z static src_fn_find_inserts = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure +static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalized dir structure #+END_SRC ** inline markup @@ -501,3 +502,5 @@ static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"- static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); #+END_SRC + +* __END__ diff --git a/org/imports.org b/org/imports.org index 3fd71a2..64bc4c3 100644 --- a/org/imports.org +++ b/org/imports.org @@ -78,3 +78,5 @@ public import sdp.output.paths_output, sdp.output.rgx; #+END_SRC + +* __END__ diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 9f451e6..b1464b5 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -7197,3 +7197,5 @@ struct TheObjects { ObjGenericComposite[] oca; } #+END_SRC + +* __END__ diff --git a/org/meta_debugs.org b/org/meta_debugs.org index f623076..d11b64b 100644 --- a/org/meta_debugs.org +++ b/org/meta_debugs.org @@ -873,3 +873,5 @@ debug(checkdoc) { } } #+END_SRC + +* __END__ diff --git a/org/meta_read_source_files.org b/org/meta_read_source_files.org index a3a59a5..3bf02b1 100644 --- a/org/meta_read_source_files.org +++ b/org/meta_read_source_files.org @@ -53,8 +53,8 @@ static template configInSite() { auto possible_config_path_locations = conf_file_details.possible_config_path_locations.local_site; string config_file_str; debug(io) { - writeln("in config filename: ", conf_sdl); - writeln("in config possible path locations: ", possible_config_path_locations); + writeln("WARNING (io debug) in config filename: ", conf_sdl); + writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).array; @@ -64,7 +64,7 @@ static template configInSite() { try { if (exists(conf_file)) { debug(io) { - writeln("in config file found: ", conf_file); + writeln("WARNING (io debug) in config file found: ", conf_file); } config_file_str = conf_file.readText; break; @@ -90,8 +90,8 @@ static template configInDoc() { auto possible_config_path_locations = conf_file_details.possible_config_path_locations.document; string config_file_str; debug(io) { - writeln("in config filename: ", conf_sdl); - writeln("in config possible path locations: ", possible_config_path_locations); + writeln("WARNING (io debug) in config filename: ", conf_sdl); + writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).array; @@ -101,7 +101,7 @@ static template configInDoc() { try { if (exists(conf_file)) { debug(io) { - writeln("in config file found: ", conf_file); + writeln("WARNING (io debug) in config file found: ", conf_file); } config_file_str = conf_file.readText; break; @@ -667,3 +667,4 @@ auto t = tuple( return t; #+END_SRC +* __END__ diff --git a/org/output_hub.org b/org/output_hub.org index b147cd6..3c44e7d 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -246,3 +246,5 @@ if (doc_matters.opt.action.postgresql) { writeln("pgsql processing"); } #+END_SRC + +* __END__ diff --git a/org/output_sisupod.org b/org/output_sisupod.org index 1031456..82e654b 100644 --- a/org/output_sisupod.org +++ b/org/output_sisupod.org @@ -62,8 +62,8 @@ debug(asserts) { } mixin SiSUoutputRgxInit; 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 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(); @@ -113,14 +113,17 @@ debug(sisupod) { auto zip = new ZipArchive(); auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; { /+ bundle images +/ - foreach (image; doc_matters.src.image_list) { + foreach (image; doc_matters.srcs.image_list) { debug(sisupodimages) { writeln( pth_sisudoc_src.image_root.to!string, "/", 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_in = ((doc_matters.src.is_pod) + ? doc_matters.src.image_dir_path + : pth_sisudoc_src.image_root).to!string + ~ "/" ~ image; auto fn_src_out_sisupod_zip_base = pths_sisupod.image_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ image; @@ -129,7 +132,7 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; ~ "/" ~ image; if (exists(fn_src_in)) { debug(io) { - writeln("src out found: ", fn_src_in); + writeln("WARNING (io debug) src out found: ", fn_src_in); } if (doc_matters.opt.action.source) { fn_src_in.copy(fn_src_out_filesystem); @@ -144,13 +147,15 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; } } else { if (doc_matters.opt.action.verbose) { - writeln("src out NOT found (image): ", fn_src_in); + writeln("WARNING (io) 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_in = ((doc_matters.src.is_pod) + ? doc_matters.src.conf_dir_path + : pth_sisudoc_src.conf_root).to!string + ~ "/" ~ "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 @@ -158,7 +163,7 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; ~ "/" ~ "sisu_document_make"; // TODO if (exists(fn_src_in)) { debug(io) { - writeln("src out found: ", fn_src_in); + writeln("WARNING (io debug) src out found: ", fn_src_in); } if (doc_matters.opt.action.source) { fn_src_in.copy(fn_src_out_filesystem); @@ -172,8 +177,9 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; zip.addMember(zip_arc_member_file); } } else { - if (doc_matters.opt.action.verbose) { - writeln("src out NOT found (document make): ", fn_src_in); + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.debug_do) { + writeln("WARNING (io) src out NOT found (document make): ", fn_src_in); } } } { /+ TODO bundle primary file +/ @@ -188,7 +194,7 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; string[] filelist_src_zpod_arr; if (exists(fn_src_in)) { debug(io) { - writeln("src out found: ", fn_src_in); + writeln("WARNING (io debug) 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; @@ -209,13 +215,14 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; zip.addMember(zip_arc_member_file); } } else { - if (doc_matters.opt.action.verbose) { - writeln("src out NOT found (markup source): ", fn_src_in); + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.debug_do) { + writeln("WARNING (io) src out NOT found (markup source): ", fn_src_in); } } } { /+ bundle insert files +/ - if (doc_matters.src.file_insert_list.length > 0) { - foreach (insert_file; doc_matters.src.file_insert_list) { + if (doc_matters.srcs.file_insert_list.length > 0) { + foreach (insert_file; doc_matters.srcs.file_insert_list) { debug(sisupod) { writeln( insert_file, " -> ", @@ -241,7 +248,7 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; ).filesystem_open_zpod.to!string; if (exists(fn_src_in)) { debug(io) { - writeln("src out found: ", fn_src_in); + writeln("WARNING (io debug) src out found: ", fn_src_in); } if (doc_matters.opt.action.source) { fn_src_in.copy(fn_src_out_filesystem); @@ -256,8 +263,9 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod; createZipFile!()(fn_sisupod, zip.build()); } } else { - if (doc_matters.opt.action.verbose) { - writeln("src out NOT found (insert file): ", fn_src_in); + if (doc_matters.opt.action.verbose + || doc_matters.opt.action.debug_do) { + writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in); } } } @@ -318,3 +326,5 @@ if (exists(fn_sisupod)) { } } #+END_SRC + +* __END__ diff --git a/org/output_sqlite.org b/org/output_sqlite.org index 08e4b8d..710e9df 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -467,6 +467,7 @@ auto html_table(O)( #+name: sqlite_db_initialize #+BEGIN_SRC d auto pth_sqlite = SiSUpathsSQLite!()(doc_matters.output_path, doc_matters.src.language); +pth_sqlite.base.mkdirRecurse; auto db = Database(pth_sqlite.sqlite_file(doc_matters.env.pwd.baseName)); // auto db = Database(":memory:"); // open database in memory if (doc_matters.opt.action.sqlite_create) { @@ -917,7 +918,10 @@ insert_metadata.bind(":rights_license", doc_matters.conf_make // insert_metadata.bind(":links", doc_matters.conf_make_meta.meta.links); insert_metadata.execute(); insert_metadata.reset(); /+ watch +/ -writeln("sql statement executed"); +writeln(" ", pth_sqlite.sqlite_file(doc_matters.env.pwd.baseName)); +if ((doc_matters.opt.action.verbose)) { + writeln("sql statement executed"); +} assert(db.totalChanges == 1); #+END_SRC @@ -1425,17 +1429,19 @@ foreach (part; doc_parts) { break; } if (obj.is_a == "heading") { - writeln( - "markup: ", obj.heading_lev_markup, - "> ", obj.dom_markedup, - "; collapsed: ", obj.heading_lev_collapsed, - "> ", obj.dom_collapsed, - "; ocn: ", obj.ocn, - " node: ", obj.node, - "; parent: ", obj.parent_lev_markup, - "; ocn: ", obj.parent_ocn, - "; ", - ); + if ((doc_matters.opt.action.verbose)) { + writeln( + "markup: ", obj.heading_lev_markup, + "> ", obj.dom_markedup, + "; collapsed: ", obj.heading_lev_collapsed, + "> ", obj.dom_collapsed, + "; ocn: ", obj.ocn, + " node: ", obj.node, + "; parent: ", obj.parent_lev_markup, + "; ocn: ", obj.parent_ocn, + "; ", + ); + } } insert_doc_objects.bind(":t_of", obj.is_of); insert_doc_objects.bind(":t_is", obj.is_a); @@ -1467,3 +1473,5 @@ foreach (part; doc_parts) { } } #+END_SRC + +* __END__ diff --git a/org/output_sqlite_discrete.org b/org/output_sqlite_discrete.org index abcb5b3..ecf8033 100644 --- a/org/output_sqlite_discrete.org +++ b/org/output_sqlite_discrete.org @@ -467,6 +467,7 @@ auto html_table(O)( #+name: sqlite_db_initialize #+BEGIN_SRC d auto pth_sqlite = SiSUpathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); +pth_sqlite.base.mkdirRecurse; auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename)); // auto db = Database(":memory:"); // open database in memory db.run(" @@ -885,7 +886,10 @@ insert_metadata.bind(":rights_license", doc_matters.conf_make // insert_metadata.bind(":links", doc_matters.conf_make_meta.meta.links); insert_metadata.execute(); insert_metadata.reset(); /+ watch +/ -writeln("sql statement executed"); +writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename)); +if ((doc_matters.opt.action.verbose)) { + writeln("sql statement executed"); +} assert(db.totalChanges == 1); #+END_SRC @@ -1393,17 +1397,19 @@ foreach (part; doc_parts) { break; } if (obj.is_a == "heading") { - writeln( - "markup: ", obj.heading_lev_markup, - "> ", obj.dom_markedup, - "; collapsed: ", obj.heading_lev_collapsed, - "> ", obj.dom_collapsed, - "; ocn: ", obj.ocn, - " node: ", obj.node, - "; parent: ", obj.parent_lev_markup, - "; ocn: ", obj.parent_ocn, - "; ", - ); + if ((doc_matters.opt.action.verbose)) { + writeln( + "markup: ", obj.heading_lev_markup, + "> ", obj.dom_markedup, + "; collapsed: ", obj.heading_lev_collapsed, + "> ", obj.dom_collapsed, + "; ocn: ", obj.ocn, + " node: ", obj.node, + "; parent: ", obj.parent_lev_markup, + "; ocn: ", obj.parent_ocn, + "; ", + ); + } } insert_doc_objects.bind(":t_of", obj.is_of); insert_doc_objects.bind(":t_is", obj.is_a); @@ -1435,3 +1441,5 @@ foreach (part; doc_parts) { } } #+END_SRC + +* __END__ diff --git a/org/output_xmls.org b/org/output_xmls.org index 19f8552..4a0babb 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -1918,7 +1918,7 @@ string epub3_oebps_content(D,I,P)(D doc_abstraction, I doc_matters, P parts) { content ~= parts["manifest_documents"]; // TODO sort jpg & png content ~= " " ~ "<!-- Images -->" ~ "\n "; - foreach (image; doc_matters.src.image_list) { + foreach (image; doc_matters.srcs.image_list) { content ~= format(q"¶ <item id="%s" href="%s/%s" media-type="image/%s" /> ¶", image.baseName.stripExtension, @@ -2575,24 +2575,24 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( createZipFile!()(fn_epub, zip.build()); } { /+ OEBPS/_sisu/image (images) +/ - foreach (image; doc_matters.src.image_list) { + foreach (image; doc_matters.srcs.image_list) { debug(epub_output) { - if (exists(doc_matters.src.path_info.image_root ~ "/" ~ image)) { - (doc_matters.src.path_info.image_root ~ "/" ~ image) + if (exists(doc_matters.src_path_info.image_root ~ "/" ~ image)) { + (doc_matters.src_path_info.image_root ~ "/" ~ image) .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image); } } } - foreach (image; doc_matters.src.image_list) { + foreach (image; doc_matters.srcs.image_list) { debug(epub_output) { debug(epub_images) { writeln( - doc_matters.src.path_info.image_root, image, " -> ", + doc_matters.src_path_info.image_root, image, " -> ", pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image ); } } - auto fn_src = doc_matters.src.path_info.image_root ~ image; + auto fn_src = doc_matters.src_path_info.image_root ~ image; auto fn_out = pth_epub3.doc_oebps_image(doc_matters.src.filename).to!string ~ "/" ~ image; if (exists(fn_src)) { { @@ -2649,3 +2649,5 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( } } #+END_SRC + +* __END__ diff --git a/org/output_xmls_css.org b/org/output_xmls_css.org index 16423fc..bd76e4d 100644 --- a/org/output_xmls_css.org +++ b/org/output_xmls_css.org @@ -1273,3 +1273,5 @@ Consider what if anything should be used here #+name: css_epub #+BEGIN_SRC css #+END_SRC + +* __END__ diff --git a/org/output_zip.org b/org/output_zip.org index 1da1704..d392b38 100644 --- a/org/output_zip.org +++ b/org/output_zip.org @@ -37,3 +37,5 @@ template createZipFile() { } } #+END_SRC + +* __END__ diff --git a/org/sdp.org b/org/sdp.org index 799f4ec..d277ec0 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -59,12 +59,12 @@ version (Posix) { ** 0. sdp src/sdp :template: +- process files (act according to requirements of each type) + - by sourcefilename + - by sourcefiles contents identifier + - by zip filename + #+BEGIN_SRC d :tangle ../src/sdp/sdp.d :shebang #!/usr/bin/env rdmd -/+ - sdp: sisu document parser - a SiSU document parser writen in D - see http://sisudoc.org. -+/ module sdp.sisu_document_parser; import sdp.conf.compile_time_info, @@ -72,7 +72,11 @@ import <<imports_sdp>> <<mixin_sdp_version>> <<mixin_pre_main>> -/++ A SiSU document parser writen in D. +/ +/++ +name "sdp" +description "A SiSU inspired document parser writen in D." +homepage "http://sisudoc.org" ++/ void main(string[] args) { <<sdp_mixin>> <<sdp_args>> @@ -82,7 +86,7 @@ void main(string[] args) { foreach(manifest; _manifests[1..$]) { if (!empty(manifest.src.filename)) { <<sdp_each_file_do_scope>> - <<sdp_abstraction>> + <<sdp_each_file_do_abstraction>> <<sdp_each_file_do_debugs_checkdoc>> <<sdp_each_file_do_selected_output>> <<sdp_each_file_do_scope_exit>> @@ -93,11 +97,6 @@ void main(string[] args) { } } unittest { - /++ - name "sdp" - description "A SiSU document parser writen in D." - homepage "http://sisudoc.org" - +/ } #+END_SRC @@ -134,9 +133,9 @@ import ├── src │ ├── sdp.d │ └── sdp -│ ├── metadoc_from_src.d -│ ├── ... -│ └── compile_time_info.d +│ ├── conf +│ ├── meta +│ └── output └── views └── version.txt @@ -150,6 +149,7 @@ import [[./sdp.org][sdp]] keep up to date, configuration in ../maker.org + check: - http://github.com/Abscissa/SDLang-D - https://github.com/abscissa/libInputVisitor @@ -326,158 +326,121 @@ if (helpInfo.helpWanted) { #+BEGIN_SRC d struct OptActions { auto assertions() { - auto _k = opts["assertions"]; - return _k; + return opts["assertions"]; } auto concordance() { - auto _k = opts["concordance"]; - return _k; + return opts["concordance"]; } auto debug_do() { - auto _k = opts["debug"]; - return _k; + return opts["debug"]; } auto digest() { - auto _k = opts["digest"]; - return _k; + return opts["digest"]; } auto docbook() { - auto _k = opts["docbook"]; - return _k; + return opts["docbook"]; } auto epub() { - auto _k = opts["epub"]; - return _k; + return opts["epub"]; } auto html() { - auto _k = opts["html"]; - return _k; + return opts["html"]; } auto html_seg() { - auto _k = opts["html-seg"]; - return _k; + return opts["html-seg"]; } auto html_scroll() { - auto _k = opts["html-scroll"]; - return _k; + return opts["html-scroll"]; } auto manifest() { - auto _k = opts["manifest"]; - return _k; + return opts["manifest"]; } auto ocn() { - auto _k = opts["ocn"]; - return _k; + return opts["ocn"]; } auto odt() { - auto _k = opts["odt"]; - return _k; + return opts["odt"]; } auto pdf() { - auto _k = opts["pdf"]; - return _k; + return opts["pdf"]; } auto postgresql() { - auto _k = opts["postgresql"]; - return _k; + return opts["postgresql"]; } auto qrcode() { - auto _k = opts["qrcode"]; - return _k; + return opts["qrcode"]; } auto sisupod() { - auto _k = opts["sisupod"]; - return _k; + return opts["sisupod"]; } auto source() { - auto _k = opts["source"]; - return _k; + return opts["source"]; } auto sqlite_discrete() { - auto _k = opts["sqlite-discrete"]; - return _k; + return opts["sqlite-discrete"]; } auto sqlite_update() { - auto _k = opts["sqlite-update"]; - return _k; + return opts["sqlite-update"]; } auto sqlite_create() { - auto _k = opts["sqlite-create"]; - return _k; + return opts["sqlite-create"]; } auto sqlite_drop() { - auto _k = opts["sqlite-drop"]; - return _k; + return opts["sqlite-drop"]; } auto text() { - auto _k = opts["text"]; - return _k; + return opts["text"]; } auto verbose() { - auto _k = opts["verbose"]; - return _k; + return opts["verbose"]; } auto xhtml() { - auto _k = opts["xhtml"]; - return _k; + return opts["xhtml"]; } auto xml_dom() { - auto _k = opts["xml-dom"]; - return _k; + return opts["xml-dom"]; } auto xml_sax() { - auto _k = opts["xml-sax"]; - return _k; + return opts["xml-sax"]; } auto section_toc() { - auto _k = opts["section_toc"]; - return _k; + return opts["section_toc"]; } auto section_body() { - auto _k = opts["section_body"]; - return _k; + return opts["section_body"]; } auto section_endnotes() { - auto _k = opts["section_endnotes"]; - return _k; + return opts["section_endnotes"]; } auto section_glossary() { - auto _k = opts["section_glossary"]; - return _k; + return opts["section_glossary"]; } auto section_biblio() { - auto _k = opts["section_biblio"]; - return _k; + return opts["section_biblio"]; } auto section_bookindex() { - auto _k = opts["section_bookindex"]; - return _k; + return opts["section_bookindex"]; } auto section_blurb() { - auto _k = opts["section_blurb"]; - return _k; + return opts["section_blurb"]; } auto backmatter() { - auto _k = opts["backmatter"]; - return _k; + return opts["backmatter"]; } auto skip_output() { - auto _k = opts["skip-output"]; - return _k; + return opts["skip-output"]; } auto languages_set() { - auto _k = settings["lang"].split(","); - return _k; + return settings["lang"].split(","); } auto output_dir_set() { - auto _k = settings["output-dir"]; - return _k; + return settings["output-dir"]; } } auto _opt_action = OptActions(); #+END_SRC -***** getopt processing path, _manifest[] >> +***** getopt processing path, _manifest[] >> #+NAME: sdp_args #+BEGIN_SRC d @@ -504,24 +467,28 @@ foreach(arg; args[1..$]) { "file not found: «" ~ sisudoc_txt_ ~ "»" ); - try { - if (exists(sisudoc_txt_)) { - contents_location_raw_ = sisudoc_txt_.readText; + if (exists(sisudoc_txt_)) { + try { + if (exists(sisudoc_txt_)) { + contents_location_raw_ = sisudoc_txt_.readText; + } } - } - catch (ErrnoException ex) { - } - catch (FileException ex) { - // Handle errors - } - if (contents_location_raw_.match(rgx.pod_content_location)) { // (file name followed by language codes \n)+ - foreach (m; contents_location_raw_.matchAll(rgx.pod_content_location)) { - foreach (n; m.captures[2].matchAll(rgx.language_codes)) { - contents_location_ ~= "media/text/" ~ n.captures[1].to!string ~ "/" ~ m.captures[1].to!string ~ "\n"; + catch (ErrnoException ex) { + } + catch (FileException ex) { + // Handle errors + } + if (contents_location_raw_.match(rgx.pod_content_location)) { // (file name followed by language codes \n)+ + foreach (m; contents_location_raw_.matchAll(rgx.pod_content_location)) { + foreach (n; m.captures[2].matchAll(rgx.language_codes)) { + contents_location_ ~= "media/text/" ~ n.captures[1].to!string ~ "/" ~ m.captures[1].to!string ~ "\n"; + } } + } else { + contents_location_ = contents_location_raw_; } - } else { // (file name with path \n)+ - contents_location_ = contents_location_raw_; + } else { + writeln("manifest not found: ", sisudoc_txt_); } auto contents_locations_arr = (cast(char[]) contents_location_).split; @@ -542,7 +509,11 @@ foreach(arg; args[1..$]) { } } } else if (arg.match(rgx.src_pth_sst_or_ssm)) { - _manifests ~= PathMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing + if (exists(arg)==0) { + writeln("ERROR >> Processing Skipped! File not found: ", arg); + } else { + _manifests ~= PathMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing + } } else if (arg.match(rgx.src_pth_zip)) { // fns_src ~= arg; // gather input markup source file names for processing } else { // anything remaining, unused @@ -564,11 +535,17 @@ auto conf_files_composite_make = confFilesSDLtoStruct!()(sdl_root_config_documen #+NAME: sdp_do_selected #+BEGIN_SRC d if (!(_opt_action.skip_output)) { + debug(steps) { + writeln("step0 commence → (without processing files)"); + } outputHubOp!()(_opt_action); + debug(steps) { + writeln("- step0 complete"); + } } #+END_SRC -** _2b. processing: loop each file_ [+2] :loop:files: +** _2b. processing: (loop each file)_ [+2] :loop:files: *** scope (loop) :scope: #+NAME: sdp_each_file_do_scope @@ -604,7 +581,7 @@ enforce( - doc_abstraction (the document) - doc_matters -#+NAME: sdp_abstraction +#+NAME: sdp_each_file_do_abstraction #+BEGIN_SRC d auto t = SiSUabstraction!()(_env, _opt_action, manifest); static assert(!isTypeTuple!(t)); @@ -644,7 +621,13 @@ if ((doc_matters.opt.action.debug_do) #+BEGIN_SRC d /+ ↓ output hub +/ if (!(doc_matters.opt.action.skip_output)) { + debug(steps) { + writeln("step5 commence → (process outputs)"); + } outputHub!()(doc_abstraction, doc_matters); + debug(steps) { + writeln("- step5 complete"); + } } #+END_SRC @@ -700,7 +683,7 @@ template SiSUabstraction() { } #+END_SRC -** 1. raw file content split, doc: _header_, _content_ +(lists: subdocs? images?) >> +** 1. raw file content split, doc: _header_, _content_ +(lists: subdocs? images?) >> - [[./meta_read_source_files.org][meta_read_source_files]] - read in the _marked up source document_ and @@ -731,8 +714,7 @@ if build source pod requested all information needed to build it available at th /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ debug(steps) { - writeln(__LINE__, ":", __FILE__, - ": step1 commence → (get document header & body & insert file list & if needed image list)" + writeln("step1 commence → (get document header & body & insert file list & if needed image list)" ); } auto _header_body_insertfilelist_imagelist @@ -740,7 +722,7 @@ auto _header_body_insertfilelist_imagelist static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist)); static assert(_header_body_insertfilelist_imagelist.length==4); debug(steps) { - writeln(__LINE__, ":", __FILE__, ": step1 complete"); + writeln("- step1 complete"); } debug(header_and_body) { writeln(header); @@ -766,21 +748,19 @@ debug(header_and_body) { #+BEGIN_SRC d /+ ↓ split header into make and meta +/ debug(steps) { - writeln(__LINE__, ":", __FILE__, - ": step2 commence → (doc header: make & meta as struct)" - ); + writeln("step2 commence → (read document header - toml or sdlang, return struct)"); } auto _make_and_meta_struct = docHeaderMakeAndMetaTupExtractAndConvertToStruct!()( conf_files_composite_make, _header_body_insertfilelist_imagelist[headBody.header] - ); // breakage ... + ); debug(steps) { - writeln(__LINE__, ":", __FILE__, ": step2 complete"); + writeln("- step2 complete"); } #+END_SRC -** 3. _document abstraction, tuple_ (output-pre-processing) >> +** 3. _document abstraction, tuple_ (output-pre-processing) >> - [[./meta_abstraction.org][meta_abstraction]] - prepare the document abstraction used in downstream processing @@ -798,7 +778,7 @@ debug(steps) { #+BEGIN_SRC d /+ ↓ document abstraction: process document, return abstraction as tuple +/ debug(steps) { - writeln(__LINE__, ":", __FILE__, ": step3 commence → (document abstraction (da); da keys; segnames; doc_matters)"); + writeln("step3 commence → (document abstraction (da); da keys; segnames; doc_matters)"); } auto da = SiSUdocAbstraction!()( _header_body_insertfilelist_imagelist[headBody.body_content], @@ -813,11 +793,11 @@ string[] _doc_html_segnames = da[docAbst.segnames]; string[] _doc_epub_segnames_0_4 = da[docAbst.segnames_0_4]; auto _images = da[docAbst.images]; debug(steps) { - writeln(__LINE__, ":", __FILE__, ": step3 complete"); + writeln("- step3 complete"); } #+END_SRC -** 4. _document matters_ (doc info gathered, various sources) >> +** 4. _document matters_ (doc info gathered, various sources) >> - prepare document_matters, miscellany about processing and the document of use in downstream processing @@ -825,12 +805,11 @@ debug(steps) { #+NAME: sdp_each_file_do_document_matters #+BEGIN_SRC d debug(steps) { - writeln(__LINE__, ":", __FILE__, ": step4 commence → (doc_matters)"); + writeln("step4 commence → (doc_matters)"); } struct DocumentMatters { auto conf_make_meta() { // TODO meld with all make instructions - auto _k = _make_and_meta_struct; - return _k; + return _make_and_meta_struct; } auto env() { struct Env_ { @@ -856,51 +835,15 @@ struct DocumentMatters { return Opt_(); } auto src() { + return _manifest.src; + } + auto src_path_info() { + return SiSUpathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path + } + auto srcs() { struct SRC_ { - auto is_pod() { - return _manifest.src.is_pod; - } - auto filename() { - return _manifest.src.filename; - } - auto language() { - return _manifest.src.lng; - } - auto path_info() { - auto _k = SiSUpathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path - return _k; - } - auto file_with_absolute_path() { - auto _k = _manifest.src.file_with_absolute_path; - return _k; - } - auto absolute_path_to_src() { - auto _k = _manifest.src.absolute_path_to_src; - return _k; - } - auto base_dir() { - auto _k = _manifest.src.base_dir; - return _k; - } - auto base_parent_dir_path() { - auto _k = _manifest.src.base_parent_dir_path; - return _k; - } - auto base_dir_path() { - auto _k = _manifest.src.base_dir_path; - return _k; - } - auto media_dir_path() { - auto _k = _manifest.src.media_dir_path; - return _k; - } - auto base_parent_dir() { - auto _k = _manifest.src.base_parent_dir; - return _k; - } auto file_insert_list() { - string[] _k = _header_body_insertfilelist_imagelist[headBody.insert_file_list]; - return _k; + return _header_body_insertfilelist_imagelist[headBody.insert_file_list]; } auto image_list() { return _images; @@ -909,48 +852,19 @@ struct DocumentMatters { return SRC_(); } auto pod() { - struct Pod_ { - auto src_is_pod() { - return _manifest.pod.src_is_pod; - } - auto manifest_list_of_filenames() { - return _manifest.pod.manifest_list_of_filenames; - } - auto manifest_list_of_languages() { - return _manifest.pod.manifest_list_of_languages; - } - auto manifest_filename() { - return _manifest.pod.manifest_filename; - } - auto manifest_path() { - return _manifest.pod.manifest_path; - } - auto manifest_file_with_path() { - return _manifest.pod.manifest_file_with_path; - } - auto config_dirs() { - return _manifest.pod.config_dirs; - } - auto image_dirs() { - return _manifest.pod.image_dirs; - } - } - return Pod_(); + return _manifest.pod; } auto xml() { struct XML_ { auto keys_seq() { /+ contains .seg & .scroll sequences +/ - auto _k = _document_section_keys_sequenced; - return _k; + return _document_section_keys_sequenced; } string[] segnames() { - string[] _k = _doc_html_segnames; - return _k; + return _doc_html_segnames; } string[] segnames_lv_0_to_4() { - string[] _k = _doc_epub_segnames_0_4; - return _k; + return _doc_epub_segnames_0_4; } } return XML_(); @@ -961,7 +875,7 @@ struct DocumentMatters { } auto doc_matters = DocumentMatters(); debug(steps) { - writeln(__LINE__, ":", __FILE__, ": step4 complete"); + writeln("- step4 complete"); } #+END_SRC |