From 0c693b23c4ff8f98a151884a24f150a5ff746dd4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 16 Oct 2020 19:16:18 -0400 Subject: org mode, unique code-block names & adjust headers - avoid org-mode undefined behavior, provide unique code-block names --- org/out_sqlite.org | 141 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 52 deletions(-) (limited to 'org/out_sqlite.org') diff --git a/org/out_sqlite.org b/org/out_sqlite.org index a35bcf1..a71a4ec 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -7,6 +7,7 @@ #+COPYRIGHT: Copyright (C) 2015 - 2020 Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty +#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t #+PROPERTY: header-args :exports code #+PROPERTY: header-args+ :noweb yes #+PROPERTY: header-args+ :eval no @@ -183,10 +184,33 @@ template SQLiteFormatAndLoadObject() { mixin spineRgxOut; struct sqlite_format_and_load_objects { <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> } return sqlite_format_and_load_objects(); } @@ -222,7 +246,9 @@ template SQLiteDeleteDocument() { string SQLiteDeleteDocument(M)( M doc_matters, ) { - <> + <> + <> + <> return _delete_uid; } } @@ -236,8 +262,16 @@ template SQLiteInsertMetadata() { string SQLiteInsertMetadata(M)( M doc_matters, ) { - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> return _insert_metadata; } } @@ -255,7 +289,10 @@ template SQLiteInsertDocObjectsLoop() { string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url_html, doc_matters.src.language); string insertDocObjectsRow(O)(O obj) { - <> + <> + <> + <> + <> return _insert_doc_objects_row; } <> @@ -477,7 +514,7 @@ light html objects ***** munge ****** general munge (special characters, inline markup, move notes) -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_0 #+BEGIN_SRC d string munge_html(M,O)( M doc_matters, @@ -522,7 +559,7 @@ string munge_html(M,O)( ****** special characters -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_1 #+BEGIN_SRC d string html_special_characters(string _txt){ _txt = _txt @@ -538,7 +575,7 @@ string html_special_characters(string _txt){ ****** special characters for code -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_2 #+BEGIN_SRC d string html_special_characters_code(string _txt){ _txt = _txt @@ -553,7 +590,7 @@ string html_special_characters_code(string _txt){ ****** font_face -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_3 #+BEGIN_SRC d string html_font_face(string _txt){ _txt = _txt @@ -574,7 +611,7 @@ string html_font_face(string _txt){ ****** inline markup ******* images -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_4 #+BEGIN_SRC d string inline_images(M,O)( M doc_matters, @@ -605,7 +642,7 @@ string inline_images(M,O)( ******* links ******** scroll, seg, epub -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_5 #+BEGIN_SRC d string inline_links(M,O)( M doc_matters, @@ -715,7 +752,7 @@ string inline_links(M,O)( ******* notes ******** scroll -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_6 #+BEGIN_SRC d string inline_notes_scroll(M,O)( M doc_matters, @@ -751,7 +788,7 @@ string inline_notes_scroll(M,O)( ******* inline markup -#+NAME: sanitize_and_munge_inline_html +#+NAME: sanitize_and_munge_inline_html_7 #+BEGIN_SRC d string xml_type="seg"; /+ set html document type to be linked to here (seg|scroll) +/ string inline_markup(M,O)( @@ -769,7 +806,7 @@ string inline_markup(M,O)( ***** objects ****** heading -#+NAME: html_objects +#+NAME: html_objects_0 #+BEGIN_SRC d string html_heading(M,O)( M doc_matters, @@ -815,7 +852,7 @@ string html_heading(M,O)( ****** para -#+NAME: html_objects +#+NAME: html_objects_1 #+BEGIN_SRC d string html_para(M,O)( M doc_matters, @@ -842,7 +879,7 @@ string html_para(M,O)( ****** quote -#+NAME: html_objects +#+NAME: html_objects_2 #+BEGIN_SRC d string html_quote(M,O)( M doc_matters, @@ -865,7 +902,7 @@ string html_quote(M,O)( ****** group -#+NAME: html_objects +#+NAME: html_objects_3 #+BEGIN_SRC d string html_group(M,O)( M doc_matters, @@ -888,7 +925,7 @@ string html_group(M,O)( ****** block -#+NAME: html_objects +#+NAME: html_objects_4 #+BEGIN_SRC d string html_block(M,O)( M doc_matters, @@ -910,7 +947,7 @@ string html_block(M,O)( ****** verse -#+NAME: html_objects +#+NAME: html_objects_5 #+BEGIN_SRC d string html_verse(M,O)( M doc_matters, @@ -931,7 +968,7 @@ string html_verse(M,O)( ****** code -#+NAME: html_objects +#+NAME: html_objects_6 #+BEGIN_SRC d string html_code(O)( const O obj, @@ -951,7 +988,7 @@ string html_code(O)( ****** table -#+NAME: html_objects +#+NAME: html_objects_7 #+BEGIN_SRC d string html_table(M,O)( M doc_matters, @@ -1023,7 +1060,7 @@ string html_table(M,O)( *** 2. hub (sqlite_format_and_load_objects) **** sql related -#+NAME: sqlite_load_object +#+NAME: sqlite_load_object_0 #+BEGIN_SRC d string sqlite_load_string(M,O)( M doc_matters, @@ -1034,7 +1071,7 @@ string sqlite_load_string(M,O)( } #+END_SRC -#+NAME: sqlite_load_object +#+NAME: sqlite_load_object_1 #+BEGIN_SRC d string postgresql_load_string(M,O)( M doc_matters, @@ -1045,7 +1082,7 @@ string postgresql_load_string(M,O)( } #+END_SRC -#+NAME: sqlite_load_object +#+NAME: sqlite_load_object_2 #+BEGIN_SRC d string sqlite_statement(O)( const O obj, @@ -1065,7 +1102,7 @@ string sqlite_statement(O)( **** heading -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_0 #+BEGIN_SRC d string[string] heading(M,O)( M doc_matters, @@ -1094,7 +1131,7 @@ string[string] heading(M,O)( **** para -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_1 #+BEGIN_SRC d string[string] para(M,O)( M doc_matters, @@ -1123,7 +1160,7 @@ string[string] para(M,O)( **** quote -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_2 #+BEGIN_SRC d string[string] quote(M,O)( M doc_matters, @@ -1151,7 +1188,7 @@ string[string] quote(M,O)( #+END_SRC **** group -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_3 #+BEGIN_SRC d string[string] group(M,O)( M doc_matters, @@ -1180,7 +1217,7 @@ string[string] group(M,O)( **** block -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_4 #+BEGIN_SRC d string[string] block(M,O)( M doc_matters, @@ -1209,7 +1246,7 @@ string[string] block(M,O)( **** verse -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_5 #+BEGIN_SRC d string[string] verse(M,O)( M doc_matters, @@ -1238,7 +1275,7 @@ string[string] verse(M,O)( **** code -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_6 #+BEGIN_SRC d string[string] code(M,O)( M doc_matters, @@ -1267,7 +1304,7 @@ string[string] code(M,O)( **** table -#+NAME: hub_format_and_sqlite_load_objects +#+NAME: hub_format_and_sqlite_load_objects_7 #+BEGIN_SRC d string[string] table(M,O)( M doc_matters, @@ -1682,7 +1719,7 @@ CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register); **** DELETE uid rows doc matters & metadata ***** sql statement: dlang format -#+NAME: sqlite_formatted_delete +#+NAME: sqlite_formatted_delete_0 #+BEGIN_SRC d string _uid = doc_matters.src.doc_uid; string _delete_uid = format(q"┃ @@ -1690,7 +1727,7 @@ string _delete_uid = format(q"┃ ***** DELETE FROM ... WHERE -#+NAME: sqlite_formatted_delete +#+NAME: sqlite_formatted_delete_1 #+BEGIN_SRC sql DELETE FROM metadata_and_text WHERE uid = '%s'; @@ -1700,7 +1737,7 @@ WHERE uid_metadata_and_text = '%s'; ***** VALUES -#+NAME: sqlite_formatted_delete +#+NAME: sqlite_formatted_delete_2 #+BEGIN_SRC d ┃", _uid, @@ -1712,7 +1749,7 @@ WHERE uid_metadata_and_text = '%s'; **** INSERT doc matters & metadata ***** sql statement: dlang format -#+NAME: sqlite_formatted_insertions_doc_matters_metadata +#+NAME: sqlite_formatted_insertions_doc_matters_metadata_0 #+BEGIN_SRC d string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); string _insert_metadata = format(q"┃ @@ -1720,7 +1757,7 @@ string _insert_metadata = format(q"┃ ***** INSERT INTO -#+NAME: sqlite_formatted_insertions_doc_matters_metadata +#+NAME: sqlite_formatted_insertions_doc_matters_metadata_1 #+BEGIN_SRC sql INSERT INTO metadata_and_text ( uid, @@ -1778,7 +1815,7 @@ string _insert_metadata = format(q"┃ ***** VALUES -#+NAME: sqlite_formatted_insertions_doc_matters_metadata +#+NAME: sqlite_formatted_insertions_doc_matters_metadata_2 #+BEGIN_SRC sql VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' @@ -1787,7 +1824,7 @@ string _insert_metadata = format(q"┃ ***** dlang values for formatting -#+NAME: sqlite_formatted_insertions_doc_matters_metadata +#+NAME: sqlite_formatted_insertions_doc_matters_metadata_3 #+BEGIN_SRC d ┃", _uid, @@ -1849,7 +1886,7 @@ writeln(doc_matters.conf_make_meta.meta.classify_topic_register_arr); ***** { if topic register then loop topic register array -#+NAME: sqlite_formatted_insertions_topic_register +#+NAME: sqlite_formatted_insertions_topic_register_0 #+BEGIN_SRC d if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { string _insert_topics; @@ -1859,14 +1896,14 @@ if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) { ***** sql statement: dlang format -#+NAME: sqlite_formatted_insertions_topic_register +#+NAME: sqlite_formatted_insertions_topic_register_1 #+BEGIN_SRC d _insert_topics ~= format(q"┃ #+END_SRC ***** INSERT INTO -#+NAME: sqlite_formatted_insertions_topic_register +#+NAME: sqlite_formatted_insertions_topic_register_2 #+BEGIN_SRC sql INSERT INTO topic_register ( uid_metadata_and_text, @@ -1880,7 +1917,7 @@ _insert_topics ~= format(q"┃ ***** VALUES -#+NAME: sqlite_formatted_insertions_topic_register +#+NAME: sqlite_formatted_insertions_topic_register_3 #+BEGIN_SRC sql VALUES ( '%s', '%s', '%s', '%s', '%s', '%s' @@ -1889,7 +1926,7 @@ _insert_topics ~= format(q"┃ ***** dlang values for formatting -#+NAME: sqlite_formatted_insertions_topic_register +#+NAME: sqlite_formatted_insertions_topic_register_4 #+BEGIN_SRC d ┃", _uid, @@ -1903,7 +1940,7 @@ _insert_topics ~= format(q"┃ ***** } close topic register & loop topic register array -#+NAME: sqlite_formatted_insertions_topic_register +#+NAME: sqlite_formatted_insertions_topic_register_5 #+BEGIN_SRC d } } @@ -1920,14 +1957,14 @@ either: ***** sql statement: dlang format -#+NAME: sqlite_formatted_insertions_doc_objects +#+NAME: sqlite_formatted_insertions_doc_objects_0 #+BEGIN_SRC d string _insert_doc_objects_row = format(q"┃ #+END_SRC ***** INSERT INTO -#+NAME: sqlite_formatted_insertions_doc_objects +#+NAME: sqlite_formatted_insertions_doc_objects_1 #+BEGIN_SRC sql INSERT INTO doc_objects ( uid_metadata_and_text, @@ -1944,7 +1981,7 @@ string _insert_doc_objects_row = format(q"┃ ***** VALUES -#+NAME: sqlite_formatted_insertions_doc_objects +#+NAME: sqlite_formatted_insertions_doc_objects_2 #+BEGIN_SRC sql VALUES ( '%s', %s, '%s', '%s', '%s', %s, '%s', '%s', '%s' @@ -1953,7 +1990,7 @@ string _insert_doc_objects_row = format(q"┃ ***** dlang values for formatting -#+NAME: sqlite_formatted_insertions_doc_objects +#+NAME: sqlite_formatted_insertions_doc_objects_3 #+BEGIN_SRC d ┃", _uid, -- cgit v1.2.3