From e31e98f5cc3c2289ad47198a506d8d03a063512c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 7 May 2017 16:07:11 -0400 Subject: 0.15.0 named modules --- org/ao_conf_make_meta.org | 27 +++-- org/ao_debugs.org | 9 +- org/ao_doc_abstraction.org | 26 +++-- org/ao_read_source_files.org | 14 ++- org/compile_time_info.org | 5 +- org/default_misc.org | 10 +- org/default_paths.org | 13 ++- org/default_regex.org | 14 ++- org/output_hub.org | 20 ++-- org/output_sisupod.org | 15 +-- org/output_xmls.org | 65 ++++++----- org/output_xmls_css.org | 5 +- org/output_zip.org | 5 +- org/sdp.org | 46 ++++---- src/sdp.d | 230 ------------------------------------- src/sdp/abstraction.d | 25 ++-- src/sdp/abstraction_summary.d | 5 +- src/sdp/ao_abstract_doc_source.d | 9 +- src/sdp/ao_conf_make_meta.d | 7 +- src/sdp/ao_conf_make_meta_native.d | 5 +- src/sdp/ao_conf_make_meta_sdlang.d | 5 +- src/sdp/ao_defaults.d | 1 + src/sdp/ao_doc_debugs.d | 5 +- src/sdp/ao_object_setter.d | 1 + src/sdp/ao_read_config_files.d | 1 + src/sdp/ao_read_source_files.d | 5 +- src/sdp/ao_rgx.d | 3 +- src/sdp/compile_time_info.d | 1 + src/sdp/create_zip_file.d | 1 + src/sdp/defaults.d | 1 + src/sdp/output_epub3.d | 13 ++- src/sdp/output_html.d | 13 ++- src/sdp/output_hub.d | 17 +-- src/sdp/output_rgx.d | 3 +- src/sdp/output_xmls.d | 13 ++- src/sdp/output_xmls_css.d | 1 + src/sdp/paths_output.d | 3 +- src/sdp/paths_source.d | 3 +- src/sdp/source_sisupod.d | 11 +- src/sisu_d_parser.d | 230 +++++++++++++++++++++++++++++++++++++ views/version.txt | 2 +- 41 files changed, 470 insertions(+), 418 deletions(-) delete mode 100755 src/sdp.d create mode 100755 src/sisu_d_parser.d diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org index ad656aa..471d233 100644 --- a/org/ao_conf_make_meta.org +++ b/org/ao_conf_make_meta.org @@ -13,7 +13,8 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. Header Hub :ao_markup_header_extract: +* 0. Header Hub :module:sdp:ao_conf_make_meta: +** module template #+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta.d /++ @@ -26,6 +27,7 @@ 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; template SiSUheaderExtractHub() { private import std.exception, @@ -37,9 +39,9 @@ template SiSUheaderExtractHub() { std.conv : to; private import sdlang; private import - ao_rgx, - ao_conf_make_meta_native, - ao_conf_make_meta_sdlang; + sdp.ao_rgx, + sdp.ao_conf_make_meta_native, + sdp.ao_conf_make_meta_sdlang; mixin SiSUrgxInit; mixin SiSUheaderExtractNative; mixin SiSUheaderExtractSDLang; @@ -64,7 +66,8 @@ template SiSUheaderExtractHub() { } #+END_SRC -* A. header sdlang +* A. header sdlang (extract) :module:sdp:ao_conf_make_meta_sdlang: +** module template ** extract sdlang header #+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_sdlang.d @@ -72,6 +75,7 @@ template SiSUheaderExtractHub() { sdlang headers
extract sdlang header return sdlang +/ +module sdp.ao_conf_make_meta_sdlang; template SiSUheaderExtractSDLang() { private import std.exception, @@ -83,8 +87,8 @@ template SiSUheaderExtractSDLang() { std.utf, std.conv : to; private import - ao_rgx, - ao_defaults; + sdp.ao_rgx, + sdp.ao_defaults; struct HeaderExtractSDL { mixin SiSUregisters; mixin SiSUrgxInit; @@ -263,14 +267,15 @@ private auto headerSDLangToAA(Hs,Ma)(Hs header_sdlang_src, Ma conf_doc_make_aa) } #+END_SRC -* B. header native :header:native: -** Header Native :ao_markup_header_extract_native: +* B. header native :module:sdp:ao_conf_make_meta_native: +** Header Native :header:native:markup_header_extract_native: #+BEGIN_SRC d :tangle ../src/sdp/ao_conf_make_meta_native.d /++ native headers using
@title:
:subtitle:
type tags
extract native/orig header return associative array +/ +module sdp.ao_conf_make_meta_native; template SiSUheaderExtractNative() { private import std.exception, @@ -282,8 +287,8 @@ template SiSUheaderExtractNative() { std.utf, std.conv : to; private import - ao_rgx, - ao_defaults; + sdp.ao_rgx, + sdp.ao_defaults; struct HeaderDocMetadataAndMakeNativeToAA { mixin SiSUregisters; mixin SiSUrgxInitFlags; diff --git a/org/ao_debugs.org b/org/ao_debugs.org index e0f96da..838d7cf 100644 --- a/org/ao_debugs.org +++ b/org/ao_debugs.org @@ -13,13 +13,14 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 1. abstraction debugs :debug:doc:abstraction: -** 0. code structure: :ao_doc_debugs: +* 1. abstraction debugs :module:sdp:ao_doc_debugs: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/ao_doc_debugs.d /++ output debugs +/ +module sdp.ao_doc_debugs; template SiSUdebugs() { <> auto SiSUdebugs(S,T)( @@ -45,8 +46,8 @@ template SiSUdebugs() { #+name: debug_imports #+BEGIN_SRC d import - ao_defaults, - ao_rgx; + sdp.ao_defaults, + sdp.ao_rgx; private import std.algorithm, std.array, diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org index f6d65e1..75ed2a6 100644 --- a/org/ao_doc_abstraction.org +++ b/org/ao_doc_abstraction.org @@ -102,10 +102,10 @@ | | | | | - heading row | | | | |-------+--------------+----------------------------+--------------------------+----------------+-----------------+----------------+------------| -* 1. Document Abstraction :abstract:process: +* 1. Document Abstraction :module:sdp:ao_abstract_doc_source: Process markup document, create document abstraction. -** 0. ao abstract doc source: :ao_abstract_doc_source: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/ao_abstract_doc_source.d /++ @@ -113,6 +113,7 @@ Process markup document, create document abstraction. abstraction of sisu markup for downstream processing ao_abstract_doc_source.d +/ +module sdp.ao_abstract_doc_source; template SiSUdocAbstraction() { /+ ↓ abstraction imports +/ <> @@ -233,10 +234,10 @@ template SiSUdocAbstraction() { #+name: abs_top_imports #+BEGIN_SRC d import - ao_defaults, - ao_object_setter, - ao_rgx, - output_hub; + sdp.ao_defaults, + sdp.ao_object_setter, + sdp.ao_rgx, + sdp.output_hub; private import std.algorithm, std.array, @@ -1731,7 +1732,7 @@ the_document_head_section ~= the_document_body_section[0]; the_document_body_section=the_document_body_section[1..$]; #+END_SRC -*** _minor loops_ :post: +*** _minor loops_ :post: **** 1. loop: backmatter loop up to lev4: html_segnames, set backmatter pointers could optimise by @@ -6630,7 +6631,7 @@ struct NodeStructureMetadata { #+END_SRC *** function assertions :assertions: -**** mixin template: assertions on markup document structure :doc_structure: +**** assertions on markup document structure :doc_structure: #+name: abs_functions_assertions #+BEGIN_SRC d @@ -6815,7 +6816,7 @@ auto assertions_doc_structure(O,Lv)( } #+END_SRC -**** mixin template: assertions on blocks :blocks: +**** assertions on blocks :blocks: #+name: abs_functions_assertions #+BEGIN_SRC d @@ -6865,11 +6866,11 @@ template docSectKeysSeq() { } #+END_SRC -* 2. Object Setter (Set Abstract Object) :abstract:object: +* 2. Object Setter (Set Abstract Object) :module:sdp:ao_object_setter: set abstracted objects for downstream processing -** 0. ao object setter: :ao_object_setter: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/ao_object_setter.d /++ @@ -6877,6 +6878,7 @@ set abstracted objects for downstream processing setting of sisu objects for downstream processing ao_object_setter.d +/ +module sdp.ao_object_setter; template ObjectSetter() { /+ structs +/ <> @@ -6899,7 +6901,7 @@ struct HeadingAttrib { } #+END_SRC -*** [#A] composite object +*** [#A] _composite object_ #+name: ao_structs_init #+BEGIN_SRC d diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index 134b64b..9b9e863 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -13,8 +13,8 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 1. get config file :config: -** 0. config files, read in +* 1. get config file (read in) :module:sdp:ao_read_config_files: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/ao_read_config_files.d /++ @@ -22,6 +22,7 @@ - read config files
ao_config_files.d +/ +module sdp.ao_read_config_files; template ConfigIn() { <> import std.file; @@ -157,9 +158,9 @@ final auto ConfigHub(C,E)(C conf_sdl, E env) { } #+END_SRC -* 2. get markup source, read file +* 2. get markup source, read file :module:sdp:ao_read_source_files: -** 0. ao_markup_source_raw.d: :ao_markup_source_raw: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/ao_read_source_files.d /++ @@ -167,9 +168,10 @@ final auto ConfigHub(C,E)(C conf_sdl, E env) { - open markup files
- if master file scan for addional files to import/insert +/ +module sdp.ao_read_source_files; template SiSUrawMarkupContent() { private import - ao_rgx; + sdp.ao_rgx; <> mixin SiSUrgxInit; auto rgx = Rgx(); @@ -220,7 +222,7 @@ template SiSUrawMarkupContent() { <> } struct Inserts { - private import ao_defaults; + private import sdp.ao_defaults; auto scan_subdoc_source( char[][] markup_sourcefile_insert_content, string fn_src diff --git a/org/compile_time_info.org b/org/compile_time_info.org index 66e56fc..5da7e04 100644 --- a/org/compile_time_info.org +++ b/org/compile_time_info.org @@ -13,19 +13,20 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* compilation info :compile: +* compilation info :module:sdp:compile_time_info: [[../maker.org][maker.org makefile]] [[./sdp.org][sdp hub]] [[./][org/]] e.g. do on linux bsd osx not windows: version(Windows) {} else { ... } -** 0. compile_time_info :compile_time_info: +** 0. module template #+begin_src d :tangle ../src/sdp/compile_time_info.d /++ compile_time_info +/ +module sdp.compile_time_info; template CompileTimeInfo() { <> } diff --git a/org/default_misc.org b/org/default_misc.org index bf18361..84b9076 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -13,14 +13,15 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. ao defaults :defaults: -** 0. tangle template +* 0. ao defaults :module:sdp:ao_defaults: +** 0. module template #+name: tangle_defaults #+BEGIN_SRC d :tangle ../src/sdp/ao_defaults.d /++ default settings +/ +module sdp.ao_defaults; template SiSUregisters() { <> <> @@ -531,14 +532,15 @@ template SiSUbiblio() { } #+END_SRC -* 1. output defaults -** 0. tangle: :defaults: +* 1. output defaults :module:sdp:defaults: +** 0. module template #+name: tangle_defaults #+BEGIN_SRC d :tangle ../src/sdp/defaults.d /++ default settings +/ +module sdp.defaults; <> <> <> diff --git a/org/default_paths.org b/org/default_paths.org index 65a0c0f..597f162 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -13,7 +13,8 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. source paths :paths:dir:source: +* 0. source paths :module:sdp:paths_source: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/paths_source.d /++ @@ -21,11 +22,12 @@ - read config files
ao_config_files.d +/ +module sdp.paths_source; import std.array, std.path, std.regex, std.stdio; -import ao_rgx; +import sdp.ao_rgx; template SiSUpathsSRC() { mixin SiSUrgxInit; auto rgx = Rgx(); @@ -77,18 +79,19 @@ template SiSUpathsSRC() { } #+END_SRC -* 1. output paths :paths:dir:output: -** 0. tangle, template output paths +* 1. output paths :module:sdp:paths_output: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/paths_output.d /++ default settings +/ +module sdp.paths_output; import std.array, std.path, std.regex, std.stdio; -import ao_rgx; +import sdp.ao_rgx; <> <> <> diff --git a/org/default_regex.org b/org/default_regex.org index 01aa763..4c126a2 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -13,22 +13,23 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. ao ctRegex :regex: +* 0. ao ctRegex :module:sdp:ao_rgx: [[./sdp.org][sdp]] [[./][org/]] http://dlang.org/phobos/std_regex.html - Plain string, in which case it's compiled to bytecode before matching. - Regex!char (wchar/dchar) that contains a pattern in the form of compiled bytecode. - StaticRegex!char (wchar/dchar) that contains a pattern in the form of compiled native machine code. -** 0. rgx code template: :ao_rgx: +** 0. module template #+name: tangle_ao_rgx #+BEGIN_SRC d :tangle ../src/sdp/ao_rgx.d /++ regex: regular expressions used in sisu document parser +/ +module sdp.ao_rgx; template SiSUrgxInit() { - private import ao_defaults; + private import sdp.ao_defaults; struct Rgx { <> <> @@ -342,22 +343,23 @@ auto language_code_and_filename = ctRegex!("(?:^|[/])(am|bg|bn|br|ca|cs|cy|da|de|el|en|eo|es|et|eu|fi|fr|ga|gl|he|hi|hr|hy|ia|is|it|ja|ko|la|lo|lt|lv|ml|mr|nl|no|nn|oc|pl|pt|pt_BR|ro|ru|sa|se|sk|sl|sq|sr|sv|ta|te|th|tk|tr|uk|ur|vi|zh)/[A-Za-z0-9._-].+?[.](?:sst|ssm)$"); #+END_SRC -* 1. output ctRegex :regex: +* 1. output ctRegex :module:sdp:output_rgx: [[./sdp.org][sdp]] [[./][org/]] http://dlang.org/phobos/std_regex.html - Plain string, in which case it's compiled to bytecode before matching. - Regex!char (wchar/dchar) that contains a pattern in the form of compiled bytecode. - StaticRegex!char (wchar/dchar) that contains a pattern in the form of compiled native machine code. -** 0. code template: :rgx: +** 0. module template #+name: tangle_ao_rgx #+BEGIN_SRC d :tangle ../src/sdp/output_rgx.d /++ regex: regular expressions used in sisu document parser +/ +module sdp.output_rgx; template SiSUoutputRgxInit() { - private import defaults; + private import sdp.defaults; struct Rgx { <> <> diff --git a/org/output_hub.org b/org/output_hub.org index a190c7b..e83b36d 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -13,13 +13,15 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. output hub [#A] +* 0. output hub [#A] :module:sdp:output_hub: +** module template #+BEGIN_SRC d :tangle ../src/sdp/output_hub.d /++ output hub
check & generate output types requested +/ +module sdp.output_hub; template outputHub() { <> void outputHub(D,I)(D doc_abstraction, I doc_matters) { @@ -53,14 +55,14 @@ private import std.uni, std.utf; import - create_zip_file, - defaults, - output_epub3, - output_html, - output_rgx, - output_xmls, - paths_output, - source_sisupod; + sdp.defaults, + sdp.output_epub3, + sdp.output_html, + sdp.output_rgx, + sdp.output_xmls, + sdp.source_sisupod, + sdp.create_zip_file, + sdp.paths_output; #+END_SRC ** output options diff --git a/org/output_sisupod.org b/org/output_sisupod.org index e161f54..f768176 100644 --- a/org/output_sisupod.org +++ b/org/output_sisupod.org @@ -14,9 +14,11 @@ [[./sdp.org][sdp]] [[./][org/]] [[./output_hub.org][output_hub]] -* sisupod template :template: +* sisupod :module:sdp:source_sisupod: +** module template #+BEGIN_SRC d :tangle ../src/sdp/source_sisupod.d +module sdp.source_sisupod; template SiSUpod() { <> void SiSUpod(T)(T doc_matters) { @@ -33,7 +35,6 @@ template SiSUpod() { } #+END_SRC -* _sisupod_ :sisupod: ** output imports #+name: output_imports @@ -61,11 +62,11 @@ private import std.zip, std.conv : to; import - create_zip_file, - defaults, - output_rgx, - output_xmls, - paths_output; + sdp.create_zip_file, + sdp.defaults, + sdp.output_rgx, + sdp.output_xmls, + sdp.paths_output; #+END_SRC ** mkdir diff --git a/org/output_xmls.org b/org/output_xmls.org index 4c6013c..4ee8074 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -14,11 +14,12 @@ [[./sdp.org][sdp]] [[./][org/]] [[./output_hub.org][output_hub]] -* xml offspring (xhtml html epub) :xml: +* xml offspring (xhtml html epub) :module:sdp:output_xmls: ** format xhtml objects :format: -*** 0. xhtml common template :template: +*** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/output_xmls.d +module sdp.output_xmls; template outputXHTMLs() { <> mixin SiSUoutputRgxInit; @@ -57,12 +58,12 @@ private import std.zip, std.conv : to; import - create_zip_file, - defaults, - output_rgx, - output_xmls, - output_xmls_css, - paths_output; + sdp.create_zip_file, + sdp.defaults, + sdp.output_rgx, + sdp.output_xmls, + sdp.output_xmls_css, + sdp.paths_output; #+END_SRC *** misc @@ -1075,10 +1076,11 @@ auto endnote(O)( } #+END_SRC -** _html_ [#A] :html: -*** template :template: +* _html_ [#A] :module:sdp:output_html: +** module template #+BEGIN_SRC d :tangle ../src/sdp/output_html.d +module sdp.output_html; template outputHTML() { <> mixin outputXHTMLs; @@ -1089,8 +1091,8 @@ template outputHTML() { } #+END_SRC -*** scroll :scroll: -**** switch (sections & objects) format html output +** scroll :scroll: +*** switch (sections & objects) format html output #+name: output_html_scroll #+BEGIN_SRC d @@ -1238,7 +1240,7 @@ void scroll(D,I)( } #+END_SRC -**** write output file +*** write output file #+name: output_html_scroll #+BEGIN_SRC d @@ -1269,8 +1271,8 @@ void scroll_write_output(M,C)( } #+END_SRC -*** seg :seg: -**** switch (sections & objects) format html output +** seg :seg: +*** switch (sections & objects) format html output #+name: output_html_seg #+BEGIN_SRC d @@ -1489,7 +1491,7 @@ void seg(D,I)( } #+END_SRC -**** write output files +*** write output files #+name: output_html_seg #+BEGIN_SRC d @@ -1530,7 +1532,7 @@ void seg_write_output(M,D,E)( } #+END_SRC -*** css :css: +** css :css: #+name: output_html_css #+BEGIN_SRC d @@ -1552,7 +1554,7 @@ void css(M)( } #+END_SRC -** _epub_ [#B] :epub: +* _epub_ [#B] :module:sdp:output_epub3: |-----------------------+--------------------------+---------------------------+----------------------------------| | function | filename | module | variable | @@ -1570,9 +1572,10 @@ void css(M)( | | | | doc_epub3_endnotes[seg_filename] | |-----------------------+--------------------------+---------------------------+----------------------------------| -*** template :template: +** module template #+BEGIN_SRC d :tangle ../src/sdp/output_epub3.d +module sdp.output_epub3; template outputEPub3() { <> mixin InternalMarkup; @@ -1585,9 +1588,9 @@ template outputEPub3() { } #+END_SRC -*** special (epub) files :format: -**** DONE static -***** _identify doc filetype_ (mimetype) [static] +** special (epub) files :format: +*** DONE static +**** _identify doc filetype_ (mimetype) [static] - mimetype file indicating that zip file contains an EPUB @@ -1600,7 +1603,7 @@ string epub3_mimetypes() { } #+END_SRC -***** _identify doc root_ (META-INF/container.xml) [static] rootfile: contains document root path +**** _identify doc root_ (META-INF/container.xml) [static] rootfile: contains document root path - identifies the root package document (so systems can find it), [unchanged from epub2] @@ -1619,8 +1622,8 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> } #+END_SRC -**** constructs (in dir: OEBPS) -***** TODO _doc manifest_ (OEBPS/content.opf) manifest, register content: files, images etc. +*** constructs (in dir: OEBPS) +**** TODO _doc manifest_ (OEBPS/content.opf) manifest, register content: files, images etc. - manifest, listing all resources - provides the default reading order @@ -1703,7 +1706,7 @@ string epub3_oebps_content(D,I,P)(D doc_abstraction, I doc_matters, P parts) { } #+END_SRC -***** _doc navigation epub3_ (OEBPS/toc_nav.xhtml) epub3 navigable toc using Dom structure +**** _doc navigation epub3_ (OEBPS/toc_nav.xhtml) epub3 navigable toc using Dom structure - toc_nav.xhtml declared as nav file in content.opf (epub3 navigation document) @@ -1790,7 +1793,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { } #+END_SRC -***** TODO _doc navigation epub2_ (OEBPS/toc.ncx) navigable toc using Dom structure +**** TODO _doc navigation epub2_ (OEBPS/toc.ncx) navigable toc using Dom structure - toc.ncx (epub2 navigation document) - (replaced in epub3 by a declared xhtml nav file, in our case toc_nav.xhtml) @@ -1884,8 +1887,8 @@ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { } #+END_SRC -*** the document contents :seg: -**** switch (sections & objects) format epub3 xhtml output +** the document contents :seg: +*** switch (sections & objects) format epub3 xhtml output #+name: output_epub3_xhtml_seg #+BEGIN_SRC d @@ -2167,7 +2170,7 @@ void outputEPub3(D,I)( } #+END_SRC -*** write output files +** write output files #+name: output_epub3_xhtml_seg #+BEGIN_SRC d @@ -2367,7 +2370,7 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)( } #+END_SRC -*** zip debug, read zip archive +** zip debug, read zip archive #+name: output_epub3_xhtml_seg #+BEGIN_SRC d diff --git a/org/output_xmls_css.org b/org/output_xmls_css.org index 5b34915..8fd2c6b 100644 --- a/org/output_xmls_css.org +++ b/org/output_xmls_css.org @@ -13,13 +13,14 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. ao css defaults :defaults: -** 0. tangle template +* 0. ao css defaults :module:sdp:output_xmls_css: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/output_xmls_css.d /++ default css settings +/ +module sdp.output_xmls_css; template SiSUcss() { auto SiSUcss() { string css_shared=" diff --git a/org/output_zip.org b/org/output_zip.org index 8dd6f23..98aede6 100644 --- a/org/output_zip.org +++ b/org/output_zip.org @@ -13,10 +13,11 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* _zip_ -** template :template: +* _zip_ :module:sdp:create_zip_file: +** module template #+BEGIN_SRC d :tangle ../src/sdp/create_zip_file.d +module sdp.create_zip_file; template createZipFile() { import std.file; import std.outbuffer; diff --git a/org/sdp.org b/org/sdp.org index edf258e..827a00f 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -23,7 +23,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 14, 0); +enum ver = Version(0, 15, 0); #+END_SRC * 1. sdp (sisu document parser) :sdp: @@ -39,13 +39,13 @@ enum ver = Version(0, 14, 0); ** 0. sdp src/sdp.d :template: -#+BEGIN_SRC d :tangle ../src/sdp.d :shebang #!/usr/bin/env rdmd +#+BEGIN_SRC d :tangle ../src/sisu_d_parser.d :shebang #!/usr/bin/env rdmd /+ sdp +/ import - compile_time_info, - abstraction; + sdp.compile_time_info, + sdp.abstraction; <> <> <> @@ -88,18 +88,18 @@ unittest { #+BEGIN_SRC d /+ sdp: sisu document parser, see http://sisudoc.org +/ import - abstraction_summary, - ao_abstract_doc_source, - ao_conf_make_meta, - ao_conf_make_meta_native, - ao_conf_make_meta_sdlang, - ao_defaults, - ao_doc_debugs, - ao_read_config_files, - ao_read_source_files, - ao_rgx, - output_hub, - paths_source; + 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; #+END_SRC ****** notes @@ -440,10 +440,11 @@ writeln("no recognized filename"); break; // terminate, stop #+END_SRC -* 2. _document abstraction functions_ -** 0. abstraction template [#A] :template: +* 2. _document abstraction functions_ :module:sdp:abstraction: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/abstraction.d +module sdp.abstraction; template SiSUabstraction() { <> <> @@ -615,10 +616,11 @@ struct DocumentMatters { auto doc_matters = DocumentMatters(); #+END_SRC -* 3. document abstraction _summary_ :summary:doc: -** 0. template: :template: +* 3. document abstraction _summary_ :module:sdp:abstraction_summary: +** 0. module template #+BEGIN_SRC d :tangle ../src/sdp/abstraction_summary.d +module sdp.abstraction_summary; template SiSUabstractionSummary() { auto SiSUabstractionSummary(S,T)( auto return ref const S doc_abstraction, @@ -640,8 +642,8 @@ template SiSUabstractionSummary() { #+name: abstraction_summary_imports #+BEGIN_SRC d import - ao_defaults, - ao_rgx; + sdp.ao_defaults, + sdp.ao_rgx; import std.array, std.exception, diff --git a/src/sdp.d b/src/sdp.d deleted file mode 100755 index ceb1e3b..0000000 --- a/src/sdp.d +++ /dev/null @@ -1,230 +0,0 @@ -#!/usr/bin/env rdmd -/+ - sdp -+/ -import - compile_time_info, - abstraction; -/+ sdp: sisu document parser, see http://sisudoc.org +/ -import - abstraction_summary, - ao_abstract_doc_source, - ao_conf_make_meta, - ao_conf_make_meta_native, - ao_conf_make_meta_sdlang, - ao_defaults, - ao_doc_debugs, - ao_read_config_files, - ao_read_source_files, - ao_rgx, - output_hub, - paths_source; -/+ sdlang http://sdlang.org +/ -import sdlang; -/+ std +/ -private import - std.array, - std.exception, - std.getopt, - std.process, - std.stdio, - std.regex, - std.string, - std.traits, - std.typecons, - std.utf, - std.conv : to; - -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" - +/ -} diff --git a/src/sdp/abstraction.d b/src/sdp/abstraction.d index 726513c..40cf4d3 100644 --- a/src/sdp/abstraction.d +++ b/src/sdp/abstraction.d @@ -1,18 +1,19 @@ +module sdp.abstraction; template SiSUabstraction() { /+ sdp: sisu document parser, see http://sisudoc.org +/ import - abstraction_summary, - ao_abstract_doc_source, - ao_conf_make_meta, - ao_conf_make_meta_native, - ao_conf_make_meta_sdlang, - ao_defaults, - ao_doc_debugs, - ao_read_config_files, - ao_read_source_files, - ao_rgx, - output_hub, - paths_source; + 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 +/ import sdlang; /+ std +/ diff --git a/src/sdp/abstraction_summary.d b/src/sdp/abstraction_summary.d index fe97783..9532fc7 100644 --- a/src/sdp/abstraction_summary.d +++ b/src/sdp/abstraction_summary.d @@ -1,11 +1,12 @@ +module sdp.abstraction_summary; template SiSUabstractionSummary() { auto SiSUabstractionSummary(S,T)( auto return ref const S doc_abstraction, auto return ref T doc_matters, ) { import - ao_defaults, - ao_rgx; + sdp.ao_defaults, + sdp.ao_rgx; import std.array, std.exception, diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index baf13b8..ab7cc99 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -3,13 +3,14 @@ abstraction of sisu markup for downstream processing ao_abstract_doc_source.d +/ +module sdp.ao_abstract_doc_source; template SiSUdocAbstraction() { /+ ↓ abstraction imports +/ import - ao_defaults, - ao_object_setter, - ao_rgx, - output_hub; + sdp.ao_defaults, + sdp.ao_object_setter, + sdp.ao_rgx, + sdp.output_hub; private import std.algorithm, std.array, diff --git a/src/sdp/ao_conf_make_meta.d b/src/sdp/ao_conf_make_meta.d index b34b7f3..52cc98d 100644 --- a/src/sdp/ao_conf_make_meta.d +++ b/src/sdp/ao_conf_make_meta.d @@ -8,6 +8,7 @@ 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; template SiSUheaderExtractHub() { private import std.exception, @@ -19,9 +20,9 @@ template SiSUheaderExtractHub() { std.conv : to; private import sdlang; private import - ao_rgx, - ao_conf_make_meta_native, - ao_conf_make_meta_sdlang; + sdp.ao_rgx, + sdp.ao_conf_make_meta_native, + sdp.ao_conf_make_meta_sdlang; 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 500be52..899b59f 100644 --- a/src/sdp/ao_conf_make_meta_native.d +++ b/src/sdp/ao_conf_make_meta_native.d @@ -2,6 +2,7 @@ native headers using
@title:
:subtitle:
type tags
extract native/orig header return associative array +/ +module sdp.ao_conf_make_meta_native; template SiSUheaderExtractNative() { private import std.exception, @@ -13,8 +14,8 @@ template SiSUheaderExtractNative() { std.utf, std.conv : to; private import - ao_rgx, - ao_defaults; + sdp.ao_rgx, + sdp.ao_defaults; 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 74bb996..1fb8993 100644 --- a/src/sdp/ao_conf_make_meta_sdlang.d +++ b/src/sdp/ao_conf_make_meta_sdlang.d @@ -2,6 +2,7 @@ sdlang headers
extract sdlang header return sdlang +/ +module sdp.ao_conf_make_meta_sdlang; template SiSUheaderExtractSDLang() { private import std.exception, @@ -13,8 +14,8 @@ template SiSUheaderExtractSDLang() { std.utf, std.conv : to; private import - ao_rgx, - ao_defaults; + sdp.ao_rgx, + sdp.ao_defaults; struct HeaderExtractSDL { mixin SiSUregisters; mixin SiSUrgxInit; diff --git a/src/sdp/ao_defaults.d b/src/sdp/ao_defaults.d index 363cc39..6363fdc 100644 --- a/src/sdp/ao_defaults.d +++ b/src/sdp/ao_defaults.d @@ -1,6 +1,7 @@ /++ default settings +/ +module sdp.ao_defaults; template SiSUregisters() { private import std.algorithm, diff --git a/src/sdp/ao_doc_debugs.d b/src/sdp/ao_doc_debugs.d index e650e5b..2c78c76 100644 --- a/src/sdp/ao_doc_debugs.d +++ b/src/sdp/ao_doc_debugs.d @@ -1,10 +1,11 @@ /++ output debugs +/ +module sdp.ao_doc_debugs; template SiSUdebugs() { import - ao_defaults, - ao_rgx; + sdp.ao_defaults, + sdp.ao_rgx; private import std.algorithm, std.array, diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d index f09e64d..a5ddb4a 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao_object_setter.d @@ -3,6 +3,7 @@ setting of sisu objects for downstream processing ao_object_setter.d +/ +module sdp.ao_object_setter; template ObjectSetter() { /+ structs +/ struct HeadingAttrib { diff --git a/src/sdp/ao_read_config_files.d b/src/sdp/ao_read_config_files.d index 2cdf861..b8d9890 100644 --- a/src/sdp/ao_read_config_files.d +++ b/src/sdp/ao_read_config_files.d @@ -3,6 +3,7 @@ - read config files
ao_config_files.d +/ +module sdp.ao_read_config_files; template ConfigIn() { private import std.algorithm, diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d index 33e7987..b6ad942 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao_read_source_files.d @@ -3,9 +3,10 @@ - open markup files
- if master file scan for addional files to import/insert +/ +module sdp.ao_read_source_files; template SiSUrawMarkupContent() { private import - ao_rgx; + sdp.ao_rgx; private import std.algorithm, std.array, @@ -139,7 +140,7 @@ template SiSUrawMarkupContent() { } } struct Inserts { - private import ao_defaults; + private 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 38c7fae..29a96af 100644 --- a/src/sdp/ao_rgx.d +++ b/src/sdp/ao_rgx.d @@ -1,8 +1,9 @@ /++ regex: regular expressions used in sisu document parser +/ +module sdp.ao_rgx; template SiSUrgxInit() { - private import ao_defaults; + private import sdp.ao_defaults; struct Rgx { /+ misc +/ static true_dollar = ctRegex!(`\$`, "gm"); diff --git a/src/sdp/compile_time_info.d b/src/sdp/compile_time_info.d index 2b0151d..cf4d0a5 100644 --- a/src/sdp/compile_time_info.d +++ b/src/sdp/compile_time_info.d @@ -1,6 +1,7 @@ /++ compile_time_info +/ +module sdp.compile_time_info; template CompileTimeInfo() { version(Windows) { pragma(msg, "[ Windows compilation ]"); diff --git a/src/sdp/create_zip_file.d b/src/sdp/create_zip_file.d index 6ea55f4..93e85ee 100644 --- a/src/sdp/create_zip_file.d +++ b/src/sdp/create_zip_file.d @@ -1,3 +1,4 @@ +module sdp.create_zip_file; template createZipFile() { import std.file; import std.outbuffer; diff --git a/src/sdp/defaults.d b/src/sdp/defaults.d index d4e4220..a344f7f 100644 --- a/src/sdp/defaults.d +++ b/src/sdp/defaults.d @@ -1,6 +1,7 @@ /++ default settings +/ +module sdp.defaults; template InternalMarkup() { struct InlineMarkup { diff --git a/src/sdp/output_epub3.d b/src/sdp/output_epub3.d index 56f9be3..6cc496c 100644 --- a/src/sdp/output_epub3.d +++ b/src/sdp/output_epub3.d @@ -1,3 +1,4 @@ +module sdp.output_epub3; template outputEPub3() { private import std.algorithm, @@ -22,12 +23,12 @@ template outputEPub3() { std.zip, std.conv : to; import - create_zip_file, - defaults, - output_rgx, - output_xmls, - output_xmls_css, - paths_output; + sdp.create_zip_file, + sdp.defaults, + sdp.output_rgx, + sdp.output_xmls, + sdp.output_xmls_css, + sdp.paths_output; mixin InternalMarkup; mixin outputXHTMLs; string epub3_mimetypes() { diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d index 363ff4a..41d68dd 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -1,3 +1,4 @@ +module sdp.output_html; template outputHTML() { private import std.algorithm, @@ -22,12 +23,12 @@ template outputHTML() { std.zip, std.conv : to; import - create_zip_file, - defaults, - output_rgx, - output_xmls, - output_xmls_css, - paths_output; + sdp.create_zip_file, + sdp.defaults, + sdp.output_rgx, + sdp.output_xmls, + sdp.output_xmls_css, + sdp.paths_output; mixin outputXHTMLs; void scroll(D,I)( diff --git a/src/sdp/output_hub.d b/src/sdp/output_hub.d index 389d187..ef8156c 100644 --- a/src/sdp/output_hub.d +++ b/src/sdp/output_hub.d @@ -2,6 +2,7 @@ output hub
check & generate output types requested +/ +module sdp.output_hub; template outputHub() { private import std.regex, @@ -22,14 +23,14 @@ template outputHub() { std.uni, std.utf; import - create_zip_file, - defaults, - output_epub3, - output_html, - output_rgx, - output_xmls, - paths_output, - source_sisupod; + sdp.defaults, + sdp.output_epub3, + sdp.output_html, + sdp.output_rgx, + sdp.output_xmls, + sdp.source_sisupod, + sdp.create_zip_file, + sdp.paths_output; void outputHub(D,I)(D doc_abstraction, I doc_matters) { mixin SiSUoutputRgxInit; auto rgx = Rgx(); diff --git a/src/sdp/output_rgx.d b/src/sdp/output_rgx.d index be0a91e..af0751e 100644 --- a/src/sdp/output_rgx.d +++ b/src/sdp/output_rgx.d @@ -1,8 +1,9 @@ /++ regex: regular expressions used in sisu document parser +/ +module sdp.output_rgx; template SiSUoutputRgxInit() { - private import defaults; + private import sdp.defaults; struct Rgx { static newline = ctRegex!("\n", "mg"); static strip_br = ctRegex!("^
\n|
\n*$"); diff --git a/src/sdp/output_xmls.d b/src/sdp/output_xmls.d index a408872..373a871 100644 --- a/src/sdp/output_xmls.d +++ b/src/sdp/output_xmls.d @@ -1,3 +1,4 @@ +module sdp.output_xmls; template outputXHTMLs() { private import std.algorithm, @@ -22,12 +23,12 @@ template outputXHTMLs() { std.zip, std.conv : to; import - create_zip_file, - defaults, - output_rgx, - output_xmls, - output_xmls_css, - paths_output; + sdp.create_zip_file, + sdp.defaults, + sdp.output_rgx, + sdp.output_xmls, + sdp.output_xmls_css, + sdp.paths_output; mixin SiSUoutputRgxInit; struct outputXHTMLs { auto rgx = Rgx(); diff --git a/src/sdp/output_xmls_css.d b/src/sdp/output_xmls_css.d index c746b16..eb1ab2b 100644 --- a/src/sdp/output_xmls_css.d +++ b/src/sdp/output_xmls_css.d @@ -1,6 +1,7 @@ /++ default css settings +/ +module sdp.output_xmls_css; template SiSUcss() { auto SiSUcss() { string css_shared=" diff --git a/src/sdp/paths_output.d b/src/sdp/paths_output.d index e9599db..ea68567 100644 --- a/src/sdp/paths_output.d +++ b/src/sdp/paths_output.d @@ -1,11 +1,12 @@ /++ default settings +/ +module sdp.paths_output; import std.array, std.path, std.regex, std.stdio; -import ao_rgx; +import sdp.ao_rgx; template SiSUpathsSisupod() { mixin SiSUrgxInit; auto rgx = Rgx(); diff --git a/src/sdp/paths_source.d b/src/sdp/paths_source.d index f60949d..b5a60e8 100644 --- a/src/sdp/paths_source.d +++ b/src/sdp/paths_source.d @@ -3,11 +3,12 @@ - read config files
ao_config_files.d +/ +module sdp.paths_source; import std.array, std.path, std.regex, std.stdio; -import ao_rgx; +import sdp.ao_rgx; template SiSUpathsSRC() { mixin SiSUrgxInit; auto rgx = Rgx(); diff --git a/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d index e5233ba..7babba3 100644 --- a/src/sdp/source_sisupod.d +++ b/src/sdp/source_sisupod.d @@ -1,3 +1,4 @@ +module sdp.source_sisupod; template SiSUpod() { private import std.algorithm, @@ -22,11 +23,11 @@ template SiSUpod() { std.zip, std.conv : to; import - create_zip_file, - defaults, - output_rgx, - output_xmls, - paths_output; + sdp.create_zip_file, + sdp.defaults, + sdp.output_rgx, + sdp.output_xmls, + sdp.paths_output; void SiSUpod(T)(T doc_matters) { debug(asserts) { // static assert(is(typeof(doc_matters) == tuple)); diff --git a/src/sisu_d_parser.d b/src/sisu_d_parser.d new file mode 100755 index 0000000..87b25e9 --- /dev/null +++ b/src/sisu_d_parser.d @@ -0,0 +1,230 @@ +#!/usr/bin/env rdmd +/+ + sdp ++/ +import + sdp.compile_time_info, + sdp.abstraction; +/+ sdp: sisu document parser, see http://sisudoc.org +/ +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 +/ +import sdlang; +/+ std +/ +private import + std.array, + std.exception, + std.getopt, + std.process, + std.stdio, + std.regex, + std.string, + std.traits, + std.typecons, + std.utf, + std.conv : to; + +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" + +/ +} diff --git a/views/version.txt b/views/version.txt index 2750f99..ded3634 100644 --- a/views/version.txt +++ b/views/version.txt @@ -4,4 +4,4 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 14, 0); +enum ver = Version(0, 15, 0); -- cgit v1.2.3