From 6d0b245927779e68c2554880ad46d4299d4b11d4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 2 Dec 2015 18:23:00 -0500 Subject: sorting --- lib/sdp.d | 196 +++++++++++++++++++++++++++++++++++++ lib/sdp/ao_abstract_doc_source.d | 4 +- lib/sdp/ao_defaults.d | 4 +- lib/sdp/ao_rgx.d | 4 +- lib/sdp/ao_scan_inserts.d | 32 +++--- makefile | 6 +- maker.org | 16 +-- org/ao_abstract_doc_source.org | 105 ++++++++++---------- org/ao_assertions.org | 13 +-- org/ao_defaults.org | 21 ++-- org/ao_emitters_and_interfaces.org | 49 +++++----- org/ao_markup_source_raw.org | 21 ++-- org/ao_object_setter.org | 19 ++-- org/ao_output_debugs.org | 25 ++--- org/ao_rgx.org | 50 +++++----- org/ao_scan_inserts.org | 47 ++++----- org/ao_utils.org | 25 ++++- org/sdp.org | 90 +++++++++++------ tangle | 2 +- 19 files changed, 495 insertions(+), 234 deletions(-) create mode 100755 lib/sdp.d diff --git a/lib/sdp.d b/lib/sdp.d new file mode 100755 index 0000000..7f94128 --- /dev/null +++ b/lib/sdp.d @@ -0,0 +1,196 @@ +#!/usr/bin/env rdmd + +/* + sdp + sdp.d +*/ +/+ sdp sisu document parser +/ +import + std.algorithm, + std.array, + std.container, + std.file, + std.exception, + std.json, + // std.path, + std.process, + std.range, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + std.utf, + // std.variant, + lib.sdp.ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d + lib.sdp.ao_assertions, // sdp/ao_assertions.d + lib.sdp.ao_defaults, // sdp/ao_defaults.d + lib.sdp.ao_emitter, // sdp/ao_emitter.d + lib.sdp.ao_interface, // sdp/ao_interface.d + lib.sdp.ao_markup_source_raw, // sdp/ao_markup_source_raw.d + lib.sdp.ao_object_setter, // sdp/ao_object_setter.d + lib.sdp.ao_output_debugs, // sdp/ao_output_debugs.d + lib.sdp.ao_rgx, // sdp/ao_rgx.d + lib.sdp.ao_scan_inserts, // sdp/ao_scan_inserts.d + lib.sdp.ao_utils; // sdp/ao_utils.d + // std.conv; +import std.conv : to; +mixin RgxInit; mixin Interfaces; mixin Emitters; +void main(string[] argv) { + mixin SiSUheader; + mixin SiSUbiblio; + mixin SiSUrgxInitFlags; + mixin SiSUmarkupRaw; + mixin SiSUdocInserts; + mixin SiSUdocAbstraction; + mixin SiSUoutputDebugs; + mixin ScreenTxtColors; + auto cli = new CLI(); + auto raw = new MarkupRaw(); + auto abs = new Abstraction(); + auto dbg = new SDPoutputDebugs(); + // struct DocumentParts { + // string[string][] contents; + // JSONValue[string] metadata_json; + // JSONValue[string] make_json; + // string[][string][string] bookindex_unordered_hashes; + // JSONValue[] biblio; + // } + char[][] msc; + string[1000] fns_src; + string flag_action; + string[string] actions; + int file_count; + actions = [ + "assert" : "yes", + ]; + auto rgx = new Rgx(); + scope(success) { + debug(checkdoc) { + writeln( + scr_txt_color["cyan"], + "~ run complete, ok ~ ", + scr_txt_color["off"], + ); + } + // writeln("0"); + } + scope(failure) { + debug(checkdoc) { + writeln( + scr_txt_color["fuchsia"], + "~ run failure ~", + scr_txt_color["off"], + ); + } + // writeln("1"); + } + foreach(cmdlnins; argv) { + if (match(cmdlnins, rgx.flag_action)) { + flag_action ~= " " ~ cmdlnins; + actions = cli.extract_actions(cmdlnins, actions); + } else if (match(cmdlnins, rgx.src_pth)) { + fns_src[file_count] = cmdlnins; + file_count++; + } + } + foreach(fn_src; fns_src) { + if (!empty(fn_src)) { + scope(success) { + debug(checkdoc) { + writeln( + scr_txt_color["green"], + "~ document complete, ok ~ ", + scr_txt_color["off"], + fn_src + ); + } + // writeln("0"); + } + scope(failure) { + debug(checkdoc) { + writeln( + scr_txt_color["red"], + "~ document run failure ~", + scr_txt_color["off"], + fn_src + ); + } + // writeln("1"); + } + enforce( + match(fn_src, rgx.src_pth), + "not a sisu markup filename" + ); + auto markup_sourcefile_content = + raw.markupSourceContentRawLineArray(fn_src); // alternative call + // raw.markupSourceLineArray(raw.markupSourceString(fn_src)); // alternative calls (milliseconds faster?) + debug(insert) { + string[string] sysenv; + sysenv["pwd"] = shell("pwd"); + writeln(sysenv["pwd"]); + auto m = match(fn_src, rgx.src_pth); + // auto m = match(fn_src, rgx.src_pth); + auto markup_src_file_path = m.captures[1]; + writeln("markup source file path: ", markup_src_file_path); // writeln(m.captures[1]); + writeln(m.captures[2]); + } + if (match(fn_src, rgx.src_fn_master)) { + /+ if master file scan document source for document imports (inserted sub-documents) +/ + auto ins = new Inserts(); + auto markup_master_sourcefile_content = + ins.scan_doc_source(markup_sourcefile_content, fn_src); + msc = markup_master_sourcefile_content; + } else if (match(fn_src, rgx.src_fn)) { + msc = markup_sourcefile_content; + } else { + writeln("not a recognized filename"); + } + debug(raw) { + foreach (line; msc) { + writeln(line); + } + } + /+ process document ao_abstract_doc_source SiSUdocAbstraction::Abstraction return abstraction as tuple +/ + auto t = + abs.abstract_doc_source(msc); + static assert(!isTypeTuple!(t)); + auto contents = t[0]; + // static assert(!isIterable!(contents)); + auto metadata_json = t[1]; + auto make_json = t[2]; + auto bookindex_unordered_hashes = t[3]; + auto biblio = t[4]; + // destroy(t); + // DocumentParts + debug(checkdoc) { + dbg.abstract_doc_source_debugs( + contents, + make_json, + metadata_json, + bookindex_unordered_hashes, + biblio, + fn_src, + actions + ); + } + // compose abstract document markup state + // append book index + scope(exit) { + destroy(msc); + destroy(t); + destroy(contents); + destroy(make_json); + destroy(metadata_json); + destroy(bookindex_unordered_hashes); + destroy(fn_src); + destroy(biblio); + } + } else { + /* no recognized filename provided */ + writeln("no recognized filename"); + break; + // terminate, stop + } + } +} diff --git a/lib/sdp/ao_abstract_doc_source.d b/lib/sdp/ao_abstract_doc_source.d index 303011b..941c3f0 100644 --- a/lib/sdp/ao_abstract_doc_source.d +++ b/lib/sdp/ao_abstract_doc_source.d @@ -6,7 +6,7 @@ mixin template SiSUdocAbstraction() { class Abstraction { /* abstract marked up document */ auto abstract_doc_source(char[][] markup_sourcefile_content) { - /* initialize */ + /+ initialize +/ mixin ObjectSetters; mixin AssertionsOnMarkupDocumentStructure; mixin AssertionsOnBlocks; @@ -23,7 +23,7 @@ mixin template SiSUdocAbstraction() { string[1024] biblio_arr_json = biblio_entry_tags_jsonstr; JSONValue[1024] bib_arr_json; uint[string] line_occur; - int counter, previous_count, count_biblio_entry, ocn, ocn_, verse_line, bib_entry, heading_pointer, notepoint; + uint counter, previous_count, count_biblio_entry, ocn, ocn_, verse_line, bib_entry, heading_pointer, notepoint; string indent_first, indent_second; string[][string][string] bookindex_unordered_hashes; bool bullet = true; diff --git a/lib/sdp/ao_defaults.d b/lib/sdp/ao_defaults.d index 6599e69..50c1b09 100644 --- a/lib/sdp/ao_defaults.d +++ b/lib/sdp/ao_defaults.d @@ -75,7 +75,7 @@ template SiSUheader() { }, "links": { } - }`; + }`; // links auto pointer_head_main = [ "creator", @@ -228,7 +228,7 @@ template SiSUbiblio() { "note" : "", "short_name" : "", "id" : "" - }`; + }`; // is: book, article, magazine, newspaper, blog, other auto biblio_tag_map = [ "au" : "author_raw", "ed" : "editor_raw", diff --git a/lib/sdp/ao_rgx.d b/lib/sdp/ao_rgx.d index 21101b5..7050d25 100644 --- a/lib/sdp/ao_rgx.d +++ b/lib/sdp/ao_rgx.d @@ -27,8 +27,10 @@ mixin template RgxInit() { static levels_numbered_headings = ctRegex!(`^[0-7]$`); /* insert markup file */ static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`); - /* header & comments */ + // static insert_ssi_or_sst_fn = ctRegex!(`^<<\s*[a-zA-Z0-9._-]+[.]ss[ti]`); + /* comments */ static comment = ctRegex!(`^%+ `); + /* header */ static header = ctRegex!(`^@([a-z_]+):(?:\s|$)`); static header_make = ctRegex!(`^@(make):(?:\s|$)`); static header_metadata = ctRegex!(`^@([a-z_]+):(?:\s|$)`); diff --git a/lib/sdp/ao_scan_inserts.d b/lib/sdp/ao_scan_inserts.d index ab705eb..54abb8f 100644 --- a/lib/sdp/ao_scan_inserts.d +++ b/lib/sdp/ao_scan_inserts.d @@ -1,7 +1,7 @@ -/* +/+ inserts ao_inserts.d -*/ ++/ mixin template SiSUdocInserts() { class Inserts { auto scan_subdoc_source( @@ -87,8 +87,8 @@ mixin template SiSUdocInserts() { markup_sourcesubfile_insert_content.length ); } - auto ins = new Inserts(); - /* + auto ins = new Inserts(); + /+ 1. load file, 2. read lines; 3. scan lines, @@ -96,7 +96,7 @@ mixin template SiSUdocInserts() { 5. repeat 1 6. else 7. add line to new array; - */ + +/ } else { ft1["header_make"] = 0; ft1["header_metadata"] = 0; @@ -192,16 +192,16 @@ mixin template SiSUdocInserts() { markup_sourcefile_insert_content.length ); } - auto ins = new Inserts(); - auto t = ins.scan_subdoc_source( - markup_sourcefile_insert_content, to!string(fn_src_insert), add - ); - static assert(!isTypeTuple!(t)); - auto tmparr = t[0]; - auto addsub = t[1]; - cont_arbitrary_max_length_set[add .. addsub-1] = tmparr[0 .. $-1]; - add=addsub; - /* + auto ins = new Inserts(); + auto t = ins.scan_subdoc_source( + markup_sourcefile_insert_content, to!string(fn_src_insert), add + ); + static assert(!isTypeTuple!(t)); + auto tmparr = t[0]; + auto addsub = t[1]; + cont_arbitrary_max_length_set[add .. addsub-1] = tmparr[0 .. $-1]; + add=addsub; + /+ 1. load file, 2. read lines; 3. scan lines, @@ -209,7 +209,7 @@ mixin template SiSUdocInserts() { 5. repeat 1 6. else 7. add line to new array; - */ + +/ } else { ft["header_make"] = 0; ft["header_metadata"] = 0; diff --git a/makefile b/makefile index 3f769bd..f3fc0d3 100644 --- a/makefile +++ b/makefile @@ -14,10 +14,10 @@ GDC_FLAGS= GDC_FLAGS_RELEASE=-frelease GDC_FLAG_BINOF=-o -# set D_COMPILER one of DMD LDC or GDC: +# SET_D_COMPILER=(one of: DMD LDC or GDC): SET_D_COMPILER=LDC -SET_DC_FLAGS_DEBUG_EXTRA=-debug=headings -debug=bookindex +SET_DC_FLAGS_DEBUG_EXTRA=-debug=headings -debug=footnotes -debug=endnotes DC=$($(SET_D_COMPILER)) DC_FLAGS=$($(shell echo $(SET_D_COMPILER)_FLAGS)) @@ -39,7 +39,7 @@ endif PRG_NAME=sdp PRG_SRC=$(PRG_NAME).d -PRG_SRCDIR=./lib/$(PRG_NAME) +PRG_SRCDIR=./lib PRG_BIN=$(PRG_NAME) PRG_BINDIR=bin diff --git a/maker.org b/maker.org index e306483..c718f84 100644 --- a/maker.org +++ b/maker.org @@ -9,10 +9,11 @@ #+OPTIONS: ^:nil _:nil#+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) -#+FILETAGS: :project:sdp:makefile: +#+FILETAGS: :sdp_dev:makefile: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* makefile +* sdp makefile +[[./org/sdp.org][sdp.org]] ** settings [+2] :settings: *** alternative D compilers [+1] :compiler: **** dmd :dmd: @@ -44,10 +45,11 @@ GDC_FLAG_BINOF=-o - [X] Set D_COMPILER (one of DMD LDC or GDC) - [X] Set debug flags (using DMD standard flag -debug=) **** SET compiler: "SET_D_COMPILER=": :compiler:select: -Set D_COMPILER one of DMD LDC or GDC e.g.: - SET_D_COMPILER=DMD +[[http://wiki.dlang.org/Compilers][D Compilers wiki]] +[[http://dlang.org/download.html][D Compilers download]] +Set D_COMPILER one of DMD LDC or GDC e.g.: SET_D_COMPILER=DMD #+BEGIN_SRC makefile :tangle makefile -# set D_COMPILER one of DMD LDC or GDC: +# SET_D_COMPILER=(one of: DMD LDC or GDC): SET_D_COMPILER=LDC #+END_SRC @@ -55,7 +57,7 @@ SET_D_COMPILER=LDC Set debug flags using DMD standard flag -debug= e.g.: SET_DC_FLAGS_DEBUG_EXTRA=-debug=headings -debug=bookindex #+BEGIN_SRC makefile :tangle makefile -SET_DC_FLAGS_DEBUG_EXTRA=-debug=headings -debug=bookindex +SET_DC_FLAGS_DEBUG_EXTRA=-debug=headings -debug=footnotes -debug=endnotes #+END_SRC *** D compiler settings [+1] :settings:compiler: diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index bfda427..ea334a9 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -1,4 +1,4 @@ -+TITLE: Emacs config file written in org-mode +#+TITLE: sdp document abstraction #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,15 +9,16 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) tangle(T) template(t) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* document abstraction +* document abstraction :abstract: +[[./sdp.org][sdp]] Process markup document, create document abstraction. ** initialize #+name: abs_init #+BEGIN_SRC d :exports none -/* initialize */ +/+ initialize +/ mixin ObjectSetters; mixin AssertionsOnMarkupDocumentStructure; mixin AssertionsOnBlocks; @@ -34,7 +35,7 @@ string biblio_tag_name, biblio_tag_entry, book_idx_tmp, st; string[1024] biblio_arr_json = biblio_entry_tags_jsonstr; JSONValue[1024] bib_arr_json; uint[string] line_occur; -int counter, previous_count, count_biblio_entry, ocn, ocn_, verse_line, bib_entry, heading_pointer, notepoint; +uint counter, previous_count, count_biblio_entry, ocn, ocn_, verse_line, bib_entry, heading_pointer, notepoint; string indent_first, indent_second; string[][string][string] bookindex_unordered_hashes; bool bullet = true; @@ -149,7 +150,7 @@ auto dochead_metadata = parseJSON(header_metadata_jsonstr).object; #+END_SRC ** loop: process document body [+7] -*** scope +*** scope :scope: #+name: abs_loop_body_00 #+BEGIN_SRC d :exports none /* scope */ @@ -174,7 +175,7 @@ debug(srclines) { } } #+END_SRC -*** check whether ocn is on or turned off +*** check whether ocn is on or turned off :ocn: #+name: abs_loop_body_00 #+BEGIN_SRC d :exports none if ((!line.empty) && (ft["ocn_status_multi_obj"] == 0)) { @@ -218,7 +219,7 @@ if ((!line.empty) && (ft["ocn_status_multi_obj"] == 0)) { } #+END_SRC *** separate regular markup text from code blocks [+6] -**** code blocks +**** code blocks :block:code: #+name: abs_loop_body_00 #+BEGIN_SRC d :exports none if (ft["code"] == 1) { @@ -253,14 +254,14 @@ if (ft["code"] == 1) { } } #+END_SRC -**** non code objects (other blocks or regular text) [+5] +**** non code objects (other blocks or regular text) [+5] :non_code: #+name: abs_loop_body_00 #+BEGIN_SRC d :exports none } else if (!match(line, rgx.regular_parse_skip)) { /* object other than code block object (includes regular text paragraph) */ #+END_SRC -***** within block group [+1] -****** within block group: biblio +***** within block group [+1] :block:active: +****** within block group: biblio :biblio: #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d :exports none if (((match(line, rgx.heading_biblio) @@ -348,7 +349,7 @@ if (((match(line, rgx.heading_biblio) biblio_tag_entry=""; } #+END_SRC -****** within block group: poem +****** within block group: poem :poem: #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d :exports none } else if (ft["poem"] == 1) { @@ -549,7 +550,7 @@ if (((match(line, rgx.heading_biblio) } } #+END_SRC -****** within block group: group +****** within block group: group :group: #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d :exports none /* within block object: group */ @@ -584,7 +585,7 @@ if (((match(line, rgx.heading_biblio) } } #+END_SRC -****** within block group: block +****** within block group: block :block: #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d :exports none } else if (ft["block"] == 1) { @@ -619,7 +620,7 @@ if (((match(line, rgx.heading_biblio) } } #+END_SRC -****** within block group: quote +****** within block group: quote :quote: #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d :exports none } else if (ft["quote"] == 1) { @@ -654,7 +655,7 @@ if (((match(line, rgx.heading_biblio) } } #+END_SRC -****** within block group: table +****** within block group: table :table: #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d :exports none } else if (ft["table"] == 1) { @@ -689,7 +690,7 @@ if (((match(line, rgx.heading_biblio) } } #+END_SRC -***** not within block group [+4] +***** not identified as being within block group [+4] #+name: abs_loop_body_non_code_obj #+BEGIN_SRC d :exports none } else { @@ -705,8 +706,8 @@ assert( ); assertions_flag_types_block_status_none_or_closed(ft); #+END_SRC -****** open curly block group [+1] -******* open block group: code +****** open curly block group [+1] :block:curly:open: +******* open block group: code :code: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none if (auto m = match(line, rgx.block_curly_code_open)) { @@ -723,7 +724,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["code"] = 1; ft["curly_code"] = 1; #+END_SRC -******* open block group: poem +******* open block group: poem :poem: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_curly_poem_open)) { @@ -748,7 +749,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["poem"] = 1; ft["curly_poem"] = 1; #+END_SRC -******* open block group: group +******* open block group: group :group: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_curly_group_open)) { @@ -765,7 +766,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["group"] = 1; ft["curly_group"] = 1; #+END_SRC -******* open block group: block +******* open block group: block :block: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_curly_block_open)) { @@ -782,7 +783,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["block"] = 1; ft["curly_block"] = 1; #+END_SRC -******* open block group: quote +******* open block group: quote :quote: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_curly_quote_open)) { @@ -799,7 +800,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["quote"] = 1; ft["curly_quote"] = 1; #+END_SRC -******* open block group: table +******* open block group: table :table: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_curly_table_open)) { @@ -816,8 +817,8 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["table"] = 1; ft["curly_table"] = 1; #+END_SRC -****** open tic block group [+1] -******* open block group: code +****** open tic block group [+1] :block:tic:open: +******* open block group: code :code: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_tic_code_open)) { @@ -834,7 +835,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["code"] = 1; ft["tic_code"] = 1; #+END_SRC -******* open block group: poem +******* open block group: poem :poem: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_tic_poem_open)) { @@ -859,7 +860,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["poem"] = 1; ft["tic_poem"] = 1; #+END_SRC -******* open block group: group +******* open block group: group :group: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_tic_group_open)) { @@ -876,7 +877,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["group"] = 1; ft["tic_group"] = 1; #+END_SRC -******* open block group: block +******* open block group: block :block: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_tic_block_open)) { @@ -893,7 +894,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["block"] = 1; ft["tic_block"] = 1; #+END_SRC -******* open block group: quote +******* open block group: quote :quote: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_tic_quote_open)) { @@ -910,7 +911,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["quote"] = 1; ft["tic_quote"] = 1; #+END_SRC -******* open block group: table +******* open block group: table :table: #+name: abs_loop_body_open_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.block_tic_table_open)) { @@ -934,7 +935,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { /* line not empty */ /* non blocks (headers, paragraphs) & closed blocks */ #+END_SRC -******* asserts +******* asserts :assert: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none assert( @@ -959,7 +960,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ); } #+END_SRC -******* book index +******* book index :bookindex: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none if (auto m = match(line, rgx.book_index)) { @@ -1008,7 +1009,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { } else { /* not book_index */ #+END_SRC -******** matched: comment +******** matched: comment :comment:match: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none if (auto m = match(line, rgx.comment)) { @@ -1036,7 +1037,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["para"] = 0; counter++; #+END_SRC -******** matched: header make +******** matched: header make :header:make:match: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.header_make)) { @@ -1052,7 +1053,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { line_occur["header_make"]++; object["obj"] ~= line ~= "\n"; #+END_SRC -******** matched: header metadata +******** matched: header metadata :header:metadata:match: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (auto m = match(line, rgx.header_metadata)) { @@ -1068,7 +1069,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { line_occur["header_metadata"]++; object["obj"] ~= line ~= "\n"; #+END_SRC -******** flag set: header make +******** flag set: header make :header:make:flag: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (ft["header_make"] == 1 @@ -1083,7 +1084,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { object["obj"] ~= line ~= "\n"; } #+END_SRC -******** flag set: header metadata +******** flag set: header metadata :header:metadata:flag: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (ft["header_metadata"] == 1 @@ -1107,7 +1108,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { && (ft["heading"] == 0))) { /* heading or para but neither flag nor line exists */ #+END_SRC -********* headings found +********* headings found :heading: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none if ((to!string(dochead_make["make"]["headings"]).length > 2) @@ -1177,7 +1178,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { ft["make_headings"] = 1; } #+END_SRC -********* headings make set +********* headings make set :heading: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none if ((ft["make_headings"] == 1) @@ -1230,7 +1231,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { } } #+END_SRC -********* headings match +********* headings match :heading: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none if (auto m = match(line, rgx.heading)) { @@ -1357,7 +1358,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { tell_l("yellow", strip(line)); } #+END_SRC -********* para matches +********* para matches :para: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (line_occur["para"] == 0) { @@ -1408,7 +1409,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { line_occur["para"]++; } #+END_SRC -******** line exist: header make +******** line exist: header make :header:make: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (line_occur["header_make"] > 0) { @@ -1420,7 +1421,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { object["obj"] ~= line ~= "\n"; line_occur["header_make"]++; #+END_SRC -******** line exist: header metadata +******** line exist: header metadata :header:metadata: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (line_occur["header_metadata"] > 0) { @@ -1432,7 +1433,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { object["obj"] ~= line ~= "\n"; line_occur["header_metadata"]++; #+END_SRC -******** line exist: heading +******** line exist: heading :heading: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (line_occur["heading"] > 0) { @@ -1443,7 +1444,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { object["obj"] ~= line ~= "\n"; line_occur["heading"]++; #+END_SRC -******** line exist: para +******** line exist: para :para: #+name: abs_loop_body_not_block_obj #+BEGIN_SRC d :exports none } else if (line_occur["para"] > 0) { @@ -1677,7 +1678,7 @@ if (auto m = match(line, rgx.block_curly_code_open)) { } else { /* line empty */ #+END_SRC -******* assert line empty +******* assert line empty :assert: #+name: abs_loop_body_not_block_obj_line_empty #+BEGIN_SRC d :exports none /* line.empty, post contents, empty variables: */ @@ -1690,7 +1691,7 @@ assert( "code block status: none" ); #+END_SRC -******* header_make instructions +******* header_make instructions :header:make:instructions: #+name: abs_loop_body_not_block_obj_line_empty #+BEGIN_SRC d :exports none if ((ft["header_make"] == 1) @@ -1715,7 +1716,7 @@ if ((ft["header_make"] == 1) object.remove("bookindex"); processing.remove("verse"); #+END_SRC -******* header_metadata +******* header_metadata :header:metadata: #+name: abs_loop_body_not_block_obj_line_empty #+BEGIN_SRC d :exports none } else if ((ft["header_metadata"] == 1) @@ -1742,7 +1743,7 @@ if ((ft["header_make"] == 1) object.remove("bookindex"); processing.remove("verse"); #+END_SRC -******* heading object +******* heading object :heading:object: #+name: abs_loop_body_not_block_obj_line_empty #+BEGIN_SRC d :exports none } else if ((ft["heading"] == 1) @@ -1800,7 +1801,7 @@ if ((ft["header_make"] == 1) processing.remove("verse"); counter++; #+END_SRC -******* paragraph object +******* paragraph object :paragraph:object: #+name: abs_loop_body_not_block_obj_line_empty #+BEGIN_SRC d :exports none } else if ((ft["para"] == 1) && (line_occur["para"] > 0)) { @@ -1985,7 +1986,7 @@ auto t = return t; #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_abstract_doc_source.d: #+name: tangle_ao_abstract_doc_source #+BEGIN_SRC d :tangle ../lib/sdp/ao_abstract_doc_source.d :padline no :exports none :noweb yes diff --git a/org/ao_assertions.org b/org/ao_assertions.org index 1c29be9..a253e33 100644 --- a/org/ao_assertions.org +++ b/org/ao_assertions.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp assertions #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,11 +9,12 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* assertions -** mixin template: assertions on markup document structure +* assertions :mixin:assert: +[[./sdp.org][sdp]] +** mixin template: assertions on markup document structure :doc_structure: #+name: ao_assertions #+BEGIN_SRC d :exports none mixin template AssertionsOnMarkupDocumentStructure() { @@ -215,7 +216,7 @@ mixin template AssertionsOnMarkupDocumentStructure() { } } #+END_SRC -** mixin template: assertions on blocks +** mixin template: assertions on blocks :blocks: #+name: ao_assertions #+BEGIN_SRC d :exports none mixin template AssertionsOnBlocks() { @@ -239,7 +240,7 @@ mixin template AssertionsOnBlocks() { } #+END_SRC -* tangle +* tangle :tangle: ** code structure: :ao_assertions.d: #+name: tangle_ao_assertions #+BEGIN_SRC d :tangle ../lib/sdp/ao_assertions.d :padline no :exports none :noweb yes diff --git a/org/ao_defaults.org b/org/ao_defaults.org index 391abbb..73dba74 100644 --- a/org/ao_defaults.org +++ b/org/ao_defaults.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp defaults #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,11 +9,12 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* defaults -** template: header +* defaults :template:defaults: +[[./sdp.org][sdp]] +** template: header :header: #+name: ao_defaults_templates #+BEGIN_SRC d :exports none template SiSUheader() { @@ -89,7 +90,7 @@ template SiSUheader() { }, "links": { } - }`; + }`; // links auto pointer_head_main = [ "creator", @@ -180,7 +181,7 @@ template SiSUheader() { }`; } #+END_SRC -** template: flags regex initialize +** template: flags regex initialize :regex_flags: #+name: ao_defaults_templates #+BEGIN_SRC d :exports none /* regex flags */ @@ -218,7 +219,7 @@ template SiSUrgxInitFlags() { ]; } #+END_SRC -** template: bibliography +** template: bibliography :biblio: #+name: ao_defaults_templates #+BEGIN_SRC d :exports none template SiSUbiblio() { @@ -250,7 +251,7 @@ template SiSUbiblio() { "note" : "", "short_name" : "", "id" : "" - }`; + }`; // is: book, article, magazine, newspaper, blog, other auto biblio_tag_map = [ "au" : "author_raw", "ed" : "editor_raw", @@ -269,7 +270,7 @@ template SiSUbiblio() { ]; // is: book, article, magazine, newspaper, blog, other } #+END_SRC -** template: internal markup +** template: internal markup :markup: #+name: ao_defaults_templates #+BEGIN_SRC d :exports none template InternalMarkup() { @@ -280,7 +281,7 @@ template InternalMarkup() { } #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_defaults.d: #+name: tangle_ao_defaults #+BEGIN_SRC d :tangle ../lib/sdp/ao_defaults.d :padline no :exports none :noweb yes diff --git a/org/ao_emitters_and_interfaces.org b/org/ao_emitters_and_interfaces.org index d016f7c..3ef1dff 100644 --- a/org/ao_emitters_and_interfaces.org +++ b/org/ao_emitters_and_interfaces.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp emitters & interfaces #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,15 +9,16 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) * emitters & interfaces +[[./sdp.org][sdp]] ao_interface.d ao_emitter.d various emitters and their interfaces (where available) ** e: command line interface/instructions -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class CLI { @@ -36,7 +37,7 @@ class CLI { } #+END_SRC ** e&i: ocn -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class OCNemitter : AssertOCN { @@ -55,7 +56,7 @@ class OCNemitter : AssertOCN { } } #+END_SRC -*** interface assert +*** interface assert :interface:assert: #+name: ao_interface #+BEGIN_SRC d :exports none interface AssertOCN { @@ -65,7 +66,7 @@ interface AssertOCN { } #+END_SRC ** e: object attributes -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class ObjAttributes { @@ -222,7 +223,7 @@ class ObjAttributes { } #+END_SRC ** e: object inline markup munge -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class ObjInlineMarkupMunge { @@ -406,7 +407,7 @@ class ObjInlineMarkupMunge { } #+END_SRC ** e&i: object inline markup -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class ObjInlineMarkup : AssertObjInlineMarkup { @@ -465,7 +466,7 @@ class ObjInlineMarkup : AssertObjInlineMarkup { } } #+END_SRC -*** interface assert +*** interface assert :interface:assert: #+name: ao_interface #+BEGIN_SRC d :exports none interface AssertObjInlineMarkup { @@ -477,7 +478,7 @@ interface AssertObjInlineMarkup { } #+END_SRC ** e&i: object attrib -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class ObjAttrib : AssertObjAttrib { @@ -567,7 +568,7 @@ class ObjAttrib : AssertObjAttrib { } } #+END_SRC -*** interface assert +*** interface assert :interface:assert: #+name: ao_interface #+BEGIN_SRC d :exports none interface AssertObjAttrib { @@ -579,7 +580,7 @@ interface AssertObjAttrib { } #+END_SRC ** e: header document metadata in json -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class HeaderDocMetadataMakeJson { @@ -774,7 +775,7 @@ class HeaderDocMetadataMakeJson { } #+END_SRC ** e: header document metadata as hash -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class HeaderMetadataMakeHash { @@ -827,7 +828,7 @@ class HeaderMetadataMakeHash { } #+END_SRC ** e&i: book index nugget hash -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class BookIndexNuggetHash : AssertBookIndexNuggetHash { @@ -892,7 +893,7 @@ class BookIndexNuggetHash : AssertBookIndexNuggetHash { } } #+END_SRC -*** interface assert +*** interface assert :interface:assert: #+name: ao_interface #+BEGIN_SRC d :exports none interface AssertBookIndexNuggetHash { @@ -913,7 +914,7 @@ interface AssertBookIndexNuggetHash { } #+END_SRC ** e&i: book index report -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class BookIndexReport { @@ -941,7 +942,7 @@ class BookIndexReport { } } #+END_SRC -*** interface assert +*** interface assert :interface:assert: #+name: ao_interface #+BEGIN_SRC d :exports none interface AssertBookIndexReport { @@ -951,7 +952,7 @@ interface AssertBookIndexReport { } #+END_SRC ** e: book index report indented -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class BookIndexReportIndent { @@ -982,7 +983,7 @@ class BookIndexReportIndent { } #+END_SRC ** e: book index report section -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class BookIndexReportSection { @@ -1148,7 +1149,7 @@ class BookIndexReportSection { } #+END_SRC ** e: (end)notes section -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class NotesSection { @@ -1273,7 +1274,7 @@ class NotesSection { } #+END_SRC ** e: bibliography -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class Bibliography { @@ -1345,7 +1346,7 @@ class Bibliography { } #+END_SRC ** e&i: node structure metadata -*** emitter +*** emitter :emitter: #+name: ao_emitter #+BEGIN_SRC d :exports none class NodeStructureMetadata : AssertNodeJSON { @@ -1472,7 +1473,7 @@ class NodeStructureMetadata : AssertNodeJSON { } #+END_SRC -*** interface assert +*** interface assert :interface:assert: #+name: ao_interface #+BEGIN_SRC d :exports none interface AssertNodeJSON { @@ -1574,7 +1575,7 @@ interface AssertNodeJSON { } } #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_emitter.d: #+name: tangle_ao_emitter #+BEGIN_SRC d :tangle ../lib/sdp/ao_emitter.d :padline no :exports none :noweb yes diff --git a/org/ao_markup_source_raw.org b/org/ao_markup_source_raw.org index 13bce8d..5923116 100644 --- a/org/ao_markup_source_raw.org +++ b/org/ao_markup_source_raw.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp markup source raw #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,11 +9,13 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* markup source raw -** source string +* markup source raw :markup: +[[./sdp.org][sdp]] + +** source string :string: #+name: ao_markup_source_raw #+BEGIN_SRC d :exports none final private string markupSourceString(in char[] fn_src) { @@ -40,7 +42,8 @@ final private string markupSourceString(in char[] fn_src) { return source_txt_str; } #+END_SRC -** source line array + +** source line array :array: #+name: ao_markup_source_raw #+BEGIN_SRC d :exports none final private char[][] markupSourceLineArray(in string src_text) { @@ -49,7 +52,8 @@ final private char[][] markupSourceLineArray(in string src_text) { return source_line_arr; } #+END_SRC -** insert source content raw line array + +** insert source content raw line array :array: #+name: ao_markup_source_raw #+BEGIN_SRC d :exports none final char[][] markupInsertSourceContentRawLineArray(in char[] fn_src) { @@ -62,7 +66,8 @@ final char[][] markupInsertSourceContentRawLineArray(in char[] fn_src) { return source_line_arr; } #+END_SRC -** source content raw line array + +** source content raw line array :array: #+name: ao_markup_source_raw #+BEGIN_SRC d :exports none final char[][] markupSourceContentRawLineArray(in char[] fn_src) { @@ -76,7 +81,7 @@ final char[][] markupSourceContentRawLineArray(in char[] fn_src) { } #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_markup_source_raw.d: #+name: tangle_ao_markup_source_raw #+BEGIN_SRC d :tangle ../lib/sdp/ao_markup_source_raw.d :padline no :exports none :noweb yes diff --git a/org/ao_object_setter.org b/org/ao_object_setter.org index 83425a3..836e14a 100644 --- a/org/ao_object_setter.org +++ b/org/ao_object_setter.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp object setter #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,11 +9,12 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* object setter -** comment +* object setter :object:set: +[[./sdp.org][sdp]] +** struct :struct: #+name: ao_object_setter #+BEGIN_SRC d :exports none string[string] contents_comment(in string object) { @@ -25,7 +26,7 @@ string[string] contents_comment(in string object) { return object_set; } #+END_SRC -** heading +** heading :heading: #+name: ao_object_setter #+BEGIN_SRC d :exports none string[string] contents_heading( @@ -51,7 +52,7 @@ string[string] contents_heading( return object_set; } #+END_SRC -** para +** para :para: #+name: ao_object_setter #+BEGIN_SRC d :exports none string[string] contents_para( @@ -76,7 +77,7 @@ string[string] contents_para( return object_set; } #+END_SRC -** block +** block :block: #+name: ao_object_setter #+BEGIN_SRC d :exports none string[string] contents_block( @@ -95,7 +96,7 @@ string[string] contents_block( return object_set; } #+END_SRC -** block ocn string +** block ocn string :block: #+name: ao_object_setter #+BEGIN_SRC d :exports none string[string] contents_block_ocn_string( @@ -115,7 +116,7 @@ string[string] contents_block_ocn_string( } #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_object_setter.d: #+name: tangle_ao_object_setter #+BEGIN_SRC d :tangle ../lib/sdp/ao_object_setter.d :padline no :exports none :noweb yes diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org index 0e730ef..ecad21f 100644 --- a/org/ao_output_debugs.org +++ b/org/ao_output_debugs.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp output debugs #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,11 +9,12 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* output debugs -** (parent) +* output debugs :debug:output: +[[./sdp.org][sdp]] +** (parent) :parent: #+name: ao_output_debugs #+BEGIN_SRC d :exports none debug(parent) { @@ -33,7 +34,7 @@ debug(parent) { } } #+END_SRC -** (objects) +** (objects) :objects: #+name: ao_output_debugs #+BEGIN_SRC d :exports none debug(objects) { @@ -52,7 +53,7 @@ debug(objects) { } } #+END_SRC -** (headermakejson) +** (headermakejson) :json:header: #+name: ao_output_debugs #+BEGIN_SRC d :exports none debug(headermakejson) { @@ -78,7 +79,7 @@ debug(headermakejson) { } } #+END_SRC -** (headermetadatajson) +** (headermetadatajson) :json:header: #+name: ao_output_debugs #+BEGIN_SRC d :exports none debug(headermetadatajson) { @@ -183,7 +184,7 @@ debug(headermetadatajson) { } } #+END_SRC -** (bookindex) +** (bookindex) :bookindex: #+name: ao_output_debugs #+BEGIN_SRC d :exports none debug(bookindex) { @@ -193,7 +194,7 @@ debug(bookindex) { bookindex.bookindex_report_sorted(bookindex_unordered_hashes); } #+END_SRC -** (summary) [+1] +** (summary) [+1] :summary: #+name: ao_output_debugs #+BEGIN_SRC d :exports none debug(summary) { @@ -201,7 +202,7 @@ debug(summary) { "last_ocn" : "NA [debug \"checkdoc\" not run]", ]; #+END_SRC -*** (checkdoc) +*** (checkdoc) :checkdoc: #+name: ao_output_debugs_summary #+BEGIN_SRC d :exports none debug(checkdoc) { @@ -214,7 +215,7 @@ debug(checkdoc) { } } #+END_SRC -*** (headings) +*** (headings) :headings: #+name: ao_output_debugs_summary #+BEGIN_SRC d :exports none debug(headings) { @@ -372,7 +373,7 @@ debug(checkdoc) { } #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_output_debugs.d: #+name: tangle_ao_output_debugs #+BEGIN_SRC d :tangle ../lib/sdp/ao_output_debugs.d :padline no :exports none :noweb yes diff --git a/org/ao_rgx.org b/org/ao_rgx.org index ff7f207..eecad70 100644 --- a/org/ao_rgx.org +++ b/org/ao_rgx.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp rgx #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,11 +9,12 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* regex -** misc +* regex :regex: +[[./sdp.org][sdp]] +** misc :misc: #+name: ao_rgx #+BEGIN_SRC d :exports none /* misc */ @@ -38,18 +39,23 @@ static levels_markup = ctRegex!(`^[A-D1-4]$`); static levels_numbered = ctRegex!(`^[0-9]$`); static levels_numbered_headings = ctRegex!(`^[0-7]$`); #+END_SRC -** markup insert file +** markup insert file :insert:file: #+name: ao_rgx #+BEGIN_SRC d :exports none /* insert markup file */ static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`); // static insert_ssi_or_sst_fn = ctRegex!(`^<<\s*[a-zA-Z0-9._-]+[.]ss[ti]`); #+END_SRC -** header & comments +** comments :comment: #+name: ao_rgx #+BEGIN_SRC d :exports none -/* header & comments */ +/* comments */ static comment = ctRegex!(`^%+ `); +#+END_SRC +** header :header: +#+name: ao_rgx +#+BEGIN_SRC d :exports none +/* header */ static header = ctRegex!(`^@([a-z_]+):(?:\s|$)`); static header_make = ctRegex!(`^@(make):(?:\s|$)`); static header_metadata = ctRegex!(`^@([a-z_]+):(?:\s|$)`); @@ -57,7 +63,7 @@ static header_sub = ctRegex!(`^[ ]+:([a-z_]+):\s`); static head_main = ctRegex!(`^@([a-z_]+):\s*(.*)`, "m"); static head_sub = ctRegex!(`^[ ]*:([a-z_]+):\s+(.+)`, "m"); #+END_SRC -** header & paragraph operators +** header & paragraph operators :paragraph:operator: #+name: ao_rgx #+BEGIN_SRC d :exports none /* heading & paragraph operators */ @@ -73,7 +79,7 @@ static para_indent = ctRegex!(`^_([1-9]) `); static para_indent_hang = ctRegex!(`^_([0-9])_([0-9]) `); static para_attribs = ctRegex!(`^_(([0-9])(_([0-9]))?|_([1-9])?[*]) `); #+END_SRC -** blocked markup tics +** blocked markup tics :block:tic: #+name: ao_rgx #+BEGIN_SRC d :exports none /* blocked markup tics */ @@ -85,7 +91,7 @@ static block_tic_quote_open = ctRegex!("^`{3} (quote)"); static block_tic_table_open = ctRegex!("^`{3} (table)"); static block_tic_close = ctRegex!("^(`{3})$","m"); #+END_SRC -** blocked markup curly +** blocked markup curly :block:curly: #+name: ao_rgx #+BEGIN_SRC d :exports none /* blocked markup curly */ @@ -102,7 +108,7 @@ static block_curly_quote_close = ctRegex!(`^([}]quote)`); static block_curly_table_open = ctRegex!(`^(table[{].*?$)`); static block_curly_table_close = ctRegex!(`^([}]table)`); #+END_SRC -** inline markup font face mod +** inline markup font face mod :inline:font:face: #+name: ao_rgx #+BEGIN_SRC d :exports none /* inline markup font face mod */ @@ -115,7 +121,7 @@ static inline_strike = ctRegex!(`-\{(?P.+?)\}-`); static inline_insert = ctRegex!(`\+\{(?P.+?)\}\+`); static inline_mono = ctRegex!(`#\{(?P.+?)\}#`); #+END_SRC -** inline markup footnotes +** inline markup footnotes :inline:footnote: #+name: ao_rgx #+BEGIN_SRC d :exports none /* inline markup footnotes */ @@ -146,7 +152,7 @@ static inline_text_and_note_square_sp = ctRegex!(`(.+?)~\[[*+]+\s+(.+?)\] static inline_text_and_note_square = ctRegex!(`(.+?)~\[\s*(.+?)\]~`, "mg"); static inline_note_square_delimiters = ctRegex!(`(~\[\s*)(.+?)(\]~)`, "mg"); #+END_SRC -** inline markup book index +** inline markup book index :inline:bookindex: #+name: ao_rgx #+BEGIN_SRC d :exports none /* inline markup book index */ @@ -154,7 +160,7 @@ static book_index = ctRegex!(`^=\{\s*(.+?)\}$`, "m"); static book_index_open = ctRegex!(`^=\{\s*([^}]+?)$`); static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); // strip #+END_SRC -** no ocn object +** no ocn object :ocn:off:object: #+name: ao_rgx #+BEGIN_SRC d :exports none /* no ocn object */ @@ -162,7 +168,7 @@ static ocn_off = ctRegex!(`~#$`, "m"); static ocn_off_dh = ctRegex!(`-#$`, "m"); static ocn_off_all = ctRegex!(`[~-]#$`, "m"); #+END_SRC -** no ocn block +** no ocn block :ocn:off:block: #+name: ao_rgx #+BEGIN_SRC d :exports none /* no ocn block */ @@ -172,13 +178,13 @@ static ocn_off_block_close = ctRegex!(`^--\+#$`); // static auto_ocn_ignore = ctRegex!(`^[+~*$-]{3,}$`); // reminder static ocn_block_marks = ctRegex!(`^--[+~-]#$`); #+END_SRC -** ignore outside code blocks +** ignore outside code blocks :block:code: #+name: ao_rgx #+BEGIN_SRC d :exports none /* ignore outside code blocks */ static regular_parse_skip = ctRegex!(`^(--[+~-]#|-[\\]{2}-|=[.\\]{2}=)$`); // not structural info #+END_SRC -** line & page breaks +** line & page breaks :break: #+name: ao_rgx #+BEGIN_SRC d :exports none /* line & page breaks */ @@ -191,13 +197,13 @@ static break_string = ctRegex!(`』`); // ancestry, parent static parent = ctRegex!(`([0-7]):([0-9]+)`); #+END_SRC -** json +** json :json: #+name: ao_rgx #+BEGIN_SRC d :exports none /* json */ static tailing_comma = ctRegex!(`,$`, "m"); #+END_SRC -** head +** head :header: #+name: ao_rgx #+BEGIN_SRC d :exports none /* head */ @@ -213,14 +219,14 @@ static subhead_notes = ctRegex!(`^(?:abstract|description)$`, "m"); static subhead_publisher = ctRegex!(`^(?:name)$`, "m"); static subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); #+END_SRC -** biblio tags +** biblio tags :biblio:tags: #+name: ao_rgx #+BEGIN_SRC d :exports none /* biblio tags */ static biblio_tags = ctRegex!(`^(is|au|author_raw|author|author_arr|editor_raw|ed|editor_arr|ti|title|subtitle|fulltitle|lng|language|trans|src|jo|journal|in|vol|volume|edn|edition|yr|year|pl|place|pb|pub|publisher|url|pg|pages|note|short_name|id):\s+(.+)`); static biblio_abbreviations = ctRegex!(`^(au|ed|ti|lng|jo|vol|edn|yr|pl|pb|pub|pg|pgs|sn)$`); #+END_SRC -** bookindex split +** bookindex split :bookindex:split: #+name: ao_rgx #+BEGIN_SRC d :exports none /* bookindex split */ @@ -229,7 +235,7 @@ static bi_main_term_plus_rest_split = ctRegex!(`\s*:\s*`); static bi_sub_terms_plus_ocn_offset_split = ctRegex!(`\s*\|\s*`); static bi_term_and_ocns_match = ctRegex!(`^(.+?)\+(\d+)`); #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_rgx.d: #+name: tangle_ao_rgx #+BEGIN_SRC d :tangle ../lib/sdp/ao_rgx.d :padline no :exports none :noweb yes diff --git a/org/ao_scan_inserts.org b/org/ao_scan_inserts.org index 8aaf377..f595ea5 100644 --- a/org/ao_scan_inserts.org +++ b/org/ao_scan_inserts.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp scan inserts #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,11 +9,13 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) #+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* inserts -** scan inserts (sub-document) source +* inserts :inserts: +[[./sdp.org][sdp]] + +** scan inserts (sub-document) source :scan_insert_src: *** scan subdoc source #+name: ao_inserts_scan #+BEGIN_SRC d :exports none @@ -100,8 +102,8 @@ if (ft1["curly_code"] == 1) { markup_sourcesubfile_insert_content.length ); } - auto ins = new Inserts(); - /* + auto ins = new Inserts(); + /+ 1. load file, 2. read lines; 3. scan lines, @@ -109,7 +111,7 @@ if (ft1["curly_code"] == 1) { 5. repeat 1 6. else 7. add line to new array; - */ + +/ } else { ft1["header_make"] = 0; ft1["header_metadata"] = 0; @@ -124,7 +126,8 @@ auto contents_ = cont_arbitrary_max_length_set_[0 .. counter["add"]].dup; auto t = tuple(contents_, add); return t; #+END_SRC -** scan document source + +** scan document source :scan_src: *** scan doc source #+name: ao_doc_scan #+BEGIN_SRC d :exports none @@ -214,16 +217,16 @@ if (ft["curly_code"] == 1) { markup_sourcefile_insert_content.length ); } - auto ins = new Inserts(); - auto t = ins.scan_subdoc_source( - markup_sourcefile_insert_content, to!string(fn_src_insert), add - ); - static assert(!isTypeTuple!(t)); - auto tmparr = t[0]; - auto addsub = t[1]; - cont_arbitrary_max_length_set[add .. addsub-1] = tmparr[0 .. $-1]; - add=addsub; - /* + auto ins = new Inserts(); + auto t = ins.scan_subdoc_source( + markup_sourcefile_insert_content, to!string(fn_src_insert), add + ); + static assert(!isTypeTuple!(t)); + auto tmparr = t[0]; + auto addsub = t[1]; + cont_arbitrary_max_length_set[add .. addsub-1] = tmparr[0 .. $-1]; + add=addsub; + /+ 1. load file, 2. read lines; 3. scan lines, @@ -231,7 +234,7 @@ if (ft["curly_code"] == 1) { 5. repeat 1 6. else 7. add line to new array; - ,*/ + +/ } else { ft["header_make"] = 0; ft["header_metadata"] = 0; @@ -251,14 +254,14 @@ debug(insert) { // insert file return contents; #+END_SRC -* tangles +* tangles :tangle: ** code structure: :ao_inserts.d: #+name: tangle_ao_inserts #+BEGIN_SRC d :tangle ../lib/sdp/ao_scan_inserts.d :padline no :exports none :noweb yes -/* +/+ inserts ao_inserts.d -*/ ++/ mixin template SiSUdocInserts() { class Inserts { auto scan_subdoc_source( diff --git a/org/ao_utils.org b/org/ao_utils.org index 2c3e342..1cc3313 100644 --- a/org/ao_utils.org +++ b/org/ao_utils.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp utils #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,10 +9,12 @@ #+OPTIONS: ^:nil _:nil#+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) +#+FILETAGS: :sdp:ao: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* utils -** set colors for terminal +* utils :utils: +[[./sdp.org][sdp]] +** set colors for terminal :colors:terminal: #+name: ao_utils #+BEGIN_SRC d :exports none string[string] scr_txt_color = [ @@ -85,7 +87,20 @@ string[string] scr_txt_marker = [ ]; #+END_SRC -* tangles +* code snippets, use as needed :code:snippet:debug: +** called from +#+BEGIN_SRC d :tangle no :exports none +string functionName = __FUNCTION__, +string file = __FILE__, +size_t line = __LINE__) { +writefln("Called from function %s at file %s, line %s", + functionName, file, line); +#+END_SRC :tangle no +#+BEGIN_SRC d :exports none +writefln("Inside function %s at file %s, line %s", + __FUNCTION__, __FILE__, __LINE__); +#+END_SRC +* tangles :tangle: ** code structure: :ao_util.d: #+name: tangle_ao_utils #+BEGIN_SRC d :tangle ../lib/sdp/ao_utils.d :padline no :exports none :noweb yes diff --git a/org/sdp.org b/org/sdp.org index 70b68f5..885f022 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -1,4 +1,4 @@ -#+TITLE: Emacs config file written in org-mode +#+TITLE: sdp hub #+AUTHOR: Ralph Amissah #+EMAIL: ralph.amissah@gmail.com #+STARTUP: indent @@ -9,48 +9,62 @@ #+OPTIONS: ^:nil _:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport -#+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) -#+FILETAGS: :sdp: +#+FILETAGS: :sdp:hub: +#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) -* sdp.d :sdp.d: +* sdp.d sisu document parser :sdp.d: +[[../maker.org][maker.org makefile]] Deal with imports. Take command line instructions and process files as instructed. -** imports + +** imports :import: +[[./ao_abstract_doc_source.org][ao_abstract_doc_source]] +[[./ao_assertions.org][ao_assertions]] +[[./ao_defaults.org][ao_defaults]] +[[./ao_emitters_and_interfaces.org][ao_emitters_and_interfaces: ao_emitter; ao_interface]] +[[./ao_markup_source_raw.org][ao_markup_source_raw]] +[[./ao_object_setter.org][ao_object_setter]] +[[./ao_output_debugs.org][ao_output_debugs]] +[[./ao_rgx.org][ao_rgx]] +[[./ao_scan_inserts.org][ao_scan_inserts]] +[[./ao_utils.org][ao_utils]] + #+name: sdp_imports #+BEGIN_SRC d :exports none +/+ sdp sisu document parser +/ import - std.stdio, + std.algorithm, + std.array, + std.container, std.file, std.exception, - // std.path, - std.regex, - std.utf, - std.string, - std.array, std.json, + // std.path, std.process, - std.typecons, - std.algorithm, std.range, - std.container, + std.regex, + std.stdio, + std.string, std.traits, + std.typecons, + std.utf, // std.variant, - lib.sdp.ao_output_debugs, // sdp/ao_output_debugs.d ao_output_debugs.org - lib.sdp.ao_defaults, // sdp/ao_defaults.d ao_defaults.arg - lib.sdp.ao_rgx, // sdp/ao_rgx.d ao_rgx.org - lib.sdp.ao_interface, // sdp/ao_interface.d ao_interface.arg - lib.sdp.ao_emitter, // sdp/ao_emitter.d ao_emitter.org - lib.sdp.ao_scan_inserts, // sdp/ao_scan_inserts.d ao_scan_inserts.org - lib.sdp.ao_markup_source_raw, // sdp/ao_markup_source_raw.d ao_markup_source_raw.org - lib.sdp.ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d ao_abstract_doc_source.org - lib.sdp.ao_assertions, // sdp/ao_assertions.d ao_assertions.org - lib.sdp.ao_object_setter, // sdp/ao_object_setter.d ao_object_setter.org - lib.sdp.ao_utils; // sdp/ao_utils.d ao_utils.org + lib.sdp.ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d + lib.sdp.ao_assertions, // sdp/ao_assertions.d + lib.sdp.ao_defaults, // sdp/ao_defaults.d + lib.sdp.ao_emitter, // sdp/ao_emitter.d + lib.sdp.ao_interface, // sdp/ao_interface.d + lib.sdp.ao_markup_source_raw, // sdp/ao_markup_source_raw.d + lib.sdp.ao_object_setter, // sdp/ao_object_setter.d + lib.sdp.ao_output_debugs, // sdp/ao_output_debugs.d + lib.sdp.ao_rgx, // sdp/ao_rgx.d + lib.sdp.ao_scan_inserts, // sdp/ao_scan_inserts.d + lib.sdp.ao_utils; // sdp/ao_utils.d // std.conv; import std.conv : to; #+END_SRC -** argv [+3] -*** argv mixins +** argv [+3] :argv: +*** argv mixins & init #+name: sdp_argv #+BEGIN_SRC d :exports none mixin SiSUheader; @@ -115,9 +129,9 @@ foreach(cmdlnins; argv) { } } #+END_SRC -*** each file [+2] +*** each file [+2] :file: **** filename provided [+1] -***** scope +***** scope :scope: #+name: sdp_each_file_do #+BEGIN_SRC d :exports none scope(success) { @@ -147,7 +161,9 @@ enforce( "not a sisu markup filename" ); #+END_SRC -***** send for processing +***** read file :file:read: +[[./ao_markup_source_raw.org][ao_markup_source_raw]] + #+name: sdp_each_file_do #+BEGIN_SRC d :exports none auto markup_sourcefile_content = @@ -163,8 +179,14 @@ debug(insert) { writeln("markup source file path: ", markup_src_file_path); // writeln(m.captures[1]); writeln(m.captures[2]); } +#+END_SRC +****** incorporate any inserts +[[./ao_scan_inserts.org][ao_scan_inserts]] + +#+name: sdp_each_file_do +#+BEGIN_SRC d :exports none if (match(fn_src, rgx.src_fn_master)) { -/* if master file scan document source for document imports (inserted sub-documents) */ +/+ if master file scan document source for document imports (inserted sub-documents) +/ auto ins = new Inserts(); auto markup_master_sourcefile_content = ins.scan_doc_source(markup_sourcefile_content, fn_src); @@ -179,7 +201,11 @@ debug(raw) { writeln(line); } } -/* process document ao_abstract_doc_source SiSUdocAbstraction::Abstraction return abstraction as tuple */ +#+END_SRC +***** send for processing :processing: +#+name: sdp_each_file_do +#+BEGIN_SRC d :exports none +/+ process document ao_abstract_doc_source SiSUdocAbstraction::Abstraction return abstraction as tuple +/ auto t = abs.abstract_doc_source(msc); static assert(!isTypeTuple!(t)); diff --git a/tangle b/tangle index 8e7569d..d6aa952 100755 --- a/tangle +++ b/tangle @@ -8,7 +8,7 @@ EMACSLISP_ORG=~/.emacs.d/elpa/org-20151005 EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-20151005 # wrap each argument in the code required to call tangle on it for i in $@; do - ORGFILES="$ORGFILES \"$i\"" + ORGFILES="$ORGFILES \"$i\"" done emacs --batch -Q -q \ --eval "(progn -- cgit v1.2.3