diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-02-17 08:50:43 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 9cb8937a92539d4cb40441396fc52e55e7a26f1b (patch) | |
tree | 136f1a58789e8bd2b8129018b0400f9ebfa18be2 /org | |
parent | output, sisupod & a few switches (diff) |
0.13.1 defaults renamed & reorganized
Diffstat (limited to 'org')
-rw-r--r-- | org/defaults.org (renamed from org/ao_defaults.org) | 657 | ||||
-rw-r--r-- | org/output.org | 4 | ||||
-rw-r--r-- | org/sdp.org | 2 |
3 files changed, 370 insertions, 293 deletions
diff --git a/org/ao_defaults.org b/org/defaults.org index fbf4495..8b6a74f 100644 --- a/org/ao_defaults.org +++ b/org/defaults.org @@ -13,12 +13,13 @@ #+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n) [[./sdp.org][sdp]] [[./][org/]] -* 0. default templates :template:defaults: +* 0. ao regex & defaults +** 0. defaults :defaults: [[./sdp.org][sdp]] [[./][org/]] -** 0. defaults: :ao_defaults: +*** 0. defaults: :defaults: -#+name: tangle_ao_defaults +#+name: tangle_defaults #+BEGIN_SRC d :tangle ../src/sdp/ao_defaults.d /++ default settings @@ -30,12 +31,11 @@ template SiSUregisters() { <<ao_defaults_template_init_flags>> <<ao_defaults_template_node>> <<ao_defaults_template_biblio>> -<<ao_defaults_template_paths>> -<<ao_defaults_template_markup>> -<<ao_defaults_template_language_codes>> +<<defaults_template_markup>> +<<defaults_template_language_codes>> #+END_SRC -** template: imports +*** imports #+name: ao_defaults_imports #+BEGIN_SRC d @@ -60,7 +60,8 @@ private import std.conv : to; #+END_SRC -** template: settings metadata associative array indexes :settings: +*** settings metadata associative array indexes :settings: +***** conf associative array #+name: ao_defaults_template_registers #+BEGIN_SRC d @@ -123,6 +124,12 @@ string[string][string] conf_aa() { ]; return conf_; } +#+END_SRC + +***** make associative array + +#+name: ao_defaults_template_registers +#+BEGIN_SRC d string[string][string] make_aa() { auto make_ = [ "make": [ @@ -144,6 +151,12 @@ string[string][string] make_aa() { ]; return make_; } +#+END_SRC + +***** meta (metadata) associative array + +#+name: ao_defaults_template_registers +#+BEGIN_SRC d string[string][string] meta_aa() { auto meta_ = [ "classify": [ @@ -208,7 +221,7 @@ string[string][string] meta_aa() { } #+END_SRC -** template: metadata associative array indexes :header: +*** metadata associative array indexes :header: #+name: ao_defaults_template_registers #+BEGIN_SRC d @@ -306,7 +319,7 @@ auto config_jsonstr = `{ }`; #+END_SRC -*** notes headers +**** notes headers #+name: ao_defaults_template #+BEGIN_SRC d @@ -386,100 +399,7 @@ header. +/ #+END_SRC -** template: language codes - -#+name: ao_defaults_template_language_codes -#+BEGIN_SRC d -template SiSUlanguageCodes() { - /+ language codes +/ - struct Lang { - string[string][string] codes() { - auto _lang_codes = [ - "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ], - "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ], - "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ], - "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ], - "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ], - "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ], - "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ], - "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ], - "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ], - "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ], - "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], - "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ], - "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ], - "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ], - "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ], - "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ], - "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ], - "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ], - "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ], - "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ], - "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ], - "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ], - "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ], - "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ], - "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ], - "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ], - "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ], - "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ], - "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ], - "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ], - "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ], - "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ], - "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ], - "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ], - "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ], - "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ], - "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ], - "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ], - "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ], - "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ], - "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ], - "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ], - "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ], - "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ], - "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ], - "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ], - "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ], - "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ], - "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ], - "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ], - "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ], - "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ], - "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ], - "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ], - "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ], - "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ], - "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ], - "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ], - "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ], - "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ], - "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], - "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ], - ]; - return _lang_codes; - } - string[] code_arr_ptr() { - auto _lang_codes = ["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", "us", "vi", "zh", "en", "xx",]; - return _lang_codes; - } - string[] code_arr() { - auto _lang_codes = ["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"]; - return _lang_codes; - } - auto codes_() { - // return join(code_arr,"|"); - return "(" ~ join(code_arr,"|") ~ ")"; - } - auto codes_regex() { - return regex(codes_); - } - } -} -#+END_SRC - -** template: flags regex initialize :regex_flags: +*** template: flags regex initialize :regex_flags: #+name: ao_defaults_template_init_flags #+BEGIN_SRC d @@ -570,7 +490,7 @@ template SiSUnode() { } #+END_SRC -** template: bibliography :biblio: +*** template: bibliography :biblio: #+name: ao_defaults_template_biblio #+BEGIN_SRC d @@ -613,156 +533,14 @@ template SiSUbiblio() { } #+END_SRC -** TODO template: dir paths :dir:path: - -#+name: ao_defaults_template_paths -#+BEGIN_SRC d -template SiSUpaths() { - string _base_filename(string fn_src) { - string _fn_base = ""; - if (extension(fn_src) == ".sst") { - _fn_base = baseName(fn_src, ".sst"); - } else if (extension(fn_src) == ".ssm") { - _fn_base = baseName(fn_src, ".ssm"); - } - return _fn_base; - } - struct DirPaths { - string base_filename(string fn_src) { - return _base_filename(fn_src); - } - } - struct SiSUpodPaths { - string base_filename(string fn_src) { - return _base_filename(fn_src); - } - string base(string fn_src) { - return chainPath("sisupod", _base_filename(fn_src)).array; - } - string doc(string fn_src) { - return chainPath(base(fn_src), "doc").array; - } - string doc_lng(string fn_src, string lng) { - return chainPath(doc(fn_src), lng).array; - } - string conf(string fn_src) { - return chainPath(doc(fn_src), "_sisu").array; - } - string image(string fn_src) { - return chainPath(conf(fn_src), "image").array; - } - string css(string fn_src) { - return chainPath(conf(fn_src), "css").array; - } - string fn_doc(string fn_src, string lng) { - return chainPath((doc_lng(fn_src, lng)), baseName(fn_src)).array; - } - string fn_doc_insert(string fn_src, string fn_insert, string lng) { - return chainPath((doc_lng(fn_src, lng)), baseName(fn_insert)).array; - } - } - struct HtmlPaths { - string base_filename(string fn_src) { - return _base_filename(fn_src); - } - string base() { - return chainPath("en", "html").array; - } - string seg(string fn_src) { - return chainPath(base, _base_filename(fn_src)).array; - } - string fn_scroll(string fn_src) { - return chainPath(base, _base_filename(fn_src) ~ ".html").array; - } - string fn_seg(string fn_src, string seg_filename) { - return chainPath(seg(fn_src), seg_filename ~ ".html").array; - } - // string fn_css(string fn_src) { - // return chainPath(seg(fn_src), "html.css").array; - // } - } - struct EpubPaths { - string base_filename(string fn_src) { - return _base_filename(fn_src); - } - string base() { - return chainPath("en", "epub").array; - } - string doc(string fn_src) { - return chainPath(base, _base_filename(fn_src)).array; - // return chainPath(base, base_fn).array; - } - string doc_meta_inf(string fn_src) { - return chainPath(doc(fn_src), "META-INF").array; - } - string doc_oebps(string fn_src) { - return chainPath(doc(fn_src), "OEBPS").array; - } - string doc_oebps_css(string fn_src) { - return chainPath(doc_oebps(fn_src), "css").array; - } - string doc_oebps_image(string fn_src) { - return chainPath(doc_oebps(fn_src), "image").array; - } - string fn_mimetypes(string fn_src) { - return chainPath(doc(fn_src), "mimetypes").array; - } - string fn_dmi_container_xml(string fn_src) { - return chainPath(doc_meta_inf(fn_src), "container.xml").array; - } - string fn_oebps_toc_ncx(string fn_src) { - return chainPath(doc_oebps(fn_src), "toc.ncx").array; - } - string fn_oebps_content_opf(string fn_src) { - return chainPath(doc_oebps(fn_src), "content.opf").array; - } - string fn_oebps_content_xhtml(string fn_src, string seg_filename) { - return chainPath(doc_oebps(fn_src), seg_filename ~ ".xhtml").array; - } - } -} -#+END_SRC - -** template: internal markup :markup: - -#+name: ao_defaults_template_markup -#+BEGIN_SRC d -template InternalMarkup() { - struct InlineMarkup { - auto en_a_o = "【"; auto en_a_c = "】"; // endnote en_a_o: '~{'; en_a_c: '}~'; - auto en_b_o = "〖"; auto en_b_c = "〗"; // endnote en_b_o: '~['; en_b_c: ']~'; - auto lnk_o = "┥"; auto lnk_c = "┝"; - auto url_o = "┤"; auto url_c = "├"; - auto mark_internal_site_lnk = "¤"; - auto nbsp = "░"; - auto br_line = "┘"; - auto br_nl = "┙"; - auto br_paragraph = "┚"; - auto br_obj = "break_obj"; - auto br_page_line = "┼"; - auto br_page = "┿"; - auto br_page_new = "╂"; - string indent_by_spaces_provided(int indent) { - auto _indent_spaces ="░░"; // auto nbsp = "░"; - _indent_spaces = replicate(_indent_spaces, indent); - return _indent_spaces; - } - string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { - _character = replicate(_character, number); - return _character; - } - } -} -#+END_SRC - -* 1. regex ctRegex :regex: +** 1. ctRegex :regex: [[./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. rgx code template: :ao_rgx: #+name: tangle_ao_rgx #+BEGIN_SRC d :tangle ../src/sdp/ao_rgx.d @@ -773,11 +551,12 @@ template SiSUrgxInit() { private import ao_defaults; struct Rgx { <<ao_rgx>> + <<prgmkup_rgx>> } } #+END_SRC -** misc :misc: +*** misc :misc: #+name: ao_rgx #+BEGIN_SRC d @@ -802,7 +581,7 @@ static levels_numbered = ctRegex!(`^[0-9]$`); static levels_numbered_headings = ctRegex!(`^[0-7]$`); #+END_SRC -** filename (and path) matching (including markup insert file) :insert:file:path:filename: +*** filename (and path) matching (including markup insert file) :insert:file:path:filename: #+name: ao_rgx #+BEGIN_SRC d @@ -816,7 +595,7 @@ static src_fn_find_inserts = ctRegex!(`^(?P<path>[a-z static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); #+END_SRC -** comments :comment: +*** comments :comment: #+name: ao_rgx #+BEGIN_SRC d @@ -825,7 +604,7 @@ static comment = ctRegex!(`^%+ `); static comments = ctRegex!(`^%+ |^%+$`); #+END_SRC -** native header :native:header: +*** native header :native:header: #+name: ao_rgx #+BEGIN_SRC d @@ -844,7 +623,7 @@ static variable_doc_author = ctRegex!(`@author|@creat static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i"); #+END_SRC -** subheader :native:subheader: +*** subheader :native:subheader: #+name: ao_rgx #+BEGIN_SRC d @@ -861,7 +640,7 @@ static native_subhead_publisher = ctRegex!(`^(?:name)$`, " static native_subhead_make = ctRegex!(`^(?:cover_image|home_button_image|home_button_text|footer|headings|num_top|num_depth|breaks|substitute|bold|italics|emphasis|texpdf_font|css)$`, "m"); #+END_SRC -** heading & paragraph operators :paragraph:operator: +*** heading & paragraph operators :paragraph:operator: #+name: ao_rgx #+BEGIN_SRC d @@ -892,7 +671,7 @@ static para_indent_hang = ctRegex!(`^_([0-9])_([0- static para_attribs = ctRegex!(`^_(([0-9])(_([0-9]))?|_([1-9])?[*]) `); #+END_SRC -** blocked markup :block:tic: +*** blocked markup :block:tic: #+name: ao_rgx #+BEGIN_SRC d @@ -901,7 +680,7 @@ static block_open = ctRegex!("^((code([.][a- static block_poem_open = ctRegex!("^((poem[{].*?$)|`{3} poem)"); #+END_SRC -** blocked markup tics :block:tic: +*** blocked markup tics :block:tic: #+name: ao_rgx #+BEGIN_SRC d @@ -916,7 +695,7 @@ static block_tic_table_open = ctRegex!("^`{3} (table)" static block_tic_close = ctRegex!("^(`{3})$","m"); #+END_SRC -** blocked markup curly :block:curly: +*** blocked markup curly :block:curly: #+name: ao_rgx #+BEGIN_SRC d @@ -936,7 +715,7 @@ static block_curly_table_open = ctRegex!(`^(table[{].*?$ static block_curly_table_close = ctRegex!(`^([}]table)`); #+END_SRC -** inline markup font face mod :inline:font:face: +*** inline markup font face mod :inline:font:face: #+name: ao_rgx #+BEGIN_SRC d @@ -951,7 +730,7 @@ static inline_insert = ctRegex!(`\+\{(?P<text>. static inline_mono = ctRegex!(`#\{(?P<text>.+?)\}#`); #+END_SRC -** inline markup footnotes endnotes :inline:footnote: +*** inline markup footnotes endnotes :inline:footnote: #+name: ao_rgx #+BEGIN_SRC d @@ -974,27 +753,7 @@ static inline_text_and_note_curly = ctRegex!(`(?P<text>.+?)( static note_ref = ctRegex!(`^\S+?noteref_([0-9]+)`, "mg"); // {^{73.}^}#noteref_73 #+END_SRC -** inline (internal program) markup footnotes endnotes :inline:footnote: - -#+name: ao_rgx -#+BEGIN_SRC d -/+ inline markup footnotes endnotes +/ -static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); -static inline_notes_al_gen = ctRegex!(`【.+?】`, "m"); -static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); -static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); -static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); -static inline_al_delimiter_close_regular = ctRegex!(`】`, "m"); -static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); -static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg"); -static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(\d+)\s+(.+?)】`, "mg"); -static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); -static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); -static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)【(?:[*+ ]*)(?P<note>.+?)】`, "mg"); -static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); -#+END_SRC - -** links/ urls :inline:footnote: +*** links/ urls :inline:footnote: #+name: ao_rgx #+BEGIN_SRC d @@ -1006,14 +765,14 @@ static inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(.+?) static inline_a_url = ctRegex!(`(┤)(\S+?)(├)`, "mg"); #+END_SRC -** images :images: +*** images :images: #+name: ao_rgx #+BEGIN_SRC d static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg"); #+END_SRC -** inline markup book index :inline:bookindex: +*** inline markup book index :inline:bookindex: #+name: ao_rgx #+BEGIN_SRC d @@ -1023,7 +782,7 @@ static book_index_open = ctRegex!(`^=\{\s*([^}]+? static book_index_close = ctRegex!(`^(.*?)\}$`, "m"); // strip #+END_SRC -** no obj_cite_number object :ocn:off:object: +*** no obj_cite_number object :ocn:off:object: #+name: ao_rgx #+BEGIN_SRC d @@ -1033,7 +792,7 @@ static obj_cite_number_off_dh = ctRegex!(`-#$`, "m"); static obj_cite_number_off_all = ctRegex!(`[~-]#$`, "m"); #+END_SRC -** no obj_cite_number block :ocn:off:block: +*** no obj_cite_number block :ocn:off:block: #+name: ao_rgx #+BEGIN_SRC d @@ -1044,7 +803,7 @@ static obj_cite_number_off_block_close = ctRegex!(`^--\+#$`); static obj_cite_number_block_marks = ctRegex!(`^--[+~-]#$`); #+END_SRC -** ignore outside code blocks :block:code: +*** ignore outside code blocks :block:code: #+name: ao_rgx #+BEGIN_SRC d @@ -1052,7 +811,7 @@ static obj_cite_number_block_marks = ctRegex!(`^--[+~-]#$`); static skip_from_regular_parse = ctRegex!(`^(--[+~-]#|-[\\]{2}-|=[.\\]{2}=)$`); // not structural info #+END_SRC -** line & page breaks :break: +*** line & page breaks :break: #+name: ao_rgx #+BEGIN_SRC d @@ -1065,7 +824,7 @@ static break_string = ctRegex!(`』`); static parent = ctRegex!(`([0-7]):([0-9]+)`); #+END_SRC -** json :json: +*** json :json: #+name: ao_rgx #+BEGIN_SRC d @@ -1073,7 +832,7 @@ static parent = ctRegex!(`([0-7]):([0-9] static tailing_comma = ctRegex!(`,$`, "m"); #+END_SRC -** biblio tags :biblio:tags: +*** biblio tags :biblio:tags: #+name: ao_rgx #+BEGIN_SRC d @@ -1082,7 +841,7 @@ static biblio_tags = ctRegex!(`^(is|au|author 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 :bookindex:split: #+name: ao_rgx #+BEGIN_SRC d @@ -1104,6 +863,324 @@ 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 regex & defaults +** 0. defaults :defaults: + +*** 0. defaults: :defaults: + +#+name: tangle_defaults +#+BEGIN_SRC d :tangle ../src/sdp/defaults.d +/++ + default settings ++/ +<<defaults_template_init_flags>> +<<defaults_template_paths>> +<<defaults_template_markup>> +<<defaults_template_language_codes>> +#+END_SRC + +*** imports + +#+name: defaults_imports +#+BEGIN_SRC d +private import + std.algorithm, + std.array, + std.container, + std.exception, + std.file, + std.getopt, + std.json, + std.path, + std.process, + std.range, + std.regex, + std.stdio, + std.string, + std.traits, + std.typecons, + std.uni, + std.utf, + std.conv : to; +#+END_SRC + + +*** TODO template: dir paths :dir:path: + +#+name: defaults_template_paths +#+BEGIN_SRC d +template SiSUpaths() { + string _base_filename(string fn_src) { + string _fn_base = ""; + if (extension(fn_src) == ".sst") { + _fn_base = baseName(fn_src, ".sst"); + } else if (extension(fn_src) == ".ssm") { + _fn_base = baseName(fn_src, ".ssm"); + } + return _fn_base; + } + struct DirPaths { + string base_filename(string fn_src) { + return _base_filename(fn_src); + } + } + struct SiSUpodPaths { + string base_filename(string fn_src) { + return _base_filename(fn_src); + } + string base(string fn_src) { + return chainPath("sisupod", _base_filename(fn_src)).array; + } + string doc(string fn_src) { + return chainPath(base(fn_src), "doc").array; + // return chainPath(base(fn_src), "text").array; + } + string doc_lng(string fn_src, string lng) { + return chainPath(doc(fn_src), lng).array; + } + string conf(string fn_src) { + return chainPath(doc(fn_src), "_sisu").array; + } + string image(string fn_src) { + return chainPath(conf(fn_src), "image").array; + } + string css(string fn_src) { + return chainPath(conf(fn_src), "css").array; + } + string fn_doc(string fn_src, string lng) { + return chainPath((doc_lng(fn_src, lng)), baseName(fn_src)).array; + } + string fn_doc_insert(string fn_src, string fn_insert, string lng) { + return chainPath((doc_lng(fn_src, lng)), baseName(fn_insert)).array; + } + } + struct HtmlPaths { + string base_filename(string fn_src) { + return _base_filename(fn_src); + } + string base() { + return chainPath("en", "html").array; + } + string seg(string fn_src) { + return chainPath(base, _base_filename(fn_src)).array; + } + string fn_scroll(string fn_src) { + return chainPath(base, _base_filename(fn_src) ~ ".html").array; + } + string fn_seg(string fn_src, string seg_filename) { + return chainPath(seg(fn_src), seg_filename ~ ".html").array; + } + } + struct EpubPaths { + string base_filename(string fn_src) { + return _base_filename(fn_src); + } + string base() { + return chainPath("en", "epub").array; + } + string doc(string fn_src) { + return chainPath(base, _base_filename(fn_src)).array; + } + string doc_meta_inf(string fn_src) { + return chainPath(doc(fn_src), "META-INF").array; + } + string doc_oebps(string fn_src) { + return chainPath(doc(fn_src), "OEBPS").array; + } + string doc_oebps_css(string fn_src) { + return chainPath(doc_oebps(fn_src), "css").array; + } + string doc_oebps_image(string fn_src) { + return chainPath(doc_oebps(fn_src), "image").array; + } + string fn_mimetypes(string fn_src) { + return chainPath(doc(fn_src), "mimetypes").array; + } + string fn_dmi_container_xml(string fn_src) { + return chainPath(doc_meta_inf(fn_src), "container.xml").array; + } + string fn_oebps_toc_ncx(string fn_src) { + return chainPath(doc_oebps(fn_src), "toc.ncx").array; + } + string fn_oebps_content_opf(string fn_src) { + return chainPath(doc_oebps(fn_src), "content.opf").array; + } + string fn_oebps_content_xhtml(string fn_src, string seg_filename) { + return chainPath(doc_oebps(fn_src), seg_filename ~ ".xhtml").array; + } + } +} +#+END_SRC + +** 1. ctRegex :regex: +[[./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: + +#+name: tangle_ao_rgx +#+BEGIN_SRC d :tangle ../src/sdp/ao_rgx.d +/++ + regex: regular expressions used in sisu document parser ++/ +template SiSUoutputRgxInit() { + private import output_defaults; + struct Rgx { + <<prgmkup_rgx>> + } +} +#+END_SRC + +* 2. defaults shared by ao & output (generic) +** 0. defaults :defaults: +*** template: internal markup :markup: + +#+name: defaults_template_markup +#+BEGIN_SRC d +template InternalMarkup() { + struct InlineMarkup { + auto en_a_o = "【"; auto en_a_c = "】"; // endnote en_a_o: '~{'; en_a_c: '}~'; + auto en_b_o = "〖"; auto en_b_c = "〗"; // endnote en_b_o: '~['; en_b_c: ']~'; + auto lnk_o = "┥"; auto lnk_c = "┝"; // auto lnk_o = "⌠"; auto lnk_c = "⌡"; // '⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o= '◁'; Mx[:lnk_c= '▷' #‹ › + auto url_o = "┤"; auto url_c = "├"; + auto mark_internal_site_lnk = "¤"; + auto nbsp = "░"; + auto br_line = "┘"; // "╱"; // lB ▌ 9612 ┘ ¶ + auto br_nl = "┙"; // "╲"; // lB ▌ 』 ┘ + auto br_paragraph = "┚"; // "█"; // FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616 + auto br_obj = "break_obj"; + auto br_page_line = "┼"; // "▭"; + auto br_page = "┿"; // "┼"; + auto br_page_new = "╂"; // "╋"; + string indent_by_spaces_provided(int indent) { + auto _indent_spaces ="░░"; // auto nbsp = "░"; + _indent_spaces = replicate(_indent_spaces, indent); + return _indent_spaces; + } + string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) { + _character = replicate(_character, number); + return _character; + } + } +} +#+END_SRC + +*** template language codes + +#+name: defaults_template_language_codes +#+BEGIN_SRC d +template SiSUlanguageCodes() { + /+ language codes +/ + struct Lang { + string[string][string] codes() { + auto _lang_codes = [ + "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ], + "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ], + "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ], + "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ], + "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ], + "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ], + "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ], + "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ], + "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ], + "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ], + "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], + "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ], + "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ], + "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ], + "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ], + "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ], + "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ], + "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ], + "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ], + "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ], + "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ], + "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ], + "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ], + "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ], + "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ], + "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ], + "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ], + "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ], + "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ], + "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ], + "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ], + "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ], + "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ], + "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ], + "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ], + "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ], + "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ], + "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ], + "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ], + "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ], + "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ], + "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ], + "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ], + "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ], + "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ], + "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ], + "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ], + "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ], + "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ], + "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ], + "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ], + "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ], + "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ], + "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ], + "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ], + "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ], + "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ], + "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ], + "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ], + "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ], + "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ], + "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ], + ]; + return _lang_codes; + } + string[] code_arr_ptr() { + auto _lang_codes = ["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", "us", "vi", "zh", "en", "xx",]; + return _lang_codes; + } + string[] code_arr() { + auto _lang_codes = ["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"]; + return _lang_codes; + } + auto codes_() { + return "(" ~ join(code_arr,"|") ~ ")"; + } + auto codes_regex() { + return regex(codes_); + } + } +} +#+END_SRC + +** 1. ctRegex :regex: +*** inline (internal program) markup footnotes endnotes :inline:footnote: + +#+name: prgmkup_rgx +#+BEGIN_SRC d +/+ inline markup footnotes endnotes +/ +static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); +static inline_notes_al_gen = ctRegex!(`【.+?】`, "m"); +static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); +static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); +static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); +static inline_al_delimiter_close_regular = ctRegex!(`】`, "m"); +static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); +static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg"); +static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(\d+)\s+(.+?)】`, "mg"); +static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); +static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); +static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)【(?:[*+ ]*)(?P<note>.+?)】`, "mg"); +static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); +#+END_SRC + * +set colors for terminal+ (unused) :colors:terminal: #+name: ao_ansi_colors diff --git a/org/output.org b/org/output.org index 903b6ed..9853d50 100644 --- a/org/output.org +++ b/org/output.org @@ -39,7 +39,7 @@ template outputHub() { std.typecons, std.uni, std.utf, - ao_defaults, + defaults, output_epub, output_html, output_xhtmls, @@ -131,7 +131,7 @@ private import std.typecons, std.uni, std.utf, - ao_defaults; + defaults; import ao_rgx, output_xhtmls; diff --git a/org/sdp.org b/org/sdp.org index 46bd97a..b0ff78c 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -23,7 +23,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 13, 0); +enum ver = Version(0, 13, 1); #+END_SRC * 1. sdp (sisu document parser) :sdp: |