aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/sdp.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-01-25 17:13:52 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit524baa6ddd5f9cb49b1c5b015fbd6ef75ff72968 (patch)
treec66713d8559aa04f15f95825a6f5faec16827ce6 /src/sdp/sdp.d
parent0.23.3 work on source & target file paths/locations (diff)
paths, further adjustmentsdoc-reform_v0.0.23
Diffstat (limited to 'src/sdp/sdp.d')
-rwxr-xr-xsrc/sdp/sdp.d179
1 files changed, 78 insertions, 101 deletions
diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d
index 4e43a67..b0e75e6 100755
--- a/src/sdp/sdp.d
+++ b/src/sdp/sdp.d
@@ -1,9 +1,4 @@
#!/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,
@@ -30,7 +25,11 @@ import
sdp.output.paths_source;
mixin(import("version.txt"));
mixin CompileTimeInfo;
-/++ 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) {
mixin SiSUrgxInit;
mixin SiSUregisters;
@@ -149,152 +148,115 @@ void main(string[] args) {
}
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();
@@ -321,24 +283,28 @@ void main(string[] args) {
"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;
@@ -359,7 +325,11 @@ void main(string[] args) {
}
}
} 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
@@ -368,7 +338,13 @@ void main(string[] args) {
}
if (!(_opt_action.skip_output)) {
+ debug(steps) {
+ writeln("step0 commence → (without processing files)");
+ }
outputHubOp!()(_opt_action);
+ debug(steps) {
+ writeln("- step0 complete");
+ }
}
if (_manifests.length > 1) { // _manifests[0] initialized dummy element
foreach(manifest; _manifests[1..$]) {
@@ -413,7 +389,13 @@ void main(string[] args) {
}
/+ ↓ 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");
+ }
}
scope(exit) {
debug(checkdoc) {
@@ -433,9 +415,4 @@ void main(string[] args) {
}
}
unittest {
- /++
- name "sdp"
- description "A SiSU document parser writen in D."
- homepage "http://sisudoc.org"
- +/
}