diff options
Diffstat (limited to 'org')
| -rw-r--r-- | org/default_regex.org | 44 | ||||
| -rw-r--r-- | org/out_sqlite.org | 63 | ||||
| -rw-r--r-- | org/out_xmls.org | 55 | 
3 files changed, 151 insertions, 11 deletions
| diff --git a/org/default_regex.org b/org/default_regex.org index b0a47ca..9ea040e 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -45,7 +45,8 @@ static template spineRgxIn() {      <<meta_rgx_comments>>      <<meta_rgx_config>>      <<meta_rgx_headers>> -    <<meta_rgx_heading_and_paragraph_marks>> +    <<meta_rgx_heading_marks>> +    <<meta_rgx_paragraph_marks>>      <<meta_rgx_blocks>>      <<meta_rgx_block_tic>>      <<meta_rgx_block_curly>> @@ -144,11 +145,11 @@ static yaml_header_meta_title                         = ctRegex!(`^\s*title\s*:\  static yaml_config                                    = ctRegex!(`^[a-z]+\s*:\s*(?:"?\w|$)`, "m");  #+END_SRC -** heading & paragraph operators :paragraph:operator: +** heading operators :heading:operator: -#+NAME: meta_rgx_heading_and_paragraph_marks +#+NAME: meta_rgx_heading_marks  #+BEGIN_SRC d -/+ heading & paragraph operators +/ +/+ heading operators +/  static heading_a                                      = ctRegex!(`^:?[A][~] `, "m");  static heading                                        = ctRegex!(`^:?([A-D1-4])[~]([a-z0-9_.-]*[?]?)\s+`,"i");  static headings                                       = ctRegex!(`^:?(?P<level>[A-D1-4])[~](?:[a-z0-9_.-]*[?]?|[!](?:glossary|bibliogrphy|biblio|references?|blurb))(?:\s|$)`,"i"); @@ -164,6 +165,13 @@ static heading_marker_tag_has_colon                   = ctRegex!(`([:])`);  static heading_biblio                                 = ctRegex!(`^1[~][!](biblio(?:graphy)?|references?)`);  static heading_glossary                               = ctRegex!(`^1[~][!](glossary)`);  static heading_blurb                                  = ctRegex!(`^1[~][!](blurb)`); +#+END_SRC + +** paragraph operators :paragraph:operator: + +#+NAME: meta_rgx_paragraph_marks +#+BEGIN_SRC d +/+ paragraph operators +/  static para_bullet                                    = ctRegex!(`^_[*] `);  static para_bullet_indent                             = ctRegex!(`^_(?P<indent>[1-9])[*] `);  static para_indent                                    = ctRegex!(`^_(?P<indent>[1-9])[ ]`); @@ -172,6 +180,33 @@ static para_attribs                                   = ctRegex!(`^_(?:(?:[0-9])  static para_inline_link_anchor                        = ctRegex!(`\*[~](?P<anchor>[a-z0-9_.-]+)(?= |$)`,"i");  #+END_SRC +#+NAME: grouped_text_rgx_paragraph_marks +#+BEGIN_SRC d +/+ paragraph operators +/ +static grouped_para_indent_1                                  = ctRegex!(`^_1[ ]`, "m"); +static grouped_para_indent_2                                  = ctRegex!(`^_2[ ]`, "m"); +static grouped_para_indent_3                                  = ctRegex!(`^_3[ ]`, "m"); +static grouped_para_indent_4                                  = ctRegex!(`^_4[ ]`, "m"); +static grouped_para_indent_5                                  = ctRegex!(`^_5[ ]`, "m"); +static grouped_para_indent_6                                  = ctRegex!(`^_6[ ]`, "m"); +static grouped_para_indent_7                                  = ctRegex!(`^_7[ ]`, "m"); +static grouped_para_indent_8                                  = ctRegex!(`^_8[ ]`, "m"); +static grouped_para_indent_9                                  = ctRegex!(`^_9[ ]`, "m"); +static grouped_para_bullet                                    = ctRegex!(`^_[*] `, "m"); +static grouped_para_bullet_indent_1                           = ctRegex!(`^_1[*] `, "m"); +static grouped_para_bullet_indent_2                           = ctRegex!(`^_2[*] `, "m"); +static grouped_para_bullet_indent_3                           = ctRegex!(`^_3[*] `, "m"); +static grouped_para_bullet_indent_4                           = ctRegex!(`^_4[*] `, "m"); +static grouped_para_bullet_indent_5                           = ctRegex!(`^_5[*] `, "m"); +static grouped_para_bullet_indent_6                           = ctRegex!(`^_6[*] `, "m"); +static grouped_para_bullet_indent_7                           = ctRegex!(`^_7[*] `, "m"); +static grouped_para_bullet_indent_8                           = ctRegex!(`^_8[*] `, "m"); +static grouped_para_bullet_indent_9                           = ctRegex!(`^_9[*] `, "m"); +static grouped_para_bullet_indent                             = ctRegex!(`^_(?P<indent>[1-9])[*] `, "m"); +static grouped_para_indent                                    = ctRegex!(`^_(?P<indent>[1-9])[ ]`, "m"); +static grouped_para_indent_hang                               = ctRegex!(`^_(?P<hang>[0-9])_(?P<indent>[0-9])[ ]`, "m"); +#+END_SRC +  ** blocked markup  *** blocked markup curly & tic :block: @@ -414,6 +449,7 @@ static template spineRgxOut() {      <<prgmkup_rgx_table>>      <<sp_ch_xhtml_rgx>>      <<sp_ch_latex_rgx>> +    <<grouped_text_rgx_paragraph_marks>>    }  }  #+END_SRC diff --git a/org/out_sqlite.org b/org/out_sqlite.org index 21e1cea..ecbfbe9 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -191,6 +191,7 @@ template SQLiteFormatAndLoadObject() {        <<sanitize_and_munge_inline_html_special_characters>>        <<sanitize_and_munge_inline_html_special_characters_code>>        <<sanitize_and_munge_inline_html_font_face>> +      <<sanitize_and_munge_inline_html_grouped_text_bullets_indents>>        <<sanitize_and_munge_inline_html_images>>        <<sanitize_and_munge_inline_html_inline_links>>        <<sanitize_and_munge_inline_html_inline_notes_scroll>> @@ -611,6 +612,63 @@ string html_font_face(string _txt){  #+END_SRC  ****** inline markup +******* grouped text + +#+NAME: sanitize_and_munge_inline_html_grouped_text_bullets_indents +#+BEGIN_SRC d +string inline_grouped_text_bullets_indents(M,O)( +               M  doc_matters, +  const        O  obj, +  string          _txt, +  string          _suffix   = ".html", +  string          _xml_type = "seg", +) { +  static auto rgx = RgxO(); +  if (obj.metainfo.is_a == "group") { +    _txt = (_txt) +      .replaceAll(rgx.grouped_para_indent_1, +        "  ") +      .replaceAll(rgx.grouped_para_indent_2, +        "    ") +      .replaceAll(rgx.grouped_para_indent_3, +        "      ") +      .replaceAll(rgx.grouped_para_indent_4, +        "        ") +      .replaceAll(rgx.grouped_para_indent_5, +        "          ") +      .replaceAll(rgx.grouped_para_indent_6, +        "            ") +      .replaceAll(rgx.grouped_para_indent_7, +        "              ") +      .replaceAll(rgx.grouped_para_indent_8, +        "                ") +      .replaceAll(rgx.grouped_para_indent_9, +        "                  ") +      .replaceAll(rgx.grouped_para_indent_hang,      "  ") +      .replaceAll(rgx.grouped_para_bullet,           "●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_1, +        "  ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_2, +        "    ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_3, +        "      ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_4, +        "        ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_5, +        "          ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_6, +        "            ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_7, +        "              ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_8, +        "                ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_9, +        "                  ●  "); +  } +  return _txt; +} +#+END_SRC +  ******* images  #+NAME: sanitize_and_munge_inline_html_images @@ -798,6 +856,9 @@ string inline_markup(M,O)(    const        O  obj,    string          _txt,  ) { +  if (obj.metainfo.is_a == "group") { +    _txt = inline_grouped_text_bullets_indents(doc_matters, obj, _txt, xml_type); +  }    _txt = inline_images(doc_matters, obj, _txt, xml_type);    _txt = inline_links(doc_matters, obj, _txt, xml_type);    _txt = inline_notes_scroll(doc_matters, obj, _txt); @@ -915,6 +976,7 @@ string html_group(M,O)(    assert(obj.metainfo.is_of_type    == "block");    assert(obj.metainfo.is_a          == "group");    string _txt = munge_html(doc_matters, obj); +  _txt = inline_markup(doc_matters, obj, _txt);    string o = format(q"┃<p class="%s">      %s    </p>┃", @@ -938,6 +1000,7 @@ string html_block(M,O)(    assert(obj.metainfo.is_of_type    == "block");    assert(obj.metainfo.is_a          == "block");    string _txt = munge_html(doc_matters, obj); +  _txt = inline_markup(doc_matters, obj, _txt);    string o = format(q"┃    <p class="%s">%s</p>┃",        obj.metainfo.is_a, diff --git a/org/out_xmls.org b/org/out_xmls.org index 79a81c7..ca202c4 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -34,7 +34,7 @@ template outputXHTMLs() {      static auto rgx = RgxO();      <<xhtml_format_objects_div_delimit>>      <<xhtml_format_objects_special_characters_text>> -    <<xhtml_format_objects_special_characters>> +    <<xhtml_format_objects_breaks_indents_bullets>>      <<xhtml_format_objects_font_face>>      <<xhtml_format_objects_xml_anchor_tags>>      <<xhtml_format_objects_header_metadata>> @@ -163,14 +163,55 @@ import  }  #+END_SRC -**** special characters +**** breaks indents bullets -#+NAME: xhtml_format_objects_special_characters +#+NAME: xhtml_format_objects_breaks_indents_bullets  #+BEGIN_SRC d -@safe string special_characters(O)( +@safe string special_characters_breaks_indents_bullets(O)(    const  O         obj,  ) {    string _txt = special_characters_text(obj.text); +  if (obj.metainfo.is_a == "group") { +    _txt = (_txt) +      .replaceAll(rgx.grouped_para_indent_1, +        "  ") +      .replaceAll(rgx.grouped_para_indent_2, +        "    ") +      .replaceAll(rgx.grouped_para_indent_3, +        "      ") +      .replaceAll(rgx.grouped_para_indent_4, +        "        ") +      .replaceAll(rgx.grouped_para_indent_5, +        "          ") +      .replaceAll(rgx.grouped_para_indent_6, +        "            ") +      .replaceAll(rgx.grouped_para_indent_7, +        "              ") +      .replaceAll(rgx.grouped_para_indent_8, +        "                ") +      .replaceAll(rgx.grouped_para_indent_9, +        "                  ") +      .replaceAll(rgx.grouped_para_indent_hang,      "  ") +      .replaceAll(rgx.grouped_para_bullet,           "●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_1, +        "  ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_2, +        "    ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_3, +        "      ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_4, +        "        ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_5, +        "          ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_6, +        "            ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_7, +        "              ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_8, +        "                ●  ") +      .replaceAll(rgx.grouped_para_bullet_indent_9, +        "                  ●  "); +  }    if (!(obj.metainfo.is_a == "code")) {      _txt = (_txt)        .replaceAll(rgx.xhtml_line_break,   "<br />"); @@ -1636,7 +1677,7 @@ template outputHTML() {  foreach (part; doc_matters.has.keys_seq.scroll) {    foreach (obj; doc_abstraction[part]) {      delimit = xhtml_format.div_delimit(part, previous_part); -    string _txt = xhtml_format.special_characters(obj); +    string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);      switch (obj.metainfo.is_of_part) {  #+END_SRC @@ -1882,7 +1923,7 @@ default:  foreach (part; doc_matters.has.keys_seq.seg) {    foreach (obj; doc_abstraction[part]) {      delimit = xhtml_format.div_delimit(part, previous_part); -    string _txt = xhtml_format.special_characters(obj); +    string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);  #+END_SRC  ***** all headings @@ -2708,7 +2749,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">  #+BEGIN_SRC d  foreach (part; doc_matters.has.keys_seq.seg) {    foreach (obj; doc_abstraction[part]) { -    string _txt = xhtml_format.special_characters(obj); +    string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj);  #+END_SRC  ***** all headings | 
