diff options
Diffstat (limited to 'src/sdp')
-rw-r--r-- | src/sdp/ao/abstract_doc_source.d (renamed from src/sdp/ao_abstract_doc_source.d) | 27 | ||||
-rw-r--r-- | src/sdp/ao/abstraction.d (renamed from src/sdp/abstraction.d) | 20 | ||||
-rw-r--r-- | src/sdp/ao/abstraction_summary.d (renamed from src/sdp/abstraction_summary.d) | 24 | ||||
-rw-r--r-- | src/sdp/ao/conf_make_meta.d (renamed from src/sdp/ao_conf_make_meta.d) | 14 | ||||
-rw-r--r-- | src/sdp/ao/conf_make_meta_native.d (renamed from src/sdp/ao_conf_make_meta_native.d) | 10 | ||||
-rw-r--r-- | src/sdp/ao/conf_make_meta_sdlang.d (renamed from src/sdp/ao_conf_make_meta_sdlang.d) | 10 | ||||
-rw-r--r-- | src/sdp/ao/defaults.d (renamed from src/sdp/ao_defaults.d) | 4 | ||||
-rw-r--r-- | src/sdp/ao/doc_debugs.d (renamed from src/sdp/ao_doc_debugs.d) | 9 | ||||
-rw-r--r-- | src/sdp/ao/object_setter.d (renamed from src/sdp/ao_object_setter.d) | 2 | ||||
-rw-r--r-- | src/sdp/ao/package.d | 17 | ||||
-rw-r--r-- | src/sdp/ao/read_config_files.d (renamed from src/sdp/ao_read_config_files.d) | 57 | ||||
-rw-r--r-- | src/sdp/ao/read_source_files.d (renamed from src/sdp/ao_read_source_files.d) | 28 | ||||
-rw-r--r-- | src/sdp/ao/rgx.d (renamed from src/sdp/ao_rgx.d) | 4 | ||||
-rw-r--r-- | src/sdp/conf/compile_time_info.d (renamed from src/sdp/compile_time_info.d) | 2 | ||||
-rw-r--r-- | src/sdp/imports_for_ao.d | 41 | ||||
-rw-r--r-- | src/sdp/imports_for_output.d | 28 | ||||
-rw-r--r-- | src/sdp/output/create_zip_file.d (renamed from src/sdp/create_zip_file.d) | 2 | ||||
-rw-r--r-- | src/sdp/output/defaults.d (renamed from src/sdp/defaults.d) | 2 | ||||
-rw-r--r-- | src/sdp/output/epub3.d (renamed from src/sdp/output_epub3.d) | 30 | ||||
-rw-r--r-- | src/sdp/output/html.d (renamed from src/sdp/output_html.d) | 30 | ||||
-rw-r--r-- | src/sdp/output/hub.d (renamed from src/sdp/output_hub.d) | 29 | ||||
-rw-r--r-- | src/sdp/output/package.d | 20 | ||||
-rw-r--r-- | src/sdp/output/paths_output.d (renamed from src/sdp/paths_output.d) | 4 | ||||
-rw-r--r-- | src/sdp/output/paths_source.d (renamed from src/sdp/paths_source.d) | 4 | ||||
-rw-r--r-- | src/sdp/output/rgx.d (renamed from src/sdp/output_rgx.d) | 4 | ||||
-rw-r--r-- | src/sdp/output/source_sisupod.d (renamed from src/sdp/source_sisupod.d) | 28 | ||||
-rw-r--r-- | src/sdp/output/xmls.d (renamed from src/sdp/output_xmls.d) | 30 | ||||
-rw-r--r-- | src/sdp/output/xmls_css.d (renamed from src/sdp/output_xmls_css.d) | 2 | ||||
-rwxr-xr-x | src/sdp/sisu_d_parser.d | 221 |
29 files changed, 380 insertions, 323 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao/abstract_doc_source.d index ab7cc99..9fee954 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao/abstract_doc_source.d @@ -3,33 +3,20 @@ abstraction of sisu markup for downstream processing ao_abstract_doc_source.d +/ -module sdp.ao_abstract_doc_source; +module sdp.ao.abstract_doc_source; template SiSUdocAbstraction() { /+ ↓ abstraction imports +/ + import sdp.ao; import - sdp.ao_defaults, - sdp.ao_object_setter, - sdp.ao_rgx, - sdp.output_hub; - private import std.algorithm, - std.array, std.container, - std.exception, std.file, - std.getopt, std.json, - std.path, - std.process, - std.range, - std.regex, - std.stdio, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; + std.path; + import + sdp.ao.defaults, + sdp.ao.object_setter, + sdp.ao.rgx; /+ ↓ abstraction mixins +/ mixin ObjectSetter; mixin InternalMarkup; diff --git a/src/sdp/abstraction.d b/src/sdp/ao/abstraction.d index 351fd1f..17b1dff 100644 --- a/src/sdp/abstraction.d +++ b/src/sdp/ao/abstraction.d @@ -1,7 +1,23 @@ -module sdp.abstraction; +module sdp.ao.abstraction; template SiSUabstraction() { /+ sdp: sisu document parser, see http://sisudoc.org +/ - import sdp.imports_for_ao; + import sdp.ao; + import + std.getopt, + std.process; + import + sdp.ao.abstraction_summary, + sdp.ao.abstract_doc_source, + sdp.ao.conf_make_meta, + // sdp.ao.conf_make_meta_native, + sdp.ao.conf_make_meta_sdlang, + sdp.ao.defaults, + sdp.ao.doc_debugs, + sdp.ao.read_config_files, + sdp.ao.read_source_files, + sdp.ao.rgx, + sdp.output.hub, + sdp.output.paths_source; mixin SiSUrgxInit; diff --git a/src/sdp/abstraction_summary.d b/src/sdp/ao/abstraction_summary.d index 9532fc7..2cc6967 100644 --- a/src/sdp/abstraction_summary.d +++ b/src/sdp/ao/abstraction_summary.d @@ -1,12 +1,12 @@ -module sdp.abstraction_summary; +module sdp.ao.abstraction_summary; template SiSUabstractionSummary() { auto SiSUabstractionSummary(S,T)( auto return ref const S doc_abstraction, auto return ref T doc_matters, ) { import - sdp.ao_defaults, - sdp.ao_rgx; + sdp.ao.defaults, + sdp.ao.rgx; import std.array, std.exception, @@ -40,35 +40,35 @@ template SiSUabstractionSummary() { ? char_repeat_number : min_repeat_number; writefln( - "%s\n\"%s\", %s\n%s\n%s\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n(%s: %s)\n%s", + "%s\n\"%s\", %s\n%s\n%s\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n%30-s%10-d\n(%s: %s)\n%s", markup.repeat_character_by_number_provided("-", char_repeat_number), doc_matters.dochead_meta["title"]["full"], doc_matters.dochead_meta["creator"]["author"], doc_matters.source_filename, markup.repeat_character_by_number_provided("-", char_repeat_number), - "length toc arr: ", + "length toc arr:", to!int(doc_abstraction["toc_seg"].length), - "length doc_abstraction arr: ", + "length doc_abstraction arr:", to!int(doc_abstraction["body"].length), - "last obj_cite_number: ", + "last obj_cite_number:", to!int(check["last_obj_cite_number"]), - "length endnotes: ", + "length endnotes:", (doc_abstraction["endnotes"].length > 1) ? (to!int(doc_abstraction["endnotes"].length)) : 0, - "length glossary: ", + "length glossary:", (doc_abstraction["glossary"].length > 1) ? (to!int(doc_abstraction["glossary"].length)) : 0, - "length biblio: ", + "length biblio:", (doc_abstraction["bibliography"].length > 1) ? (to!int(doc_abstraction["bibliography"].length)) : 0, - "length bookindex: ", + "length bookindex:", (doc_abstraction["bookindex_seg"].length > 1) ? (to!int(doc_abstraction["bookindex_seg"].length)) : 0, - "length blurb: ", + "length blurb:", (doc_abstraction["blurb"].length > 1) ? (to!int(doc_abstraction["blurb"].length)) : 0, diff --git a/src/sdp/ao_conf_make_meta.d b/src/sdp/ao/conf_make_meta.d index 52cc98d..0f6d27d 100644 --- a/src/sdp/ao_conf_make_meta.d +++ b/src/sdp/ao/conf_make_meta.d @@ -8,9 +8,9 @@ converting the metadata and make instructions to a common json format used by program internally. Moved to associative array. +/ -module sdp.ao_conf_make_meta; +module sdp.ao.conf_make_meta; template SiSUheaderExtractHub() { - private import + import std.exception, std.regex, std.stdio, @@ -18,11 +18,11 @@ template SiSUheaderExtractHub() { std.typecons, std.utf, std.conv : to; - private import sdlang; - private import - sdp.ao_rgx, - sdp.ao_conf_make_meta_native, - sdp.ao_conf_make_meta_sdlang; + import sdlang; + import + sdp.ao.conf_make_meta_native, + sdp.ao.conf_make_meta_sdlang, + sdp.ao.rgx; mixin SiSUrgxInit; mixin SiSUheaderExtractNative; mixin SiSUheaderExtractSDLang; diff --git a/src/sdp/ao_conf_make_meta_native.d b/src/sdp/ao/conf_make_meta_native.d index 899b59f..8954c9a 100644 --- a/src/sdp/ao_conf_make_meta_native.d +++ b/src/sdp/ao/conf_make_meta_native.d @@ -2,9 +2,9 @@ native headers using<br>@title:<BR>:subtitle:<BR>type tags<BR> extract native/orig header return associative array +/ -module sdp.ao_conf_make_meta_native; +module sdp.ao.conf_make_meta_native; template SiSUheaderExtractNative() { - private import + import std.exception, std.regex, std.stdio, @@ -13,9 +13,9 @@ template SiSUheaderExtractNative() { std.typecons, std.utf, std.conv : to; - private import - sdp.ao_rgx, - sdp.ao_defaults; + import + sdp.ao.defaults, + sdp.ao.rgx; struct HeaderDocMetadataAndMakeNativeToAA { mixin SiSUregisters; mixin SiSUrgxInitFlags; diff --git a/src/sdp/ao_conf_make_meta_sdlang.d b/src/sdp/ao/conf_make_meta_sdlang.d index 1fb8993..567853e 100644 --- a/src/sdp/ao_conf_make_meta_sdlang.d +++ b/src/sdp/ao/conf_make_meta_sdlang.d @@ -2,9 +2,9 @@ sdlang headers<BR> extract sdlang header return sdlang +/ -module sdp.ao_conf_make_meta_sdlang; +module sdp.ao.conf_make_meta_sdlang; template SiSUheaderExtractSDLang() { - private import + import std.exception, std.regex, std.stdio, @@ -13,9 +13,9 @@ template SiSUheaderExtractSDLang() { std.typecons, std.utf, std.conv : to; - private import - sdp.ao_rgx, - sdp.ao_defaults; + import + sdp.ao.defaults, + sdp.ao.rgx; struct HeaderExtractSDL { mixin SiSUregisters; mixin SiSUrgxInit; diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao/defaults.d index 6363fdc..aa9fc2c 100644 --- a/src/sdp/ao_defaults.d +++ b/src/sdp/ao/defaults.d @@ -1,9 +1,9 @@ /++ default settings +/ -module sdp.ao_defaults; +module sdp.ao.defaults; template SiSUregisters() { - private import + import std.algorithm, std.array, std.container, diff --git a/src/sdp/ao_doc_debugs.d b/src/sdp/ao/doc_debugs.d index 2c78c76..d42d903 100644 --- a/src/sdp/ao_doc_debugs.d +++ b/src/sdp/ao/doc_debugs.d @@ -1,12 +1,12 @@ /++ output debugs +/ -module sdp.ao_doc_debugs; +module sdp.ao.doc_debugs; template SiSUdebugs() { import - sdp.ao_defaults, - sdp.ao_rgx; - private import + sdp.ao.defaults, + sdp.ao.rgx; + import std.algorithm, std.array, std.container, @@ -20,7 +20,6 @@ template SiSUdebugs() { std.string, std.traits, std.typecons, - std.uni, std.utf, std.conv : to; auto SiSUdebugs(S,T)( diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao/object_setter.d index a5ddb4a..b05ac98 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao/object_setter.d @@ -3,7 +3,7 @@ setting of sisu objects for downstream processing ao_object_setter.d +/ -module sdp.ao_object_setter; +module sdp.ao.object_setter; template ObjectSetter() { /+ structs +/ struct HeadingAttrib { diff --git a/src/sdp/ao/package.d b/src/sdp/ao/package.d new file mode 100644 index 0000000..63b4f3e --- /dev/null +++ b/src/sdp/ao/package.d @@ -0,0 +1,17 @@ +module sdp.ao; +public import + sdp.ao.defaults, + sdp.ao.rgx; +/+ std +/ +public import + std.array, + std.exception, + std.range, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + // std.uni, + std.utf, + std.conv : to; diff --git a/src/sdp/ao_read_config_files.d b/src/sdp/ao/read_config_files.d index b8d9890..57213c4 100644 --- a/src/sdp/ao_read_config_files.d +++ b/src/sdp/ao/read_config_files.d @@ -3,25 +3,12 @@ - read config files<BR> ao_config_files.d +/ -module sdp.ao_read_config_files; +module sdp.ao.read_config_files; template ConfigIn() { - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.stdio, + import + sdp.ao, std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; - import std.file; + std.path; final string ConfigIn(C,E)(C conf_sdl, E env) { string dot_pwd = chainPath(to!string(env["pwd"]), ".sisu").array; string underscore_pwd = chainPath(to!string(env["pwd"]), "_sisu").array; @@ -61,22 +48,10 @@ template ConfigIn() { +/ template ConfigSDLang() { import sdlang; - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.stdio, + import + sdp.ao, std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; + std.path; auto ConfigSDLang(string configuration, string conf_sdl_filename) { Tag sdl_root_conf; try { @@ -99,22 +74,10 @@ template ConfigSDLang() { /+ +/ template ConfigHub() { - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.stdio, + import + sdp.ao, std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; + std.path; final auto ConfigHub(C,E)(C conf_sdl, E env) { auto configuration = ConfigIn!()(conf_sdl, env); diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao/read_source_files.d index b6ad942..3b348f3 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao/read_source_files.d @@ -3,26 +3,14 @@ - open markup files<BR> - if master file scan for addional files to import/insert +/ -module sdp.ao_read_source_files; +module sdp.ao.read_source_files; template SiSUrawMarkupContent() { - private import - sdp.ao_rgx; - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.stdio, + import + sdp.ao.rgx; + import + sdp.ao, std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; + std.path; mixin SiSUrgxInit; auto rgx = Rgx(); auto rawsrc = RawMarkupContent(); @@ -63,7 +51,7 @@ template SiSUrawMarkupContent() { } } struct MarkupRawUnit { - private import std.file; + import std.file; final private string readInMarkupSource(in char[] fn_src) { enforce( exists(fn_src)!=0, @@ -140,7 +128,7 @@ template SiSUrawMarkupContent() { } } struct Inserts { - private import sdp.ao_defaults; + import sdp.ao.defaults; auto scan_subdoc_source( char[][] markup_sourcefile_insert_content, string fn_src diff --git a/src/sdp/ao_rgx.d b/src/sdp/ao/rgx.d index 29a96af..3f74329 100644 --- a/src/sdp/ao_rgx.d +++ b/src/sdp/ao/rgx.d @@ -1,9 +1,9 @@ /++ regex: regular expressions used in sisu document parser +/ -module sdp.ao_rgx; +module sdp.ao.rgx; template SiSUrgxInit() { - private import sdp.ao_defaults; + import sdp.ao.defaults; struct Rgx { /+ misc +/ static true_dollar = ctRegex!(`\$`, "gm"); diff --git a/src/sdp/compile_time_info.d b/src/sdp/conf/compile_time_info.d index cf4d0a5..80f6e33 100644 --- a/src/sdp/compile_time_info.d +++ b/src/sdp/conf/compile_time_info.d @@ -1,7 +1,7 @@ /++ compile_time_info +/ -module sdp.compile_time_info; +module sdp.conf.compile_time_info; template CompileTimeInfo() { version(Windows) { pragma(msg, "[ Windows compilation ]"); diff --git a/src/sdp/imports_for_ao.d b/src/sdp/imports_for_ao.d deleted file mode 100644 index 34aa1e1..0000000 --- a/src/sdp/imports_for_ao.d +++ /dev/null @@ -1,41 +0,0 @@ -module sdp.imports_for_ao; -public import - sdp.abstraction_summary, - sdp.ao_abstract_doc_source, - sdp.ao_conf_make_meta, - sdp.ao_conf_make_meta_native, - sdp.ao_conf_make_meta_sdlang, - sdp.ao_defaults, - sdp.ao_doc_debugs, - sdp.ao_read_config_files, - sdp.ao_read_source_files, - sdp.ao_rgx, - sdp.output_hub, - sdp.paths_source; -/+ sdlang http://sdlang.org +/ -public import sdlang; -/+ aarchive https://github.com/rcythr/archive +/ -public import - archive.core, - archive.zip; -/+ std +/ -public import - // std.algorithm, - std.array, - // std.container, - std.digest.sha, - std.exception, - std.getopt, - std.process, - std.stdio, - // std.file, - // std.path, - std.range, - // std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; diff --git a/src/sdp/imports_for_output.d b/src/sdp/imports_for_output.d deleted file mode 100644 index 20b3ba1..0000000 --- a/src/sdp/imports_for_output.d +++ /dev/null @@ -1,28 +0,0 @@ -module sdp.imports_for_output; -public import - std.regex, - std.algorithm, - std.array, - std.container, - std.exception, - std.getopt, - std.process, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf; -public import - sdp.defaults, - sdp.output_epub3, - sdp.output_html, - sdp.output_rgx, - sdp.output_xmls, - sdp.source_sisupod, - sdp.create_zip_file, - sdp.paths_output; diff --git a/src/sdp/create_zip_file.d b/src/sdp/output/create_zip_file.d index 93e85ee..5380744 100644 --- a/src/sdp/create_zip_file.d +++ b/src/sdp/output/create_zip_file.d @@ -1,4 +1,4 @@ -module sdp.create_zip_file; +module sdp.output.create_zip_file; template createZipFile() { import std.file; import std.outbuffer; diff --git a/src/sdp/defaults.d b/src/sdp/output/defaults.d index a344f7f..82a8d1a 100644 --- a/src/sdp/defaults.d +++ b/src/sdp/output/defaults.d @@ -1,7 +1,7 @@ /++ default settings +/ -module sdp.defaults; +module sdp.output.defaults; template InternalMarkup() { struct InlineMarkup { diff --git a/src/sdp/output_epub3.d b/src/sdp/output/epub3.d index 6cc496c..0f91c86 100644 --- a/src/sdp/output_epub3.d +++ b/src/sdp/output/epub3.d @@ -1,34 +1,16 @@ -module sdp.output_epub3; +module sdp.output.epub3; template outputEPub3() { - private import - std.algorithm, - std.array, - std.container, + import sdp.output; + import std.digest.sha, - std.exception, std.file, - std.getopt, - std.json, std.outbuffer, - std.path, - std.process, - std.range, - std.regex, - std.stdio, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, std.zip, std.conv : to; import - sdp.create_zip_file, - sdp.defaults, - sdp.output_rgx, - sdp.output_xmls, - sdp.output_xmls_css, - sdp.paths_output; + sdp.output.create_zip_file, + sdp.output.xmls, + sdp.output.xmls_css; mixin InternalMarkup; mixin outputXHTMLs; string epub3_mimetypes() { diff --git a/src/sdp/output_html.d b/src/sdp/output/html.d index 41d68dd..6712469 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output/html.d @@ -1,34 +1,16 @@ -module sdp.output_html; +module sdp.output.html; template outputHTML() { - private import - std.algorithm, - std.array, - std.container, + import sdp.output; + import std.digest.sha, - std.exception, std.file, - std.getopt, - std.json, std.outbuffer, - std.path, - std.process, - std.range, - std.regex, - std.stdio, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, std.zip, std.conv : to; import - sdp.create_zip_file, - sdp.defaults, - sdp.output_rgx, - sdp.output_xmls, - sdp.output_xmls_css, - sdp.paths_output; + sdp.output.create_zip_file, + sdp.output.xmls, + sdp.output.xmls_css; mixin outputXHTMLs; void scroll(D,I)( diff --git a/src/sdp/output_hub.d b/src/sdp/output/hub.d index 0ed1653..79b8996 100644 --- a/src/sdp/output_hub.d +++ b/src/sdp/output/hub.d @@ -2,28 +2,15 @@ output hub<BR> check & generate output types requested +/ -module sdp.output_hub; +module sdp.output.hub; template outputHub() { - private import - std.regex, - std.algorithm, - std.array, - std.container, - std.exception, - std.getopt, - std.process, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf; - import - sdp.imports_for_output; + import sdp.output, + sdp.output.epub3, + sdp.output.html, + sdp.output.xmls, + sdp.output.source_sisupod, + sdp.output.create_zip_file, + sdp.output.paths_output; void outputHub(D,I)(D doc_abstraction, I doc_matters) { mixin SiSUoutputRgxInit; auto rgx = Rgx(); diff --git a/src/sdp/output/package.d b/src/sdp/output/package.d new file mode 100644 index 0000000..58a6ae8 --- /dev/null +++ b/src/sdp/output/package.d @@ -0,0 +1,20 @@ +module sdp.output; +public import + std.algorithm, + std.array, + std.container, + std.exception, + std.path, + std.process, + std.range, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + // std.uni, + std.utf; +public import + sdp.output.defaults, + sdp.output.paths_output, + sdp.output.rgx; diff --git a/src/sdp/paths_output.d b/src/sdp/output/paths_output.d index ea68567..3edcb67 100644 --- a/src/sdp/paths_output.d +++ b/src/sdp/output/paths_output.d @@ -1,12 +1,12 @@ /++ default settings +/ -module sdp.paths_output; +module sdp.output.paths_output; import std.array, std.path, std.regex, std.stdio; -import sdp.ao_rgx; +import sdp.ao.rgx; template SiSUpathsSisupod() { mixin SiSUrgxInit; auto rgx = Rgx(); diff --git a/src/sdp/paths_source.d b/src/sdp/output/paths_source.d index b5a60e8..7658df5 100644 --- a/src/sdp/paths_source.d +++ b/src/sdp/output/paths_source.d @@ -3,12 +3,12 @@ - read config files<BR> ao_config_files.d +/ -module sdp.paths_source; +module sdp.output.paths_source; import std.array, std.path, std.regex, std.stdio; -import sdp.ao_rgx; +import sdp.ao.rgx; template SiSUpathsSRC() { mixin SiSUrgxInit; auto rgx = Rgx(); diff --git a/src/sdp/output_rgx.d b/src/sdp/output/rgx.d index af0751e..6fdc876 100644 --- a/src/sdp/output_rgx.d +++ b/src/sdp/output/rgx.d @@ -1,9 +1,9 @@ /++ regex: regular expressions used in sisu document parser +/ -module sdp.output_rgx; +module sdp.output.rgx; template SiSUoutputRgxInit() { - private import sdp.defaults; + import sdp.output.defaults; struct Rgx { static newline = ctRegex!("\n", "mg"); static strip_br = ctRegex!("^<br>\n|<br>\n*$"); diff --git a/src/sdp/source_sisupod.d b/src/sdp/output/source_sisupod.d index 7babba3..6c326ac 100644 --- a/src/sdp/source_sisupod.d +++ b/src/sdp/output/source_sisupod.d @@ -1,33 +1,15 @@ -module sdp.source_sisupod; +module sdp.output.source_sisupod; template SiSUpod() { - private import - std.algorithm, - std.array, - std.container, + import sdp.output; + import std.digest.sha, - std.exception, std.file, - std.getopt, - std.json, std.outbuffer, - std.path, - std.process, - std.range, - std.regex, - std.stdio, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, std.zip, std.conv : to; import - sdp.create_zip_file, - sdp.defaults, - sdp.output_rgx, - sdp.output_xmls, - sdp.paths_output; + sdp.output.create_zip_file, + sdp.output.xmls; void SiSUpod(T)(T doc_matters) { debug(asserts) { // static assert(is(typeof(doc_matters) == tuple)); diff --git a/src/sdp/output_xmls.d b/src/sdp/output/xmls.d index 373a871..7a057ad 100644 --- a/src/sdp/output_xmls.d +++ b/src/sdp/output/xmls.d @@ -1,34 +1,16 @@ -module sdp.output_xmls; +module sdp.output.xmls; template outputXHTMLs() { - private import - std.algorithm, - std.array, - std.container, + import sdp.output; + import std.digest.sha, - std.exception, std.file, - std.getopt, - std.json, std.outbuffer, - std.path, - std.process, - std.range, - std.regex, - std.stdio, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, std.zip, std.conv : to; import - sdp.create_zip_file, - sdp.defaults, - sdp.output_rgx, - sdp.output_xmls, - sdp.output_xmls_css, - sdp.paths_output; + sdp.output.create_zip_file, + sdp.output.xmls, + sdp.output.xmls_css; mixin SiSUoutputRgxInit; struct outputXHTMLs { auto rgx = Rgx(); diff --git a/src/sdp/output_xmls_css.d b/src/sdp/output/xmls_css.d index eb1ab2b..6bb493a 100644 --- a/src/sdp/output_xmls_css.d +++ b/src/sdp/output/xmls_css.d @@ -1,7 +1,7 @@ /++ default css settings +/ -module sdp.output_xmls_css; +module sdp.output.xmls_css; template SiSUcss() { auto SiSUcss() { string css_shared=" diff --git a/src/sdp/sisu_d_parser.d b/src/sdp/sisu_d_parser.d new file mode 100755 index 0000000..748ba12 --- /dev/null +++ b/src/sdp/sisu_d_parser.d @@ -0,0 +1,221 @@ +#!/usr/bin/env rdmd +/+ + sdp ++/ +import + sdp.conf.compile_time_info, + sdp.ao.abstraction; +/+ sdp: sisu document parser, see http://sisudoc.org +/ +import sdp.ao; +import + std.getopt, + std.process; +import + sdp.ao.abstraction_summary, + sdp.ao.abstract_doc_source, + sdp.ao.conf_make_meta, + // sdp.ao.conf_make_meta_native, + sdp.ao.conf_make_meta_sdlang, + sdp.ao.defaults, + sdp.ao.doc_debugs, + sdp.ao.read_config_files, + sdp.ao.read_source_files, + sdp.ao.rgx, + sdp.output.hub, + sdp.output.paths_source; + + + +mixin(import("version.txt")); +mixin CompileTimeInfo; +/++ A SiSU document parser writen in D. +/ +void main(string[] args) { + mixin SiSUrgxInit; + mixin SiSUregisters; + mixin SiSUheaderExtractSDLang; + mixin SiSUnode; + mixin SiSUbiblio; + mixin SiSUrgxInitFlags; + mixin outputHub; + string[] fns_src; + string flag_action; + string arg_unrecognized; + enum dAM { abstraction, matters } + auto rgx = Rgx(); + scope(success) { + debug(checkdoc) { + writefln( + "~ run complete, ok ~ (sdp-%s.%s.%s, %s v%s, %s %s)", + ver.major, ver.minor, ver.patch, + __VENDOR__, __VERSION__, + bits, os, + ); + } + } + scope(failure) { + debug(checkdoc) { + stderr.writefln( + "run failure", + ); + } + } + bool[string] _opt_action_bool = [ + "assertions" : false, + "concordance" : false, + "debug" : false, + "digest" : false, + "docbook" : false, + "epub" : false, + "html" : false, + "html_seg" : false, + "html_scroll" : false, + "manifest" : false, + "ocn" : true, + "odt" : false, + "pdf" : false, + "postgresql" : false, + "qrcode" : false, + "sisupod" : false, + "source" : false, + "sqlite" : false, + "text" : false, + "verbose" : false, + "xhtml" : false, + "xml_dom" : false, + "xml_sax" : false, + "section_toc" : true, + "section_body" : true, + "section_endnotes" : true, + "section_glossary" : true, + "section_biblio" : true, + "section_bookindex" : true, + "section_blurb" : true, + "backmatter" : true, + "skip_output" : false, + ]; + auto helpInfo = getopt(args, + std.getopt.config.passThrough, + "assert", "--assert set optional assertions on", &_opt_action_bool["assertions"], + "concordance", "--concordance file for document", &_opt_action_bool["concordance"], + "debug", "--debug only relevant when debug options compiled in", &_opt_action_bool["debug"], + "digest", "--digest hash digest for each object", &_opt_action_bool["digest"], + "docbook", "--docbook process docbook output", &_opt_action_bool["docbook"], + "epub", "--epub process epub output", &_opt_action_bool["epub"], + "html", "--html process html output", &_opt_action_bool["html"], + "html_seg", "--html-seg process html output", &_opt_action_bool["html_seg"], + "html_scroll", "--html-seg process html output", &_opt_action_bool["html_scroll"], + "manifest", "--manifest process manifest output", &_opt_action_bool["manifest"], + "ocn", "--ocn object cite numbers (default)", &_opt_action_bool["ocn"], + "odf", "--odf process odf:odt output", &_opt_action_bool["odt"], + "odt", "--odt process odf:odt output", &_opt_action_bool["odt"], + "pdf", "--pdf process pdf output", &_opt_action_bool["pdf"], + "pg", "--pg process postgresql output", &_opt_action_bool["postgresql"], + "postgresql", "--postgresql process postgresql output", &_opt_action_bool["postgresql"], + "qrcode", "--qrcode with document metadata", &_opt_action_bool["qrcode"], + "sisupod", "--sisupod sisupod source content bundled", &_opt_action_bool["sisupod"], + "source", "--source markup source text content", &_opt_action_bool["source"], + "sqlite", "--sqlite process sqlite output", &_opt_action_bool["sqlite"], + "text", "--text process text output", &_opt_action_bool["text"], + "txt", "--txt process text output", &_opt_action_bool["text"], + "verbose|v", "--verbose output to terminal", &_opt_action_bool["verbose"], + "xhtml", "--xhtml process xhtml output", &_opt_action_bool["xhtml"], + "xml-dom", "--xml-dom process xml dom output", &_opt_action_bool["xml_dom"], + "xml-sax", "--xml-sax process xml sax output", &_opt_action_bool["xml_sax"], + "section-toc", "--section-toc process table of contents (default)", &_opt_action_bool["section_toc"], + "section-body", "--section-body process document body (default)", &_opt_action_bool["section_body"], + "section-endnotes", "--section-endnotes process document endnotes (default)", &_opt_action_bool["section_endnotes"], + "section-glossary", "--section-glossary process document glossary (default)", &_opt_action_bool["section_glossary"], + "section-biblio", "--section-biblio process document biblio (default)", &_opt_action_bool["section_biblio"], + "section-bookindex", "--section-bookindex process document bookindex (default)", &_opt_action_bool["section_bookindex"], + "section-blurb", "--section-blurb process document blurb (default)", &_opt_action_bool["section_blurb"], + "backmatter", "--section-backmatter process document backmatter (default)", &_opt_action_bool["backmatter"], + "skip_output", "--skip-output", &_opt_action_bool["skip_output"], + ); + if (helpInfo.helpWanted) { + defaultGetoptPrinter("Some information about the program.", helpInfo.options); + } + foreach(arg; args) { + if (arg.match(rgx.flag_action)) { + flag_action ~= " " ~ arg; // flags not taken by getopt + } else if (arg.match(rgx.src_pth)) { + fns_src ~= arg; // gather input markup source file names for processing + } else { // anything remaining, unused + arg_unrecognized ~= " " ~ arg; + } + } + auto env = [ + "pwd" : environment["PWD"], + "home" : environment["HOME"], + ]; + auto sdl_root_configuration = ConfigHub!()("conf.sdl", env); + auto sdl_root_doc_make = ConfigHub!()("sisu_document_make", env); + auto confsdl = HeaderExtractSDL(); + auto conf_settings_aa = confsdl.configSettingsSDLangToAAmake(sdl_root_configuration); + auto conf_doc_make_aa = confsdl.documentMakeSDLangToAAmake(sdl_root_doc_make); + foreach(fn_src; fns_src) { + if (!empty(fn_src)) { + scope(success) { + debug(checkdoc) { + writefln( + "%s\n%s", + "~ document complete, ok ~", + "------------------------------------------------------------------", + ); + } + } + scope(failure) { + debug(checkdoc) { + stderr.writefln( + "~ document run failure ~ (%s v%s)\n\t%s", + __VENDOR__, __VERSION__, + fn_src + ); + } + } + enforce( + fn_src.match(rgx.src_pth), + "not a sisu markup filename" + ); + auto t = + SiSUabstraction!()(fn_src, _opt_action_bool, env); + static assert(!isTypeTuple!(t)); + static assert(t.length==2); + auto doc_abstraction = t[dAM.abstraction]; + auto doc_matters = t[dAM.matters]; + /+ ↓ debugs +/ + if (doc_matters.opt_action_bool["verbose"]) { + SiSUabstractionSummary!()(doc_abstraction, doc_matters); + } + /+ ↓ debugs +/ + if ((doc_matters.opt_action_bool["debug"]) + || (doc_matters.opt_action_bool["verbose"]) + ) { + SiSUdebugs!()(doc_abstraction, doc_matters); + } + /+ ↓ output hub +/ + if (!(_opt_action_bool["skip_output"])) { + outputHub!()(doc_abstraction, doc_matters); + } + scope(exit) { + debug(checkdoc) { + writefln( + "processed file: %s", + fn_src + ); + } + destroy(fn_src); + } + } else { + /+ no recognized filename provided +/ + writeln("no recognized filename"); + break; // terminate, stop + } + } +} +unittest { + /++ + name "sdp" + description "A SiSU document parser writen in D." + homepage "http://sisudoc.org" + +/ +} |