aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/sdp.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/sdp.org')
-rw-r--r--org/sdp.org190
1 files changed, 175 insertions, 15 deletions
diff --git a/org/sdp.org b/org/sdp.org
index 80b7a45..4d221bb 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -28,7 +28,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 4, 1);
+enum ver = Version(0, 5, 0);
#+END_SRC
** pre loop init
@@ -60,7 +60,7 @@ import
compile_time_info, // sdp/compile_time_info.d
ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d
ao_defaults, // sdp/ao_defaults.d
- ao_header_extract, // sdp/ao_header_extract.d
+ ao_read_config_files, // sdp/ao_read_config_files.d
ao_read_source_files, // sdp/ao_read_source_files.d
ao_output_debugs, // sdp/ao_output_debugs.d
ao_rgx, // sdp/ao_rgx.d
@@ -69,6 +69,16 @@ import
// std.conv;
#+END_SRC
+**** sdlang :import:sdlang:
+#+NAME: sdlang_imports_use
+#+BEGIN_SRC d
+/+ sdlang http://sdlang.org +/
+import sdlang; // sdlang.d
+ // sdlang.parser, // sdlang/parser.d
+ // sdlang.exceptions; // sdp/ao_ansi_colors.d
+ // // std.conv;
+#+END_SRC
+
**** std :import:std:
#+NAME: sdp_imports
#+BEGIN_SRC d
@@ -95,8 +105,9 @@ private import
std.conv : to;
#+END_SRC
-*** sdp output :output:
-#+NAME: sdp_args
+**** sdp output check selection :output:
+
+#+NAME: sdp_output_selection
#+BEGIN_SRC d
struct SDPoutput {
auto hub(S)(
@@ -163,10 +174,9 @@ mixin(import("version.txt"));
#+NAME: sdp_args
#+BEGIN_SRC d
mixin SiSUheaderSkel;
-mixin SiSUheaderExtract;
mixin SiSUbiblio;
mixin SiSUrgxInitFlags;
-// mixin SiSUconfiguration;
+mixin SiSUconfiguration;
mixin SiSUmarkupRaw;
mixin SiSUdocAbstraction;
mixin SiSUoutputDebugs;
@@ -179,7 +189,7 @@ mixin ScreenTxtColors;
#+NAME: sdp_args
#+BEGIN_SRC d
auto raw = MarkupRaw();
-auto head = HeaderDocMetadataMakeJson();
+auto headsdl = HeaderExtractSDL();
auto abs = Abstraction();
auto dbg = SDPoutputDebugs();
auto output = SDPoutput();
@@ -294,6 +304,62 @@ foreach(arg; args) {
}
#+END_SRC
+*** config files (load) :config:files:
+#+BEGIN_SRC text
+./.sisu ./_sisu ~/.sisu /etc/.sisu
+#+END_SRC
+
+#+BEGIN_SRC d
+// string[string] envVars = environment.toAA();
+// writeln(envVars);
+/+
+writefln(
+ "pwd: %s; home: %s",
+ environment["PWD"],
+ environment["HOME"]
+);
++/
+#+END_SRC
+
+**** config load
+#+NAME: sdp_config_files
+#+BEGIN_SRC d
+auto conf = Config();
+auto configuration = conf.readInConfigFile();
+#+END_SRC
+
+**** config read
+
+#+NAME: sdp_config_files
+#+BEGIN_SRC d
+/+ sdlang config +/
+Tag sdl_root_conf;
+try {
+ sdl_root_conf = parseSource(configuration);
+}
+catch(SDLangParseException e) {
+ stderr.writeln("SDLang problem with config.sdl content");
+ // Error messages of the form:
+ // myFile.sdl(5:28): Error: Invalid integer suffix.
+ stderr.writeln(e.msg);
+}
+debug(sdlang) {
+ // Value is a std.variant.Algebraic
+ Value output_dir_structure_by = sdl_root_conf.tags["output_dir_structure_by"][0].values[0];
+ assert(output_dir_structure_by.type == typeid(string));
+ writeln(output_dir_structure_by);
+
+ // Tag person = sdl_root_conf.namespaces["myNamespace"].tags["person"][0];
+ // writeln("Name: ", person.attributes["name"][0].value);
+ //
+ // int age = person.tags["age"][0].values[0].get!int();
+ // writeln("Age: ", age);
+
+ writeln("config SDL:");
+ writeln(sdl_root_conf.toSDLDocument());
+}
+#+END_SRC
+
** each file (loop) [+2] :loop:files:
*** filename provided [+1] :file:process:
**** loop scope :scope:
@@ -342,18 +408,15 @@ debug(header_and_content) {
**** [#A] read doc header: metadata & make :doc:header:metadata:make:
#+NAME: sdp_each_file_do
#+BEGIN_SRC d
-/+ ↓ headers metadata & make +/
-auto header_content = head.headerContentJSON(header);
-static assert(!isTypeTuple!(header_content));
-auto dochead_make_json = header_content[0];
-auto dochead_meta_json = header_content[1];
+/+ ↓ headers metadata & make sdlang +/
+auto header_sdlang = headsdl.headerSDLang(header);
#+END_SRC
**** [#A] processing: document abstraction, tuple :processing:
#+NAME: sdp_each_file_do
#+BEGIN_SRC d
/+ ↓ porcess document, return abstraction as tuple +/
-auto t = abs.abstract_doc_source(sourcefile_content, dochead_make_json, dochead_meta_json);
+auto t = abs.abstract_doc_source(sourcefile_content);
static assert(!isTypeTuple!(t));
auto doc_ao_contents = t[0]; // contents ~ endnotes ~ bookindex;
// static assert(!isIterable!(doc_ao_contents));
@@ -372,8 +435,8 @@ debug(checkdoc) { // checkbook & dumpdoc
doc_ao_contents,
doc_ao_bookindex_unordered_hashes,
doc_ao_biblio,
- dochead_make_json,
- dochead_meta_json,
+ // doc_ao_make_json,
+ // doc_ao_metadata_json,
fn_src,
opt_action_bool
);
@@ -436,13 +499,16 @@ break;
sdp.d
+/
<<sdp_imports_use>>
+<<sdlang_imports_use>>
<<sdp_imports>>
+<<sdp_output_selection>>
<<sdp_version_mixin>>
mixin CompileTimeInfo;
mixin RgxInit;
void main(string[] args) {
<<sdp_compilation>>
<<sdp_args>>
+ <<sdp_config_files>>
foreach(fn_src; fns_src) {
// foreach(fn_src; fns_src) {
if (!empty(fn_src)) {
@@ -505,3 +571,97 @@ figure out best program dir structure for dub and compilers, issue with rdmd
|---------------------+------------------------------------------+------------------------+--------|
| metadata | | (from regular header) | output |
|---------------------+------------------------------------------+------------------------+--------|
+
+** config :config:
+using sdlang in sdp
+*** sdp config and header? file format? sdl ? yml ? json ? :sdl:sdlang:
+
+[[https://sdlang.org/][SDL: Simple Declarative Language]] [[http://sdl4r.rubyforge.org/syntaxhighlighter_brush.html][highlighter]]
+https://github.com/Abscissa/SDLang-D
+https://github.com/Abscissa/SDLang-D/blob/master/HOWTO.md
+
+**** build/ compile
+
+The recommended way to use SDLang-D is via DUB. Just add a dependency to
+sdlang-d in your project's dub.json or dub.sdl file as shown here. Then simply
+build your project with DUB as usual. dub dependency
+http://code.dlang.org/packages/sdlang-d
+
+
+Alternatively, you can git clone both SDLang-D and the latest version of
+libInputVisitor,
+
+#+BEGIN_SRC d :tangle no
+git clone https://github.com/Abscissa/SDLang-D
+git clone https://github.com/abscissa/libInputVisitor
+#+END_SRC
+
+ and when running the compiler include:
+
+#+BEGIN_SRC d :tangle no
+ -I{path to SDLang-D}/src -I{path to libInputVisitor}/src
+#+END_SRC
+
+**** Importing
+
+To use SDL, first import the module sdlang:
+
+#+BEGIN_SRC d :tangle no
+import sdlang;
+#+END_SRC
+
+If you're not using DUB, then you must also include the path the SDLang-D sources when you compile:
+
+#+BEGIN_SRC d :tangle no
+rdmd --build-only -I{path to sdlang}/src -I{path to libInputVisitor}/src {other flags} yourProgram.d
+#+END_SRC
+
+**** misc
+http://forum.dlang.org/thread/hphtqkkmrfnlcipnxzai@forum.dlang.org
+http://forum.dlang.org/thread/gnfctbuhiemidetngrzi@forum.dlang.org?page=23#post-rlxlfveyyzgewhkxhhta:40forum.dlang.org
+
+*** other links
+http://semitwist.com/sdlang-d-docs/v0.9.3/sdlang.html http://semitwist.com/sdlang-d-docs/
+
+** read markup files
+**** regular .sst
+relatively straight forward
+**** master .ssm
+master files have been able to read in inser files .ssi and regular files .sst
+***** reading in .ssi files is straightforward
+***** reading in .sst files is more problematic
+.sst files have their own root (structure)
+either
+- the root needs to be disabled - not used
+or
+- the root tree needs to be demoted, which is only possible if markup from
+ heading D is not reached then A - C could be demoted to B - D
+- the other issue there is that it is common not to write out heading level A
+ text but to rely on the metadata for title and author, the issue there is that
+ at present the header for .sst files that are imported is just lopped off and
+ thrown away. At least the title and author information for each imported .sst
+ file would have to read and available for use in its header A that is demoted
+ to B
+
+** processing files, currently using utf8
+** src dir structure & files
+#+BEGIN_SRC txt :tangle no
+tree /home/ralph/sisu_www/current/src/democratizing_innovation.eric_von_hippel.sst
+
+/home/ralph/sisu_www/current/src/
+democratizing_innovation.eric_von_hippel.sst
+└── sisupod
+ ├── doc
+ │   ├── en
+ │   │   └── democratizing_innovation.eric_von_hippel.sst
+ │   └── _sisu
+ │   └── sisu_document_make // [interesting as part of larger conf.sdl]
+ └── image
+ ├── di_evh_f10-1.png
+ ├── di_evh_f11-1.png
+ ├── di_evh_f11-2.png
+ ├── di_evh_f1-1.png
+ ├── di_evh_f5-1.png
+ └── di_evh.png
+
+#+END_SRC