sisu 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. checksums.yaml +7 -0
  2. data/bin/sisu +367 -0
  3. data/bin/sisugem +367 -0
  4. data/data/sisu/image/arrow_next_red.png +0 -0
  5. data/data/sisu/image/arrow_prev_red.png +0 -0
  6. data/data/sisu/image/arrow_up_red.png +0 -0
  7. data/data/sisu/image/b_bluebell.png +0 -0
  8. data/data/sisu/image/b_doc.png +0 -0
  9. data/data/sisu/image/b_epub.png +0 -0
  10. data/data/sisu/image/b_home.png +0 -0
  11. data/data/sisu/image/b_info.png +0 -0
  12. data/data/sisu/image/b_odf.png +0 -0
  13. data/data/sisu/image/b_pdf.png +0 -0
  14. data/data/sisu/image/b_search.png +0 -0
  15. data/data/sisu/image/b_toc.png +0 -0
  16. data/data/sisu/image/bullet_08.png +0 -0
  17. data/data/sisu/image/bullet_09.png +0 -0
  18. data/data/sisu/image/bullet_10.png +0 -0
  19. data/data/sisu/image/bullet_11.png +0 -0
  20. data/data/sisu/image/bullet_12.png +0 -0
  21. data/data/sisu/image/bullet_doc.png +0 -0
  22. data/data/sisu/image/bullet_red.png +0 -0
  23. data/data/sisu/image/dot_clear.png +0 -0
  24. data/data/sisu/image/dot_white.png +0 -0
  25. data/data/sisu/image/gplv3.png +0 -0
  26. data/data/sisu/image/gplv3_free_software.png +0 -0
  27. data/data/sisu/image/next.png +0 -0
  28. data/data/sisu/image/previous.png +0 -0
  29. data/data/sisu/image/rb7.ico +0 -0
  30. data/data/sisu/image/sisu.png +0 -0
  31. data/data/sisu/image/toctoc.png +0 -0
  32. data/data/sisu/version.yml +5 -0
  33. data/lib/sisu.rb +94 -0
  34. data/lib/sisu/air.rb +80 -0
  35. data/lib/sisu/ao.rb +590 -0
  36. data/lib/sisu/ao_character_check.rb +102 -0
  37. data/lib/sisu/ao_composite.rb +286 -0
  38. data/lib/sisu/ao_doc_objects.rb +565 -0
  39. data/lib/sisu/ao_doc_str.rb +2269 -0
  40. data/lib/sisu/ao_endnotes.rb +136 -0
  41. data/lib/sisu/ao_expand_insertions.rb +514 -0
  42. data/lib/sisu/ao_hash_digest.rb +174 -0
  43. data/lib/sisu/ao_idx.rb +422 -0
  44. data/lib/sisu/ao_images.rb +187 -0
  45. data/lib/sisu/ao_metadata.rb +86 -0
  46. data/lib/sisu/ao_misc_arrange.rb +207 -0
  47. data/lib/sisu/ao_numbering.rb +720 -0
  48. data/lib/sisu/ao_persist.rb +194 -0
  49. data/lib/sisu/ao_references.rb +502 -0
  50. data/lib/sisu/ao_syntax.rb +640 -0
  51. data/lib/sisu/cgi.rb +84 -0
  52. data/lib/sisu/cgi_pgsql.rb +270 -0
  53. data/lib/sisu/cgi_sql_common.rb +986 -0
  54. data/lib/sisu/cgi_sqlite.rb +244 -0
  55. data/lib/sisu/conf.rb +287 -0
  56. data/lib/sisu/constants.rb +388 -0
  57. data/lib/sisu/css.rb +3484 -0
  58. data/lib/sisu/db_columns.rb +1997 -0
  59. data/lib/sisu/db_create.rb +689 -0
  60. data/lib/sisu/db_dbi.rb +90 -0
  61. data/lib/sisu/db_drop.rb +207 -0
  62. data/lib/sisu/db_import.rb +877 -0
  63. data/lib/sisu/db_indexes.rb +146 -0
  64. data/lib/sisu/db_load_tuple.rb +323 -0
  65. data/lib/sisu/db_remove.rb +182 -0
  66. data/lib/sisu/db_select.rb +230 -0
  67. data/lib/sisu/db_sqltxt.rb +173 -0
  68. data/lib/sisu/db_tests.rb +114 -0
  69. data/lib/sisu/dbi.rb +166 -0
  70. data/lib/sisu/dbi_discrete.rb +206 -0
  71. data/lib/sisu/digests.rb +306 -0
  72. data/lib/sisu/dp.rb +1606 -0
  73. data/lib/sisu/dp_identify_markup.rb +161 -0
  74. data/lib/sisu/dp_make.rb +668 -0
  75. data/lib/sisu/embedded.rb +149 -0
  76. data/lib/sisu/errors.rb +84 -0
  77. data/lib/sisu/generic_parts.rb +131 -0
  78. data/lib/sisu/git.rb +277 -0
  79. data/lib/sisu/html.rb +775 -0
  80. data/lib/sisu/html_concordance.rb +391 -0
  81. data/lib/sisu/html_format.rb +1348 -0
  82. data/lib/sisu/html_harvest.rb +109 -0
  83. data/lib/sisu/html_harvest_author_format.rb +111 -0
  84. data/lib/sisu/html_harvest_authors.rb +466 -0
  85. data/lib/sisu/html_harvest_topics.rb +893 -0
  86. data/lib/sisu/html_lite_shared.rb +324 -0
  87. data/lib/sisu/html_manifest.rb +1032 -0
  88. data/lib/sisu/html_minitoc.rb +230 -0
  89. data/lib/sisu/html_parts.rb +437 -0
  90. data/lib/sisu/html_persist.rb +237 -0
  91. data/lib/sisu/html_promo.rb +440 -0
  92. data/lib/sisu/html_scroll.rb +235 -0
  93. data/lib/sisu/html_segments.rb +716 -0
  94. data/lib/sisu/html_shared.rb +62 -0
  95. data/lib/sisu/html_table.rb +64 -0
  96. data/lib/sisu/html_tune.rb +301 -0
  97. data/lib/sisu/hub.rb +277 -0
  98. data/lib/sisu/hub_actions.rb +1122 -0
  99. data/lib/sisu/hub_loop_markup_files.rb +170 -0
  100. data/lib/sisu/hub_options.rb +1695 -0
  101. data/lib/sisu/i18n.rb +702 -0
  102. data/lib/sisu/manpage.rb +377 -0
  103. data/lib/sisu/manpage_format.rb +85 -0
  104. data/lib/sisu/object_munge.rb +307 -0
  105. data/lib/sisu/prog_text_translation.rb +1702 -0
  106. data/lib/sisu/qrcode.rb +754 -0
  107. data/lib/sisu/relaxng.rb +1153 -0
  108. data/lib/sisu/remote.rb +246 -0
  109. data/lib/sisu/rexml.rb +148 -0
  110. data/lib/sisu/se.rb +158 -0
  111. data/lib/sisu/se_cleanoutput.rb +145 -0
  112. data/lib/sisu/se_clear.rb +105 -0
  113. data/lib/sisu/se_createsite.rb +273 -0
  114. data/lib/sisu/se_css.rb +221 -0
  115. data/lib/sisu/se_date.rb +92 -0
  116. data/lib/sisu/se_db.rb +214 -0
  117. data/lib/sisu/se_envcall.rb +326 -0
  118. data/lib/sisu/se_file_op.rb +2758 -0
  119. data/lib/sisu/se_filemap.rb +247 -0
  120. data/lib/sisu/se_get_init.rb +238 -0
  121. data/lib/sisu/se_hub_particulars.rb +234 -0
  122. data/lib/sisu/se_info_env.rb +2179 -0
  123. data/lib/sisu/se_info_port.rb +70 -0
  124. data/lib/sisu/se_info_system.rb +202 -0
  125. data/lib/sisu/se_load.rb +108 -0
  126. data/lib/sisu/se_processing.rb +659 -0
  127. data/lib/sisu/se_programs.rb +394 -0
  128. data/lib/sisu/se_remotes.rb +553 -0
  129. data/lib/sisu/se_standardise_lang.rb +176 -0
  130. data/lib/sisu/se_version.rb +174 -0
  131. data/lib/sisu/shared_images.rb +137 -0
  132. data/lib/sisu/shared_markup_alt.rb +336 -0
  133. data/lib/sisu/shared_metadata.rb +1361 -0
  134. data/lib/sisu/shared_sem.rb +156 -0
  135. data/lib/sisu/sisu_thor_lib.rb +407 -0
  136. data/lib/sisu/sitemaps.rb +224 -0
  137. data/lib/sisu/src_kdissert_share.rb +102 -0
  138. data/lib/sisu/src_po4a_share.rb +309 -0
  139. data/lib/sisu/src_po4a_shelf.rb +1217 -0
  140. data/lib/sisu/src_po4a_shelf_set.rb +297 -0
  141. data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
  142. data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
  143. data/lib/sisu/src_po4a_sstm.rb +135 -0
  144. data/lib/sisu/src_shared.rb +347 -0
  145. data/lib/sisu/src_sisupod_make.rb +171 -0
  146. data/lib/sisu/src_sisupod_sstm.rb +109 -0
  147. data/lib/sisu/sst_convert_markup.rb +323 -0
  148. data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
  149. data/lib/sisu/sst_from_xml.rb +178 -0
  150. data/lib/sisu/sst_identify_markup.rb +482 -0
  151. data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
  152. data/lib/sisu/termsheet.rb +163 -0
  153. data/lib/sisu/texinfo.rb +430 -0
  154. data/lib/sisu/texinfo_format.rb +541 -0
  155. data/lib/sisu/texpdf.rb +1162 -0
  156. data/lib/sisu/texpdf_format.rb +1689 -0
  157. data/lib/sisu/texpdf_parts.rb +235 -0
  158. data/lib/sisu/txt_asciidoc.rb +354 -0
  159. data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
  160. data/lib/sisu/txt_markdown.rb +389 -0
  161. data/lib/sisu/txt_markdown_decorate.rb +207 -0
  162. data/lib/sisu/txt_orgmode.rb +376 -0
  163. data/lib/sisu/txt_orgmode_decorate.rb +186 -0
  164. data/lib/sisu/txt_output.rb +86 -0
  165. data/lib/sisu/txt_plain.rb +410 -0
  166. data/lib/sisu/txt_plain_decorate.rb +189 -0
  167. data/lib/sisu/txt_read.rb +109 -0
  168. data/lib/sisu/txt_rst.rb +371 -0
  169. data/lib/sisu/txt_rst_decorate.rb +186 -0
  170. data/lib/sisu/txt_shared.rb +241 -0
  171. data/lib/sisu/txt_textile.rb +367 -0
  172. data/lib/sisu/txt_textile_decorate.rb +186 -0
  173. data/lib/sisu/update.rb +141 -0
  174. data/lib/sisu/urls.rb +696 -0
  175. data/lib/sisu/utils.rb +232 -0
  176. data/lib/sisu/utils_composite.rb +115 -0
  177. data/lib/sisu/utils_response.rb +114 -0
  178. data/lib/sisu/utils_screen_text_color.rb +472 -0
  179. data/lib/sisu/utils_spell.rb +99 -0
  180. data/lib/sisu/webrick.rb +191 -0
  181. data/lib/sisu/wikispeak.rb +375 -0
  182. data/lib/sisu/xhtml.rb +472 -0
  183. data/lib/sisu/xhtml_epub2.rb +890 -0
  184. data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
  185. data/lib/sisu/xhtml_epub2_format.rb +2272 -0
  186. data/lib/sisu/xhtml_epub2_persist.rb +278 -0
  187. data/lib/sisu/xhtml_epub2_segments.rb +599 -0
  188. data/lib/sisu/xhtml_epub2_tune.rb +330 -0
  189. data/lib/sisu/xhtml_parts.rb +183 -0
  190. data/lib/sisu/xhtml_shared.rb +62 -0
  191. data/lib/sisu/xhtml_table.rb +97 -0
  192. data/lib/sisu/xml_docbook5.rb +376 -0
  193. data/lib/sisu/xml_dom.rb +624 -0
  194. data/lib/sisu/xml_fictionbook2.rb +389 -0
  195. data/lib/sisu/xml_format.rb +865 -0
  196. data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
  197. data/lib/sisu/xml_odf_odt.rb +887 -0
  198. data/lib/sisu/xml_odf_odt_format.rb +674 -0
  199. data/lib/sisu/xml_parts.rb +191 -0
  200. data/lib/sisu/xml_persist.rb +126 -0
  201. data/lib/sisu/xml_sax.rb +521 -0
  202. data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
  203. data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
  204. data/lib/sisu/xml_shared.rb +665 -0
  205. data/lib/sisu/xml_tables.rb +261 -0
  206. data/lib/sisu/zap.rb +90 -0
  207. metadata +251 -0
@@ -0,0 +1,90 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** modules shared by the different db types, dbi, postgresql, sqlite
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/db_dbi.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_DbDBI
58
+ require_relative 'db_columns' # db_columns.rb
59
+ require_relative 'db_tests' # db_tests.rb
60
+ require_relative 'db_create' # db_create.rb
61
+ require_relative 'db_select' # db_select.rb
62
+ require_relative 'db_indexes' # db_indexes.rb
63
+ require_relative 'db_drop' # db_drop.rb
64
+ require_relative 'db_remove' # db_remove.rb
65
+ require_relative 'db_load_tuple' # db_load_tuple.rb
66
+ require_relative 'db_import' # db_import.rb
67
+ class ColumnSize < SiSU_DbColumns::ColumnSize # db_columns.rb
68
+ end
69
+ class Test < SiSU_DbTests::Test # db_tests.rb
70
+ end
71
+ class Create <SiSU_DbCreate::Create # db_create.rb
72
+ end
73
+ class Case <SiSU_DbSelect::Case # db_select.rb
74
+ end
75
+ class Index <SiSU_DbIndex::Index # db_indexes.rb
76
+ end
77
+ class Drop <SiSU_DbDrop::Drop # db_drop.rb
78
+ end
79
+ class Remove <SiSU_DbRemove::Remove # db_remove.rb
80
+ end
81
+ class LoadDocuments <SiSU_DbTuple::LoadDocuments # db_load_tuple.rb
82
+ end
83
+ class LoadMetadata <SiSU_DbTuple::LoadMetadata # db_load_tuple.rb
84
+ end
85
+ class LoadUrls <SiSU_DbTuple::LoadUrls # db_update urls
86
+ end
87
+ class Import <SiSU_DbImport::Import #<SiSU_DB::ColumnSize # db_import.rb
88
+ end
89
+ end
90
+ __END__
@@ -0,0 +1,207 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** modules shared by the different db types, dbi, postgresql, sqlite
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/db_drop.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_DbDrop
58
+ require_relative 'utils_response' # utils_response.rb
59
+ class Drop
60
+ include SiSU_Response
61
+ def initialize(opt,conn,db_info,sql_type)
62
+ @opt,@conn,@db_info,@sql_type=opt,conn,db_info,sql_type
63
+ case @sql_type
64
+ when :sqlite
65
+ cascade=''
66
+ else
67
+ cascade='CASCADE'
68
+ end
69
+ @drop_table=[
70
+ "DROP TABLE metadata_and_text #{cascade};",
71
+ "DROP TABLE doc_objects #{cascade};",
72
+ "DROP TABLE urls #{cascade};",
73
+ "DROP TABLE endnotes #{cascade};",
74
+ "DROP TABLE endnotes_asterisk #{cascade};",
75
+ "DROP TABLE endnotes_plus #{cascade};",
76
+ ]
77
+ end
78
+ def drop
79
+ def tables #% drop all tables
80
+ begin
81
+ msg_sqlite="as not all disk space is recovered after dropping the database << #{@db_info.sqlite.db} >>, you may be better off deleting the file, and recreating it as necessary"
82
+ case @sql_type
83
+ when :sqlite
84
+ puts msg_sqlite
85
+ ans=response?('remove sql database?')
86
+ if ans \
87
+ and File.exist?(@db_info.sqlite.db)
88
+ @conn.close
89
+ File.unlink(@db_info.sqlite.db)
90
+ db=SiSU_Env::InfoDb.new
91
+ conn=db.sqlite.conn_sqlite3
92
+ sdb=SiSU_DbDBI::Create.new(@opt,conn,@db_info,@sql_type)
93
+ sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@db_info,@sql_type)
94
+ sdb.output_dir?
95
+ begin
96
+ sdb.create_db
97
+ sdb.create_table.metadata_and_text
98
+ sdb.create_table.doc_objects
99
+ sdb.create_table.endnotes
100
+ sdb.create_table.endnotes_asterisk
101
+ sdb.create_table.endnotes_plus
102
+ sdb.create_table.urls
103
+ sdb_index.create_indexes
104
+ rescue
105
+ SiSU_Errors::Rescued.new($!,$@,'-D').location do
106
+ __LINE__.to_s + ':' + __FILE__
107
+ end
108
+ sdb.output_dir?
109
+ end
110
+ exit
111
+ else
112
+ @conn.transaction
113
+ @drop_table.each do |d|
114
+ begin
115
+ @conn.exec_params(d)
116
+ rescue
117
+ next
118
+ end
119
+ end
120
+ @conn.commit
121
+ end
122
+ when :pg
123
+ @conn.transaction
124
+ @drop_table.each do |d|
125
+ begin
126
+ @conn.exec_params(d)
127
+ rescue
128
+ next
129
+ end
130
+ end
131
+ @conn.commit
132
+ end
133
+ rescue
134
+ case @sql_type
135
+ when :sqlite
136
+ ans=response?('remove sql database?')
137
+ if ans and File.exist?(@db_info.sqlite.db); File.unlink(@db_info.sqlite.db)
138
+ end
139
+ else
140
+ @drop_table.each do |d|
141
+ begin
142
+ @conn.exec_params(d)
143
+ rescue
144
+ next
145
+ end
146
+ end
147
+ end
148
+ ensure
149
+ end
150
+ end
151
+ def indexes
152
+ def conn_execute_array(sql_arr)
153
+ @conn.transaction do |conn|
154
+ sql_arr.each do |sql|
155
+ begin
156
+ conn.exec_params(sql)
157
+ rescue
158
+ next
159
+ end
160
+ end
161
+ end
162
+ end
163
+ def base #% drop base indexes
164
+ print "\n drop documents common indexes\n" unless @opt.act[:quiet][:set]==:on
165
+ sql_arr=[
166
+ %{DROP INDEX idx_title;},
167
+ %{DROP INDEX idx_author;},
168
+ %{DROP INDEX idx_filename;},
169
+ %{DROP INDEX idx_topics;},
170
+ %{DROP INDEX idx_ocn;},
171
+ %{DROP INDEX idx_digest_clean;},
172
+ %{DROP INDEX idx_digest_all;},
173
+ %{DROP INDEX idx_lev0;},
174
+ %{DROP INDEX idx_lev1;},
175
+ %{DROP INDEX idx_lev2;},
176
+ %{DROP INDEX idx_lev3;},
177
+ %{DROP INDEX idx_lev4;},
178
+ %{DROP INDEX idx_lev5;},
179
+ %{DROP INDEX idx_lev6;},
180
+ %{DROP INDEX idx_endnote_nr;},
181
+ %{DROP INDEX idx_digest_en;},
182
+ %{DROP INDEX idx_endnote_nr_asterisk;},
183
+ %{DROP INDEX idx_endnote_asterisk;},
184
+ %{DROP INDEX idx_digest_en_asterisk;},
185
+ %{DROP INDEX idx_endnote_nr_plus;},
186
+ %{DROP INDEX idx_endnote_plus;},
187
+ %{DROP INDEX idx_digest_en_plus},
188
+ ]
189
+ conn_execute_array(sql_arr)
190
+ end
191
+ def text #% drop TEXT indexes, sqlite
192
+ print "\n drop documents TEXT indexes\n" unless @opt.act[:quiet][:set]==:on
193
+ sql_arr=[
194
+ %{DROP INDEX idx_clean;},
195
+ %{DROP INDEX idx_endnote},
196
+ ]
197
+ conn_execute_array(sql_arr)
198
+ end
199
+ self
200
+ end
201
+ indexes.base
202
+ @opt.act[:psql][:set]==:on ? '' : indexes.text
203
+ self
204
+ end
205
+ end
206
+ end
207
+ __END__
@@ -0,0 +1,877 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** modules shared by the different db types, dbi, postgresql, sqlite
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/db_import.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_DbImport
58
+ require_relative 'db_columns' # db_columns.rb
59
+ require_relative 'db_load_tuple' # db_load_tuple.rb
60
+ require_relative 'db_sqltxt' # db_sqltxt.rb
61
+ require_relative 'html_lite_shared' # html_lite_shared.rb
62
+ class Import < SiSU_DbText::Prepare
63
+ include SiSU_Param
64
+ include SiSU_Screen
65
+ include SiSU_DbAction
66
+ @@dl=nil
67
+ @@hname=nil
68
+ attr_accessor :tp
69
+ def initialize(opt,conn,file_maint,sql_type=:pg)
70
+ @opt,@conn,@file_maint,@sql_type=opt,conn,file_maint,sql_type
71
+ @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
72
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
73
+ @dal="#{@env.processing_path.ao}"
74
+ @fnb=if @opt.fns.empty? \
75
+ or @opt.selections.str.empty?
76
+ ''
77
+ else
78
+ @md=SiSU_Param::Parameters.new(@opt).get
79
+ @md.fnb
80
+ end
81
+ @fnc="#{@dal}/#{@opt.fns}.content.rbm"
82
+ @@seg,@@seg_full='','' #create? consider placing field just before clean text as opposed to seg which contains seg(.html) name info seg_full would contain seg info for levels 5 & 6 where available eg seg_full may be 7.3 (level 5) and 7.3.1 (level 6) where seg is 7
83
+ @col=Hash.new('')
84
+ @col[:ocn]=''
85
+ @counter={}
86
+ @db=SiSU_Env::InfoDb.new
87
+ if @sql_type==:sqlite
88
+ @driver_sqlite3=
89
+ (@conn.inspect.match(/^(.{10})/)[1] \
90
+ == @db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \
91
+ ? true
92
+ : false
93
+ end
94
+ sql='SELECT MAX(lid) FROM doc_objects'
95
+ begin
96
+ @col[:lid] ||=0
97
+ @col[:lid]=@driver_sqlite3 \
98
+ ? @conn.execute( sql ).join.to_i
99
+ : @conn.exec( sql ).getvalue(0,0).to_i
100
+ rescue
101
+ if @opt.act[:maintenance][:set]==:on
102
+ puts "#{__FILE__}:#{__LINE__}"
103
+ end
104
+ end
105
+ @col[:lid]=0 if @col[:lid].nil? or @col[:lid].to_s.empty?
106
+ sql='SELECT MAX(nid) FROM endnotes'
107
+ begin
108
+ @id_n=@driver_sqlite3 \
109
+ ? @conn.execute( sql ).join.to_i
110
+ : @conn.exec( sql ).getvalue(0,0).to_i
111
+ @id_n ||=0
112
+ rescue
113
+ if @opt.act[:maintenance][:set]==:on
114
+ puts "#{__FILE__}:#{__LINE__}"
115
+ end
116
+ end
117
+ @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty?
118
+ @col[:lv0]=@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=@col[:lv7]=0
119
+ @db=SiSU_Env::InfoDb.new
120
+ @pdf_fn=SiSU_Env::FileOp.new(@md).base_filename
121
+ @@dl ||=SiSU_Env::InfoEnv.new.digest.length
122
+ end
123
+ def marshal_load
124
+ require_relative 'ao' # ao.rb
125
+ @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here
126
+ if (@opt.act[:verbose][:set]==:on \
127
+ || @opt.act[:verbose_plus][:set]==:on \
128
+ || @opt.act[:maintenance][:set]==:on)
129
+ SiSU_Screen::Ansi.new(
130
+ @opt.act[:color_state][:set],
131
+ "#{@db.psql.db}::#{@opt.fns}"
132
+ ).puts_blue
133
+ end
134
+ SiSU_Screen::Ansi.new(
135
+ @opt.act[:color_state][:set],
136
+ 'Marshal Load',
137
+ @fnc
138
+ ).puts_grey if @opt.act[:verbose][:set]==:on
139
+ select_first_match=%{
140
+ SELECT metadata_and_text.tid
141
+ FROM metadata_and_text
142
+ WHERE metadata_and_text.src_filename = '#{@md.fns}'
143
+ AND metadata_and_text.language_document_char = '#{@opt.lng}'
144
+ ;} # note, for .ssm: @md.fns (is set during runtime & is) != @opt.fns @md.opt.fns
145
+ file_exist=if @sql_type==:sqlite
146
+ begin
147
+ @conn.get_first_value(select_first_match)
148
+ rescue SQLite3::Exception => e
149
+ # not tested
150
+ puts "Exception occurred"
151
+ puts e
152
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark(
153
+ "\n" \
154
+ + 'Attempting to initialize db' + "\n" \
155
+ + 'Creating db tables'
156
+ )
157
+ sdb={
158
+ create: SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type),
159
+ index: SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type),
160
+ }
161
+ db_action(sdb).create
162
+ end
163
+ else
164
+ begin
165
+ @conn.exec(select_first_match).field_values("tid")[0]
166
+ rescue PG::Error => e
167
+ err=[
168
+ e.result.error_field( PG::Result::PG_DIAG_SEVERITY ),
169
+ e.result.error_field( PG::Result::PG_DIAG_SQLSTATE ),
170
+ e.result.error_field( PG::Result::PG_DIAG_MESSAGE_PRIMARY ),
171
+ e.result.error_field( PG::Result::PG_DIAG_MESSAGE_DETAIL ),
172
+ e.result.error_field( PG::Result::PG_DIAG_MESSAGE_HINT ),
173
+ e.result.error_field( PG::Result::PG_DIAG_STATEMENT_POSITION ),
174
+ e.result.error_field( PG::Result::PG_DIAG_INTERNAL_POSITION ),
175
+ e.result.error_field( PG::Result::PG_DIAG_INTERNAL_QUERY ),
176
+ e.result.error_field( PG::Result::PG_DIAG_CONTEXT ),
177
+ e.result.error_field( PG::Result::PG_DIAG_SOURCE_FILE ),
178
+ e.result.error_field( PG::Result::PG_DIAG_SOURCE_LINE ),
179
+ e.result.error_field( PG::Result::PG_DIAG_SOURCE_FUNCTION ),
180
+ ]
181
+ p err
182
+ if err[2] =~/relation "\S+?" does not exist/ \
183
+ or err.inspect =~/relation "\S+?" does not exist/
184
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).mark(
185
+ "\n" \
186
+ + err[2] + "\n" \
187
+ + 'Attempting to initialize db' + "\n" \
188
+ + 'Creating db tables'
189
+ )
190
+ sdb={
191
+ create: SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type),
192
+ index: SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type),
193
+ }
194
+ db_action(sdb).create
195
+ retry
196
+ end
197
+ end
198
+ end
199
+ if not file_exist
200
+ t_d=[] # transaction_data
201
+ t_d << db_import_metadata
202
+ t_d << db_import_documents(@ao_array)
203
+ t_d << db_import_urls(@ao_array,@fnc) #import OID on/off
204
+ t_d=t_d.flatten
205
+ if (@opt.act[:verbose_plus][:set]==:on \
206
+ || @opt.act[:maintenance][:set]==:on)
207
+ puts @conn.class if defined? @conn.class
208
+ puts @conn.driver_name if defined? @conn.driver_name
209
+ puts @conn.driver if defined? @conn.driver
210
+ end
211
+ begin #% sql
212
+ if @sql_type==:sqlite
213
+ @conn.transaction do |conn|
214
+ t_d.each do |sql|
215
+ conn.execute(sql)
216
+ end
217
+ end
218
+ #also 'execute' works for sqlite
219
+ #@conn.execute("BEGIN")
220
+ # t_d.each do |sql|
221
+ # @conn.execute(sql)
222
+ # end
223
+ #@conn.execute("COMMIT")
224
+ else
225
+ #'do' works for postgresql
226
+ @conn.exec("BEGIN")
227
+ t_d.each do |sql|
228
+ @conn.exec(sql)
229
+ end
230
+ @conn.exec("COMMIT")
231
+ end
232
+ rescue
233
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
234
+ __LINE__.to_s + ':' + __FILE__
235
+ end
236
+ sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql"
237
+ sql=File.new(sqlfn,'w')
238
+ t_d.each {|i| sql.puts i}
239
+ p sqlfn
240
+ if @opt.act[:maintenance][:set]==:on
241
+ puts sql
242
+ p @conn.methods.sort
243
+ puts "#{__FILE__}:#{__LINE__}"
244
+ end
245
+ ensure
246
+ end
247
+ else
248
+ if file_exist
249
+ @db=SiSU_Env::InfoDb.new
250
+ puts "\nfile #{@opt.fns} in language code #{@opt.lng} already exists in database #{@db.psql.db}, use --update instead?"
251
+ end
252
+ end
253
+ end
254
+ def pf_db_import_transaction_open
255
+ end
256
+ def pf_db_import_transaction_close
257
+ end
258
+ def book_idx_hash_to_str(book_idx)
259
+ book_idx=book_idx ? book_idx : ''
260
+ book_idx_str,book_subidx_part='',''
261
+ if not book_idx.empty?
262
+ book_idx_str=''
263
+ book_idx.each_pair do |k0,v0|
264
+ book_idx_str << %{#{k0}+#{v0[:plus]}}
265
+ book_subidx_part=''
266
+ if v0[:sub].length > 0
267
+ v0[:sub].each do |subterms|
268
+ subterms.each_pair do |k1,v1|
269
+ book_subidx_part << %{\n #{k1}+#{v1[:plus]} | }
270
+ end
271
+ end
272
+ book_idx_str=book_idx_str + ':' + book_subidx_part
273
+ end
274
+ end
275
+ end
276
+ book_idx_str
277
+ end
278
+ def db_import_metadata #% import documents - populate database
279
+ if (@opt.act[:verbose][:set]==:on \
280
+ || @opt.act[:verbose_plus][:set]==:on \
281
+ || @opt.act[:maintenance][:set]==:on)
282
+ print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} }
283
+ end
284
+ @tp={}
285
+ @md=SiSU_Param::Parameters.new(@opt).get
286
+ #% sisutxt & fulltxt
287
+ if FileTest.exist?(@md.fns)
288
+ txt_arr=IO.readlines(@md.fns,'')
289
+ src=txt_arr.join("\n")
290
+ src=special_character_escape(src)
291
+ @tp[:sisutxt_f],@tp[:sisutxt_i]='sisutxt, ',"'#{src}', "
292
+ txt=clean_searchable_text_from_document_source(txt_arr)
293
+ #txt=special_character_escape(txt)
294
+ @tp[:fulltxt_f],@tp[:fulltxt_i]='fulltxt, ',"'#{txt}', "
295
+ end
296
+ #% title
297
+ if defined? @md.title.full \
298
+ and @md.title.full=~/\S+/ # DublinCore 1 - title
299
+ #@tp[:title]=@md.title.full
300
+ #special_character_escape(@tp[:title])
301
+ #@tp[:title_f],@tp[:title_i]='title, ',"'#{@tp[:title]}', "
302
+ sql='SELECT MAX(tid) FROM metadata_and_text;'
303
+ begin
304
+ @@id_t ||=0
305
+ id_t=@driver_sqlite3 \
306
+ ? @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i }
307
+ : @conn.exec( sql ).getvalue(0,0).to_i
308
+ @@id_t=id_t if id_t
309
+ rescue
310
+ if @opt.act[:maintenance][:set]==:on
311
+ puts "#{__FILE__} #{__LINE__}"
312
+ end
313
+ end
314
+ @@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks @title:
315
+ if (@opt.act[:verbose][:set]==:on \
316
+ || @opt.act[:verbose_plus][:set]==:on \
317
+ || @opt.act[:maintenance][:set]==:on)
318
+ puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}}
319
+ end
320
+ end
321
+ ################ CLEAR ##############
322
+ SiSU_DbDBI::Test.new(self,@opt).verify #% import title names, filenames (tuple)
323
+ t=SiSU_DbTuple::LoadMetadata.new(@conn,@@id_t,@md,@file_maint)
324
+ tuple=t.tuple
325
+ tuple
326
+ end
327
+ def db_import_documents(ao_array) #% import documents - populate main database table, import into substantive database tables (tuple)
328
+ begin
329
+ @col[:tid]=@@id_t
330
+ @en,@en_ast,@en_pls,@tuple_array=[],[],[],[]
331
+ @col[:en_a],@col[:en_z]=nil,nil
332
+ ao_array.each do |data|
333
+ data.obj=data.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1').
334
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1').
335
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1').
336
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1').
337
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1').
338
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1').
339
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1').
340
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1').
341
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1').
342
+ gsub(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ').
343
+ gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
344
+ @col[:seg]=@@seg
345
+ if data.of ==:para \
346
+ || data.of ==:heading \
347
+ || data.of ==:heading_insert \
348
+ || data.of ==:block \
349
+ || data.of ==:group # regular text what of code-blocks grouped text etc.
350
+ notedata=data.obj.dup
351
+ #% :headings
352
+ if data.is==:heading \
353
+ && (data.ln.inspect=~/[0-3]/)
354
+ (
355
+ @col[:lev],
356
+ txt,@col[:ocn],
357
+ @col[:lev_an],
358
+ @col[:ocnd],@col[:ocns],
359
+ @col[:t_of],@col[:t_is],
360
+ @col[:node],@col[:parent],
361
+ @col[:digest_clean],@col[:digest_all]=
362
+ data.ln,
363
+ data.obj,data.ocn,
364
+ data.lv,
365
+ data.odv,data.osp,
366
+ data.of,data.is,
367
+ data.node,data.parent,
368
+ '',''
369
+ )
370
+ @col[:lid]+=1
371
+ txt=endnotes(txt).extract_any
372
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus
373
+ @col[:body]=clean_document_objects_body(body)
374
+ plaintext=@col[:body].dup
375
+ plaintext=strip_markup(plaintext)
376
+ @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext)
377
+ book_idx=book_idx_hash_to_str(data.idx)
378
+ @col[:book_idx]=clean_searchable_text_from_document_objects(book_idx)
379
+ if @en[0] then @en_a,@en_z=@en[0].first,@en[0].last
380
+ end
381
+ if @en_ast[0] then @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
382
+ end
383
+ if @en_pls[0] then @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
384
+ end
385
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
386
+ @tuple_array << t.tuple
387
+ case @col[:lev]
388
+ when /0/ then @col[:lv0]+=1
389
+ when /1/ then @col[:lv1]+=1
390
+ when /2/ then @col[:lv2]+=1
391
+ when /3/ then @col[:lv3]+=1
392
+ when /4/ then @col[:lv4]+=1
393
+ end
394
+ @col[:lev]=@col[:plaintext]=@col[:body]=''
395
+ elsif data.is==:heading \
396
+ && data.ln==4
397
+ (
398
+ @@seg,txt,
399
+ @col[:ocn],@col[:lev_an],
400
+ @col[:ocnd],@col[:ocns],
401
+ @col[:t_of],@col[:t_is],
402
+ @col[:node],@col[:parent],
403
+ @col[:digest_clean],@col[:digest_all]=
404
+ data.name,data.obj,
405
+ data.ocn,data.lv,
406
+ data.odv,data.osp,
407
+ data.of,data.is,
408
+ data.node,data.parent,
409
+ '',''
410
+ )
411
+ @col[:seg]=@@seg
412
+ @col[:lv4]+=1
413
+ @col[:lid]+=1
414
+ @col[:lev]=4
415
+ @hname=if @col[:seg] \
416
+ and not @col[:seg].to_s.empty?
417
+ @@hname=@col[:seg].to_s
418
+ else @@hname
419
+ end
420
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
421
+ @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
422
+ txt=endnotes(txt).extract_any
423
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
424
+ @col[:body]=clean_document_objects_body(body)
425
+ plaintext=@col[:body].dup
426
+ plaintext=strip_markup(plaintext)
427
+ @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext)
428
+ book_idx=book_idx_hash_to_str(data.idx)
429
+ @col[:book_idx]=clean_searchable_text_from_document_objects(book_idx)
430
+ @en_a,@en_z=@en[0].first,@en[0].last if @en[0]
431
+ @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
432
+ @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
433
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
434
+ @tuple_array << t.tuple
435
+ @col[:lev]=@col[:plaintext]=@col[:body]=''
436
+ elsif data.is==:heading \
437
+ && data.ln==5
438
+ (
439
+ txt,
440
+ @col[:ocn],@col[:lev_an],
441
+ @col[:ocnd],@col[:ocns],
442
+ @col[:t_of],@col[:t_is],
443
+ @col[:node],@col[:parent],
444
+ @col[:digest_clean],@col[:digest_all]=
445
+ data.obj,
446
+ data.ocn,data.lv,
447
+ data.odv,data.osp,
448
+ data.of,data.is,
449
+ data.node,data.parent,
450
+ '',''
451
+ )
452
+ @@seg_full=data.name if data.is==:heading \
453
+ && data.ln==5 \
454
+ && data.name #check data.name
455
+ @@seg ||='' #nil # watch
456
+ @col[:seg]=@@seg
457
+ @col[:lv5]+=1
458
+ @col[:lid]+=1
459
+ @col[:lev]=5
460
+ @hname=if @col[:seg] \
461
+ and not @col[:seg].to_s.empty?
462
+ @@hname=@col[:seg].to_s
463
+ else @@hname
464
+ end
465
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
466
+ @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
467
+ txt=endnotes(txt).extract_any
468
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
469
+ @col[:body]=clean_document_objects_body(body)
470
+ plaintext=@col[:body].dup
471
+ plaintext=strip_markup(plaintext)
472
+ @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext)
473
+ book_idx=book_idx_hash_to_str(data.idx)
474
+ @col[:book_idx]=clean_searchable_text_from_document_objects(book_idx)
475
+ @en_a,@en_z=@en[0].first,@en[0].last if @en[0]
476
+ @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
477
+ @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
478
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
479
+ @tuple_array << t.tuple
480
+ @col[:lev]=@col[:plaintext]=@col[:body]=''
481
+ elsif data.is==:heading \
482
+ && data.ln==6
483
+ txt, @col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=
484
+ data.obj,data.ocn, data.lv, data.odv, data.osp, data.of, data.is, data.node, data.parent, '', ''
485
+ @@seg_full=data.name if data.is==:heading && data.ln==6 && data.name #check data.name
486
+ @@seg ||='' #nil # watch
487
+ @col[:seg]=@@seg
488
+ @col[:lv6]+=1
489
+ @col[:lid]+=1
490
+ @col[:lev]=6
491
+ @hname=if @col[:seg] \
492
+ and not @col[:seg].to_s.empty?
493
+ @@hname=@col[:seg].to_s
494
+ else @@hname
495
+ end
496
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
497
+ @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
498
+ txt=endnotes(txt).extract_any
499
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
500
+ @col[:body]=clean_document_objects_body(body)
501
+ plaintext=@col[:body].dup
502
+ plaintext=strip_markup(plaintext)
503
+ @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext)
504
+ book_idx=book_idx_hash_to_str(data.idx)
505
+ @col[:book_idx]=clean_searchable_text_from_document_objects(book_idx)
506
+ @en_a,@en_z=@en[0].first,@en[0].last if @en[0]
507
+ @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
508
+ @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
509
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
510
+ @tuple_array << t.tuple
511
+ @col[:lev]=@col[:plaintext]=@col[:body]=''
512
+ elsif data.is==:heading \
513
+ && data.ln==7
514
+ txt, @col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=
515
+ data.obj,data.ocn, data.lv, data.odv, data.osp, data.of, data.is, data.node, data.parent, '', ''
516
+ @@seg_full=data.name if data.is==:heading && data.ln==7 && data.name #check data.name
517
+ @@seg ||='' #nil # watch
518
+ @col[:seg]=@@seg
519
+ @col[:lv7]+=1
520
+ @col[:lid]+=1
521
+ @col[:lev]=7
522
+ @hname=if @col[:seg] \
523
+ and not @col[:seg].to_s.empty?
524
+ @@hname=@col[:seg].to_s
525
+ else @@hname
526
+ end
527
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
528
+ @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
529
+ txt=endnotes(txt).extract_any
530
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
531
+ @col[:body]=clean_document_objects_body(body)
532
+ plaintext=@col[:body].dup
533
+ plaintext=strip_markup(plaintext)
534
+ @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext)
535
+ book_idx=book_idx_hash_to_str(data.idx)
536
+ @col[:book_idx]=clean_searchable_text_from_document_objects(book_idx)
537
+ @en_a,@en_z=@en[0].first,@en[0].last if @en[0]
538
+ @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
539
+ @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
540
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
541
+ @tuple_array << t.tuple
542
+ @col[:lev]=@col[:plaintext]=@col[:body]=''
543
+ #% :structure :layout :comment
544
+ elsif data.of==:structure \
545
+ || data.of==:layout \
546
+ || data.of==:comment
547
+ #added watch
548
+ #% :
549
+ else #% regular text
550
+ @col[:lid]+=1
551
+ (
552
+ txt=''
553
+ txt,@col[:ocn],
554
+ @col[:ocnd],@col[:ocns],
555
+ @col[:t_of],@col[:t_is],
556
+ @col[:node],@col[:parent],
557
+ @col[:digest_clean],@col[:digest_all],
558
+ @col[:lev]=
559
+ data.obj,data.ocn,
560
+ data.odv,data.osp,
561
+ data.of,data.is,
562
+ '',data.parent,
563
+ '','',
564
+ 9
565
+ )
566
+ @hname=if @col[:seg] \
567
+ and not @col[:seg].to_s.empty?
568
+ @@hname=@col[:seg].to_s
569
+ else @@hname
570
+ end
571
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
572
+ @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
573
+ txt=endnotes(txt).extract_any
574
+ if @sql_type==:pg \
575
+ and txt.size > (SiSU_DbColumns::ColumnSize.new.document_clean - 1) # examine pg build & remove limitation
576
+ puts "\n\nTOO LARGE (TXT - see error log)\n\n"
577
+ open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
578
+ error.puts("\n#{@opt.fns}\nTEXT BODY\n#{@col[:body].size} object #{@col[:ocn]} -> #{@col[:body].slice(0..500)}")
579
+ end
580
+ txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
581
+ end
582
+ @en_a,@en_z=@en[0].first,@en[0].last if @en[0]
583
+ @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
584
+ @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
585
+ body=if data.is==:table
586
+ SiSU_FormatShared::CSS_Format.new(@md,data).html_table
587
+ elsif data.is==:code
588
+ SiSU_FormatShared::CSS_Format.new(@md,data).code
589
+ elsif defined? data.indent \
590
+ and defined? data.hang \
591
+ and data.indent =~/[1-9]/ \
592
+ and data.indent == data.hang
593
+ SiSU_FormatShared::CSS_Format.new(@md,data).indent(data.indent)
594
+ elsif defined? data.indent \
595
+ and defined? data.hang \
596
+ and data.hang =~/[0-9]/ \
597
+ and data.indent != data.hang
598
+ SiSU_FormatShared::CSS_Format.new(@md,data).hang_indent(data.hang,data.indent)
599
+ else
600
+ SiSU_FormatShared::CSS_Format.new(@md,data).norm
601
+ end
602
+ @col[:body]=clean_document_objects_body(body)
603
+ plaintext=@col[:body].dup
604
+ plaintext=strip_markup(plaintext)
605
+ @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext)
606
+ book_idx=book_idx_hash_to_str(data.idx)
607
+ @col[:book_idx]=clean_searchable_text_from_document_objects(book_idx)
608
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
609
+ @tuple_array << t.tuple
610
+ @en,@en_ast,@en_pls=[],[],[]
611
+ @col[:en_a]=@col[:en_z]=nil
612
+ @col[:lev]=@col[:plaintext]=@col[:body]=@col[:words]=''
613
+ end
614
+ if notedata =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/ #% import into database endnotes tables
615
+ endnote_array=notedata.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/)
616
+ endnote_array.each do |inf|
617
+ if inf[/#{Mx[:en_a_o]}\d+.+?#{Mx[:en_a_c]}/]
618
+ if inf[/#{Mx[:en_a_o]}(\d+)(.+?)#{Mx[:en_a_c]}/]
619
+ nr,txt,digest_clean=$1,$2.strip,0
620
+ end
621
+ @id_n ||=0
622
+ @id_n+=1
623
+ txt=special_character_escape(txt)
624
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt)
625
+ txt=strip_markup(txt)
626
+ if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)
627
+ puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
628
+ open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
629
+ error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
630
+ end
631
+ txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
632
+ end
633
+ if txt
634
+ en={
635
+ type: 'endnotes',
636
+ id: @id_n,
637
+ lid: @col[:lid],
638
+ nr: nr,
639
+ txt: txt,
640
+ body: body,
641
+ ocn: @col[:ocn],
642
+ ocnd: @col[:ocnd],
643
+ ocns: @col[:ocns],
644
+ id_t: @@id_t,
645
+ hash: digest_clean
646
+ }
647
+ t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file_maint)
648
+ @tuple_array << t.tuple
649
+ end
650
+ end
651
+ end
652
+ word_mode=notedata.scan(/\S+/)
653
+ end
654
+ if notedata =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables
655
+ endnote_array=notedata.scan(/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/)
656
+ endnote_array.each do |inf|
657
+ if inf[/#{Mx[:en_b_o]}\*\d+.+?#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
658
+ if inf[/#{Mx[:en_b_o]}[*](\d+)(.+?)#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
659
+ nr,txt,digest_clean=$1,$2.strip,0
660
+ end
661
+ @id_n+=1
662
+ txt=special_character_escape(txt)
663
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt)
664
+ txt=strip_markup(txt)
665
+ if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)
666
+ puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
667
+ open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
668
+ error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
669
+ end
670
+ txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
671
+ end
672
+ if txt
673
+ en={
674
+ type: 'endnotes_asterisk',
675
+ id: @id_n,
676
+ lid: @col[:lid],
677
+ nr: nr,
678
+ txt: txt,
679
+ body: body,
680
+ ocn: @col[:ocn],
681
+ ocnd: @col[:ocnd],
682
+ ocns: @col[:ocns],
683
+ id_t: @@id_t,
684
+ hash: digest_clean
685
+ }
686
+ t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file_maint)
687
+ @tuple_array << t.tuple
688
+ end
689
+ end
690
+ end
691
+ word_mode=notedata.scan(/\S+/)
692
+ end
693
+ if notedata =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/ #% import into database endnotes tables
694
+ endnote_array=notedata.scan(/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/)
695
+ endnote_array.each do |inf|
696
+ if inf[/#{Mx[:en_b_o]}\+\d+.+?#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
697
+ if inf[/#{Mx[:en_b_o]}[+](\d+)(.+?)#{Mx[:en_b_c]}/] # dal new endnotes 2003w31/1
698
+ nr,txt,digest_clean=$1,$2.strip,0
699
+ end
700
+ @id_n+=1
701
+ txt=special_character_escape(txt)
702
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt)
703
+ txt=strip_markup(txt)
704
+ if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)
705
+ puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"
706
+ open("#{Dir.pwd}/pg_documents_error_log",'a') do |error|
707
+ error.puts("\n#{@opt.fns}\nENDNOTE\n#{txt.size} object #{@col[:ocn]},#{@col[:ocnd]},#{@col[:ocns]} -> #{txt.slice(0..500)}")
708
+ end
709
+ txt=%{\n\nLARGE TEXT BLOCK OMITTED\n\n}
710
+ end
711
+ if txt
712
+ en={
713
+ type: 'endnotes_plus',
714
+ id: @id_n,
715
+ lid: @col[:lid],
716
+ nr: nr,
717
+ txt: txt,
718
+ body: body,
719
+ ocn: @col[:ocn],
720
+ ocnd: @col[:ocnd],
721
+ ocns: @col[:ocns],
722
+ id_t: @@id_t,
723
+ hash: digest_clean
724
+ }
725
+ t=SiSU_DbTuple::LoadEndnotes.new(@conn,en,@opt,@file_maint)
726
+ @tuple_array << t.tuple
727
+ end
728
+ end
729
+ end
730
+ word_mode=notedata.scan(/\S+/)
731
+ end
732
+ end
733
+ end
734
+ rescue
735
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
736
+ __LINE__.to_s + ':' + __FILE__
737
+ end
738
+ ensure
739
+ end
740
+ @tuple_array
741
+ end
742
+ def endnotes(txt)
743
+ @txt=txt
744
+ def extract_any
745
+ if @txt =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/
746
+ endnotes(@txt).range
747
+ @en << endnotes(@txt).standard if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/
748
+ @en_ast << endnotes(@txt).asterisk if @txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/
749
+ @en_pls << endnotes(@txt).plus if @txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/
750
+ @txt=endnotes(@txt).clean_text
751
+ end
752
+ @txt
753
+ end
754
+ def standard
755
+ (@txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/) \
756
+ ? @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/)
757
+ : nil
758
+ end
759
+ def asterisk
760
+ (@txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/) \
761
+ ? @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/)
762
+ : nil
763
+ end
764
+ def plus
765
+ (@txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/) \
766
+ ? @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/)
767
+ : nil
768
+ end
769
+ def clean_text(base_url=nil)
770
+ @txt=if base_url
771
+ @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}).
772
+ gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}).
773
+ gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})
774
+ else
775
+ @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>').
776
+ gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>').
777
+ gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')
778
+ end
779
+ @txt
780
+ end
781
+ def range
782
+ @col[:en_a]=@col[:en_z]=nil
783
+ if @txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}|#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/
784
+ word_array=@txt.scan(/\S+/)
785
+ word_array.each do |w|
786
+ if w[/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[*+]?(\d+)\s+.+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/] # not tested since change 2003w31
787
+ @col[:en_a]=$1 unless @col[:en_a]
788
+ @col[:en_z]=@col[:en_a].dup unless @col[:en_a]
789
+ @col[:en_z]=$1 if @col[:en_a]
790
+ end
791
+ end
792
+ end
793
+ @col
794
+ end
795
+ self
796
+ end
797
+ def db_import_urls(dbi_unit,content) #% import documents OID - populate database
798
+ begin
799
+ @fnc=content
800
+ @env=SiSU_Env::InfoEnv.new(@opt.fns)
801
+ f,u={},{}
802
+ if @fnb.empty? \
803
+ or @fnb.nil?
804
+ p 'file output path error' #remove
805
+ end
806
+ if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true
807
+ f[:txt],u[:txt]='plaintext,', "'#{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}',"
808
+ end
809
+ if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}")==true
810
+ f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_segtoc}',"
811
+ end
812
+ if FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true
813
+ f[:html_doc],u[:html_doc]='html_doc,', "'#{@md.file.output_path.html_scroll.url}/#{@md.file.base_filename.html_scroll}',"
814
+ end
815
+ if FileTest.file?("#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}")==true
816
+ f[:xhtml],u[:xhtml]='xhtml,', "'#{@md.file.output_path.xhtml.url}/#{@md.file.base_filename.xhtml}',"
817
+ end
818
+ if FileTest.file?("#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}")==true
819
+ f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{@md.file.output_path.xml_sax.url}/#{@md.file.base_filename.xml_sax}',"
820
+ end
821
+ if FileTest.file?("#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}")==true
822
+ f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{@md.file.output_path.xml_dom.url}/#{@md.file.base_filename.xml_dom}',"
823
+ end
824
+ if FileTest.file?("#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}")==true
825
+ f[:epub],u[:epub]='epub,', "'#{@md.file.output_path.epub.url}/#{@md.file.base_filename.epub}',"
826
+ end
827
+ if FileTest.file?("#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}")==true
828
+ f[:odf],u[:odf]='odf,', "'#{@md.file.output_path.odt.url}/#{@md.file.base_filename.odt}',"
829
+ end
830
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_a4}")==true #\
831
+ #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_letter}")==true
832
+ f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_p_a4}',"
833
+ end
834
+ if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_a4}")==true #\
835
+ #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_letter}")==true
836
+ f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_l_a4}',"
837
+ end
838
+ if FileTest.file?("#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}")==true
839
+ f[:concordance],u[:concordance]='concordance,', "'#{@md.file.output_path.html_concordance.url}/#{@md.file.base_filename.html_concordance}',"
840
+ end
841
+ #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true
842
+ # f[:latex_p],u[:latex_p]='latex_p,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}',"
843
+ #end
844
+ ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tex")==true
845
+ ## f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#{@fnb}/#{@opt.fns}.tex',"
846
+ ##end
847
+ #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true
848
+ # f[:latex_l],u[:latex_l]='latex_l,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}',"
849
+ #end
850
+ ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.landscape.tex")==true
851
+ ## f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#{@fnb}/#{@opt}.fns}.landscape.tex',"
852
+ ##end
853
+ if FileTest.file?("#{@md.file.output_path.digest.dir}/#{@md.file.base_filename.digest}")==true
854
+ f[:digest],u[:digest]='digest,', "'#{@md.file.output_path.digest.url}/#{@md.file.base_filename.digest}',"
855
+ end
856
+ if FileTest.file?("#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}")==true #revisit, was to be text, this is html
857
+ f[:manifest],u[:manifest]='manifest,', "'#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}',"
858
+ end
859
+ if FileTest.file?("#{@md.file.output_path.src.dir}/#{@md.file.base_filename.src}")==true
860
+ f[:markup],u[:markup]='markup,', "'#{@md.file.output_path.src.url}/#{@md.file.base_filename.src}',"
861
+ end
862
+ if FileTest.file?("#{@md.file.output_path.sisupod.dir}/#{@md.file.base_filename.sisupod}")==true
863
+ f[:sisupod],u[:sisupod]='sisupod,', "'#{@md.file.output_path.sisupod.url}/#{@md.file.base_filename.sisupod}',"
864
+ end
865
+ t=SiSU_DbTuple::LoadUrls.new(@conn,f,u,@@id_t,@opt,@file_maint)
866
+ tuple=t.tuple
867
+ rescue
868
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
869
+ __LINE__.to_s + ':' + __FILE__
870
+ end
871
+ ensure
872
+ end
873
+ tuple
874
+ end
875
+ end
876
+ end
877
+ __END__