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.
- checksums.yaml +7 -0
- data/bin/sisu +367 -0
- data/bin/sisugem +367 -0
- data/data/sisu/image/arrow_next_red.png +0 -0
- data/data/sisu/image/arrow_prev_red.png +0 -0
- data/data/sisu/image/arrow_up_red.png +0 -0
- data/data/sisu/image/b_bluebell.png +0 -0
- data/data/sisu/image/b_doc.png +0 -0
- data/data/sisu/image/b_epub.png +0 -0
- data/data/sisu/image/b_home.png +0 -0
- data/data/sisu/image/b_info.png +0 -0
- data/data/sisu/image/b_odf.png +0 -0
- data/data/sisu/image/b_pdf.png +0 -0
- data/data/sisu/image/b_search.png +0 -0
- data/data/sisu/image/b_toc.png +0 -0
- data/data/sisu/image/bullet_08.png +0 -0
- data/data/sisu/image/bullet_09.png +0 -0
- data/data/sisu/image/bullet_10.png +0 -0
- data/data/sisu/image/bullet_11.png +0 -0
- data/data/sisu/image/bullet_12.png +0 -0
- data/data/sisu/image/bullet_doc.png +0 -0
- data/data/sisu/image/bullet_red.png +0 -0
- data/data/sisu/image/dot_clear.png +0 -0
- data/data/sisu/image/dot_white.png +0 -0
- data/data/sisu/image/gplv3.png +0 -0
- data/data/sisu/image/gplv3_free_software.png +0 -0
- data/data/sisu/image/next.png +0 -0
- data/data/sisu/image/previous.png +0 -0
- data/data/sisu/image/rb7.ico +0 -0
- data/data/sisu/image/sisu.png +0 -0
- data/data/sisu/image/toctoc.png +0 -0
- data/data/sisu/version.yml +5 -0
- data/lib/sisu.rb +94 -0
- data/lib/sisu/air.rb +80 -0
- data/lib/sisu/ao.rb +590 -0
- data/lib/sisu/ao_character_check.rb +102 -0
- data/lib/sisu/ao_composite.rb +286 -0
- data/lib/sisu/ao_doc_objects.rb +565 -0
- data/lib/sisu/ao_doc_str.rb +2269 -0
- data/lib/sisu/ao_endnotes.rb +136 -0
- data/lib/sisu/ao_expand_insertions.rb +514 -0
- data/lib/sisu/ao_hash_digest.rb +174 -0
- data/lib/sisu/ao_idx.rb +422 -0
- data/lib/sisu/ao_images.rb +187 -0
- data/lib/sisu/ao_metadata.rb +86 -0
- data/lib/sisu/ao_misc_arrange.rb +207 -0
- data/lib/sisu/ao_numbering.rb +720 -0
- data/lib/sisu/ao_persist.rb +194 -0
- data/lib/sisu/ao_references.rb +502 -0
- data/lib/sisu/ao_syntax.rb +640 -0
- data/lib/sisu/cgi.rb +84 -0
- data/lib/sisu/cgi_pgsql.rb +270 -0
- data/lib/sisu/cgi_sql_common.rb +986 -0
- data/lib/sisu/cgi_sqlite.rb +244 -0
- data/lib/sisu/conf.rb +287 -0
- data/lib/sisu/constants.rb +388 -0
- data/lib/sisu/css.rb +3484 -0
- data/lib/sisu/db_columns.rb +1997 -0
- data/lib/sisu/db_create.rb +689 -0
- data/lib/sisu/db_dbi.rb +90 -0
- data/lib/sisu/db_drop.rb +207 -0
- data/lib/sisu/db_import.rb +877 -0
- data/lib/sisu/db_indexes.rb +146 -0
- data/lib/sisu/db_load_tuple.rb +323 -0
- data/lib/sisu/db_remove.rb +182 -0
- data/lib/sisu/db_select.rb +230 -0
- data/lib/sisu/db_sqltxt.rb +173 -0
- data/lib/sisu/db_tests.rb +114 -0
- data/lib/sisu/dbi.rb +166 -0
- data/lib/sisu/dbi_discrete.rb +206 -0
- data/lib/sisu/digests.rb +306 -0
- data/lib/sisu/dp.rb +1606 -0
- data/lib/sisu/dp_identify_markup.rb +161 -0
- data/lib/sisu/dp_make.rb +668 -0
- data/lib/sisu/embedded.rb +149 -0
- data/lib/sisu/errors.rb +84 -0
- data/lib/sisu/generic_parts.rb +131 -0
- data/lib/sisu/git.rb +277 -0
- data/lib/sisu/html.rb +775 -0
- data/lib/sisu/html_concordance.rb +391 -0
- data/lib/sisu/html_format.rb +1348 -0
- data/lib/sisu/html_harvest.rb +109 -0
- data/lib/sisu/html_harvest_author_format.rb +111 -0
- data/lib/sisu/html_harvest_authors.rb +466 -0
- data/lib/sisu/html_harvest_topics.rb +893 -0
- data/lib/sisu/html_lite_shared.rb +324 -0
- data/lib/sisu/html_manifest.rb +1032 -0
- data/lib/sisu/html_minitoc.rb +230 -0
- data/lib/sisu/html_parts.rb +437 -0
- data/lib/sisu/html_persist.rb +237 -0
- data/lib/sisu/html_promo.rb +440 -0
- data/lib/sisu/html_scroll.rb +235 -0
- data/lib/sisu/html_segments.rb +716 -0
- data/lib/sisu/html_shared.rb +62 -0
- data/lib/sisu/html_table.rb +64 -0
- data/lib/sisu/html_tune.rb +301 -0
- data/lib/sisu/hub.rb +277 -0
- data/lib/sisu/hub_actions.rb +1122 -0
- data/lib/sisu/hub_loop_markup_files.rb +170 -0
- data/lib/sisu/hub_options.rb +1695 -0
- data/lib/sisu/i18n.rb +702 -0
- data/lib/sisu/manpage.rb +377 -0
- data/lib/sisu/manpage_format.rb +85 -0
- data/lib/sisu/object_munge.rb +307 -0
- data/lib/sisu/prog_text_translation.rb +1702 -0
- data/lib/sisu/qrcode.rb +754 -0
- data/lib/sisu/relaxng.rb +1153 -0
- data/lib/sisu/remote.rb +246 -0
- data/lib/sisu/rexml.rb +148 -0
- data/lib/sisu/se.rb +158 -0
- data/lib/sisu/se_cleanoutput.rb +145 -0
- data/lib/sisu/se_clear.rb +105 -0
- data/lib/sisu/se_createsite.rb +273 -0
- data/lib/sisu/se_css.rb +221 -0
- data/lib/sisu/se_date.rb +92 -0
- data/lib/sisu/se_db.rb +214 -0
- data/lib/sisu/se_envcall.rb +326 -0
- data/lib/sisu/se_file_op.rb +2758 -0
- data/lib/sisu/se_filemap.rb +247 -0
- data/lib/sisu/se_get_init.rb +238 -0
- data/lib/sisu/se_hub_particulars.rb +234 -0
- data/lib/sisu/se_info_env.rb +2179 -0
- data/lib/sisu/se_info_port.rb +70 -0
- data/lib/sisu/se_info_system.rb +202 -0
- data/lib/sisu/se_load.rb +108 -0
- data/lib/sisu/se_processing.rb +659 -0
- data/lib/sisu/se_programs.rb +394 -0
- data/lib/sisu/se_remotes.rb +553 -0
- data/lib/sisu/se_standardise_lang.rb +176 -0
- data/lib/sisu/se_version.rb +174 -0
- data/lib/sisu/shared_images.rb +137 -0
- data/lib/sisu/shared_markup_alt.rb +336 -0
- data/lib/sisu/shared_metadata.rb +1361 -0
- data/lib/sisu/shared_sem.rb +156 -0
- data/lib/sisu/sisu_thor_lib.rb +407 -0
- data/lib/sisu/sitemaps.rb +224 -0
- data/lib/sisu/src_kdissert_share.rb +102 -0
- data/lib/sisu/src_po4a_share.rb +309 -0
- data/lib/sisu/src_po4a_shelf.rb +1217 -0
- data/lib/sisu/src_po4a_shelf_set.rb +297 -0
- data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
- data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
- data/lib/sisu/src_po4a_sstm.rb +135 -0
- data/lib/sisu/src_shared.rb +347 -0
- data/lib/sisu/src_sisupod_make.rb +171 -0
- data/lib/sisu/src_sisupod_sstm.rb +109 -0
- data/lib/sisu/sst_convert_markup.rb +323 -0
- data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
- data/lib/sisu/sst_from_xml.rb +178 -0
- data/lib/sisu/sst_identify_markup.rb +482 -0
- data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
- data/lib/sisu/termsheet.rb +163 -0
- data/lib/sisu/texinfo.rb +430 -0
- data/lib/sisu/texinfo_format.rb +541 -0
- data/lib/sisu/texpdf.rb +1162 -0
- data/lib/sisu/texpdf_format.rb +1689 -0
- data/lib/sisu/texpdf_parts.rb +235 -0
- data/lib/sisu/txt_asciidoc.rb +354 -0
- data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
- data/lib/sisu/txt_markdown.rb +389 -0
- data/lib/sisu/txt_markdown_decorate.rb +207 -0
- data/lib/sisu/txt_orgmode.rb +376 -0
- data/lib/sisu/txt_orgmode_decorate.rb +186 -0
- data/lib/sisu/txt_output.rb +86 -0
- data/lib/sisu/txt_plain.rb +410 -0
- data/lib/sisu/txt_plain_decorate.rb +189 -0
- data/lib/sisu/txt_read.rb +109 -0
- data/lib/sisu/txt_rst.rb +371 -0
- data/lib/sisu/txt_rst_decorate.rb +186 -0
- data/lib/sisu/txt_shared.rb +241 -0
- data/lib/sisu/txt_textile.rb +367 -0
- data/lib/sisu/txt_textile_decorate.rb +186 -0
- data/lib/sisu/update.rb +141 -0
- data/lib/sisu/urls.rb +696 -0
- data/lib/sisu/utils.rb +232 -0
- data/lib/sisu/utils_composite.rb +115 -0
- data/lib/sisu/utils_response.rb +114 -0
- data/lib/sisu/utils_screen_text_color.rb +472 -0
- data/lib/sisu/utils_spell.rb +99 -0
- data/lib/sisu/webrick.rb +191 -0
- data/lib/sisu/wikispeak.rb +375 -0
- data/lib/sisu/xhtml.rb +472 -0
- data/lib/sisu/xhtml_epub2.rb +890 -0
- data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
- data/lib/sisu/xhtml_epub2_format.rb +2272 -0
- data/lib/sisu/xhtml_epub2_persist.rb +278 -0
- data/lib/sisu/xhtml_epub2_segments.rb +599 -0
- data/lib/sisu/xhtml_epub2_tune.rb +330 -0
- data/lib/sisu/xhtml_parts.rb +183 -0
- data/lib/sisu/xhtml_shared.rb +62 -0
- data/lib/sisu/xhtml_table.rb +97 -0
- data/lib/sisu/xml_docbook5.rb +376 -0
- data/lib/sisu/xml_dom.rb +624 -0
- data/lib/sisu/xml_fictionbook2.rb +389 -0
- data/lib/sisu/xml_format.rb +865 -0
- data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
- data/lib/sisu/xml_odf_odt.rb +887 -0
- data/lib/sisu/xml_odf_odt_format.rb +674 -0
- data/lib/sisu/xml_parts.rb +191 -0
- data/lib/sisu/xml_persist.rb +126 -0
- data/lib/sisu/xml_sax.rb +521 -0
- data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
- data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
- data/lib/sisu/xml_shared.rb +665 -0
- data/lib/sisu/xml_tables.rb +261 -0
- data/lib/sisu/zap.rb +90 -0
- metadata +251 -0
|
@@ -0,0 +1,146 @@
|
|
|
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_indexes.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_DbIndex
|
|
58
|
+
class Index # create documents Indexes def initialize(opt,conn='',sql_type)
|
|
59
|
+
def initialize(opt,conn,file,sql_type)
|
|
60
|
+
@opt,@conn,@file,@sql_type=opt,conn,file,sql_type
|
|
61
|
+
end
|
|
62
|
+
def create_indexes # check added from pg not tested
|
|
63
|
+
def conn_execute_sql_pg(conn,sql)
|
|
64
|
+
conn.exec_params(sql)
|
|
65
|
+
end
|
|
66
|
+
def conn_execute_sql_sqlite(conn,sql)
|
|
67
|
+
conn.execute(sql)
|
|
68
|
+
end
|
|
69
|
+
def conn_execute_sql(conn,sql)
|
|
70
|
+
if @sql_type==:pg
|
|
71
|
+
conn_execute_sql_pg(conn,sql)
|
|
72
|
+
elsif @sql_type==:sqlite
|
|
73
|
+
conn_execute_sql_sqlite(conn,sql)
|
|
74
|
+
else
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
def conn_execute_array(sql_arr)
|
|
78
|
+
begin
|
|
79
|
+
@conn.transaction do |conn|
|
|
80
|
+
sql_arr.each do |sql|
|
|
81
|
+
conn_execute_sql(conn,sql)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
rescue
|
|
85
|
+
if @conn.is_a?(NilClass)
|
|
86
|
+
errmsg="No sqlite3 connection (check sqlite3 dependencies)"
|
|
87
|
+
if @opt.act[:no_stop][:set]==:on
|
|
88
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
89
|
+
error("#{errmsg}, proceeding without sqlite output (as requested)")
|
|
90
|
+
else
|
|
91
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
92
|
+
error("#{errmsg}, STOPPING")
|
|
93
|
+
exit
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
def base
|
|
99
|
+
if (@opt.act[:verbose_plus][:set]==:on \
|
|
100
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
101
|
+
print "\n create documents common indexes\n"
|
|
102
|
+
end
|
|
103
|
+
sql_arr=[
|
|
104
|
+
%{CREATE INDEX idx_ocn ON doc_objects(ocn);},
|
|
105
|
+
%{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);},
|
|
106
|
+
%{CREATE INDEX idx_digest_all ON doc_objects(digest_all);},
|
|
107
|
+
%{CREATE INDEX idx_lev0 ON doc_objects(lev0);},
|
|
108
|
+
%{CREATE INDEX idx_lev1 ON doc_objects(lev1);},
|
|
109
|
+
%{CREATE INDEX idx_lev2 ON doc_objects(lev2);},
|
|
110
|
+
%{CREATE INDEX idx_lev3 ON doc_objects(lev3);},
|
|
111
|
+
%{CREATE INDEX idx_lev4 ON doc_objects(lev4);},
|
|
112
|
+
%{CREATE INDEX idx_lev5 ON doc_objects(lev5);},
|
|
113
|
+
%{CREATE INDEX idx_lev6 ON doc_objects(lev6);},
|
|
114
|
+
%{CREATE INDEX idx_endnote_nr ON endnotes(nr);},
|
|
115
|
+
%{CREATE INDEX idx_digest_en ON endnotes(digest_clean);},
|
|
116
|
+
%{CREATE INDEX idx_endnote_nr_asterisk ON endnotes_asterisk(nr);},
|
|
117
|
+
%{CREATE INDEX idx_endnote_asterisk ON endnotes_asterisk(clean);},
|
|
118
|
+
%{CREATE INDEX idx_digest_en_asterisk ON endnotes_asterisk(digest_clean);},
|
|
119
|
+
%{CREATE INDEX idx_endnote_nr_plus ON endnotes_plus(nr);},
|
|
120
|
+
%{CREATE INDEX idx_endnote_plus ON endnotes_plus(clean);},
|
|
121
|
+
%{CREATE INDEX idx_digest_en_plus ON endnotes_plus(digest_clean);},
|
|
122
|
+
%{CREATE INDEX idx_title ON metadata_and_text(title);},
|
|
123
|
+
%{CREATE INDEX idx_author ON metadata_and_text(creator_author);},
|
|
124
|
+
%{CREATE INDEX idx_filename ON metadata_and_text(src_filename);},
|
|
125
|
+
%{CREATE INDEX idx_language ON metadata_and_text(language_document_char);},
|
|
126
|
+
%{CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register)},
|
|
127
|
+
]
|
|
128
|
+
conn_execute_array(sql_arr)
|
|
129
|
+
end
|
|
130
|
+
def text
|
|
131
|
+
if (@opt.act[:verbose_plus][:set]==:on \
|
|
132
|
+
|| @opt.act[:maintenance][:set]==:on)
|
|
133
|
+
print "\n create documents TEXT indexes\n"
|
|
134
|
+
end
|
|
135
|
+
sql_arr=[
|
|
136
|
+
%{CREATE INDEX idx_clean ON doc_objects(clean);},
|
|
137
|
+
%{CREATE INDEX idx_endnote ON endnotes(clean);}
|
|
138
|
+
]
|
|
139
|
+
conn_execute_array(sql_arr)
|
|
140
|
+
end
|
|
141
|
+
base
|
|
142
|
+
@opt.act[:psql][:set]==:on ? '' : text
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
__END__
|
|
@@ -0,0 +1,323 @@
|
|
|
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_load_tuple.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_DbTuple
|
|
58
|
+
require_relative 'db_columns' # db_columns.rb
|
|
59
|
+
class LoadDocuments
|
|
60
|
+
require_relative 'dp' # dp.rb
|
|
61
|
+
include SiSU_Param
|
|
62
|
+
def initialize(conn,col,opt,file_maint)
|
|
63
|
+
@conn,@col,@opt,@file_maint=conn,col,opt,file_maint
|
|
64
|
+
@col[:lev]=@col[:lev].to_i
|
|
65
|
+
unless @col[:lev].inspect=~/^[0-7]/ \
|
|
66
|
+
or @col[:lev]==0..7
|
|
67
|
+
@col[:lev]=9
|
|
68
|
+
end
|
|
69
|
+
@col[:ocn]=0 unless @col[:ocn].inspect=~/\d+/
|
|
70
|
+
@cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
|
|
71
|
+
end
|
|
72
|
+
def tuple #% import line
|
|
73
|
+
sql_entry=if @col[:en_a]
|
|
74
|
+
"INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, lev7, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " +
|
|
75
|
+
"VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:lv7]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
|
|
76
|
+
else
|
|
77
|
+
"INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, lev7, t_of, t_is, node, parent, digest_clean, digest_all) " +
|
|
78
|
+
"VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:lv7]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
|
|
79
|
+
end
|
|
80
|
+
if @opt.act[:verbose_plus][:set]==:on
|
|
81
|
+
if @opt.act[:maintenance][:set]==:on
|
|
82
|
+
puts @file_maint.inspect
|
|
83
|
+
puts sql_entry
|
|
84
|
+
end
|
|
85
|
+
@file_maint.puts sql_entry
|
|
86
|
+
else
|
|
87
|
+
if @opt.act[:verbose_plus][:set]==:on
|
|
88
|
+
puts sql_entry
|
|
89
|
+
@file_maint.puts sql_entry
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
if @opt.act[:verbose][:set]==:on
|
|
93
|
+
if @col[:lev].inspect =~/[0-35-7]/
|
|
94
|
+
lev=case @col[:lev].inspect
|
|
95
|
+
when /0/ then ':A'
|
|
96
|
+
when /1/ then ':B'
|
|
97
|
+
when /2/ then ':C'
|
|
98
|
+
when /3/ then ':D'
|
|
99
|
+
when /5/ then ' 2'
|
|
100
|
+
when /6/ then ' 3'
|
|
101
|
+
when /7/ then ' 4'
|
|
102
|
+
end
|
|
103
|
+
puts %{#{lev}>\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:lv7]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}}
|
|
104
|
+
elsif @col[:lev].inspect =~/[4]/
|
|
105
|
+
puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:lv7]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}\t#{@col[:seg]}}
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
sql_entry
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
class LoadMetadata #< SiSU_DbColumns::Columns
|
|
112
|
+
def initialize(conn,id,md,file_maint)
|
|
113
|
+
@conn,@id,@md,@file_maint=conn,id,md,file_maint
|
|
114
|
+
@tp=SiSU_DbColumns::Columns.new(md)
|
|
115
|
+
end
|
|
116
|
+
def tuple
|
|
117
|
+
sql_entry="INSERT INTO metadata_and_text (
|
|
118
|
+
#{@tp.column.title.tuple[0]}
|
|
119
|
+
#{@tp.column.title_main.tuple[0]}
|
|
120
|
+
#{@tp.column.title_sub.tuple[0]}
|
|
121
|
+
#{@tp.column.title_short.tuple[0]}
|
|
122
|
+
#{@tp.column.title_edition.tuple[0]}
|
|
123
|
+
#{@tp.column.title_note.tuple[0]}
|
|
124
|
+
#{@tp.column.title_language.tuple[0]}
|
|
125
|
+
#{@tp.column.title_language_char.tuple[0]}
|
|
126
|
+
#{@tp.column.creator_author.tuple[0]}
|
|
127
|
+
#{@tp.column.creator_author_honorific.tuple[0]}
|
|
128
|
+
#{@tp.column.creator_author_nationality.tuple[0]}
|
|
129
|
+
#{@tp.column.creator_editor.tuple[0]}
|
|
130
|
+
#{@tp.column.creator_contributor.tuple[0]}
|
|
131
|
+
#{@tp.column.creator_illustrator.tuple[0]}
|
|
132
|
+
#{@tp.column.creator_photographer.tuple[0]}
|
|
133
|
+
#{@tp.column.creator_translator.tuple[0]}
|
|
134
|
+
#{@tp.column.creator_prepared_by.tuple[0]}
|
|
135
|
+
#{@tp.column.creator_digitized_by.tuple[0]}
|
|
136
|
+
#{@tp.column.creator_audio.tuple[0]}
|
|
137
|
+
#{@tp.column.creator_video.tuple[0]}
|
|
138
|
+
#{@tp.column.language_document.tuple[0]}
|
|
139
|
+
#{@tp.column.language_document_char.tuple[0]}
|
|
140
|
+
#{@tp.column.language_original.tuple[0]}
|
|
141
|
+
#{@tp.column.language_original_char.tuple[0]}
|
|
142
|
+
#{@tp.column.date_added_to_site.tuple[0]}
|
|
143
|
+
#{@tp.column.date_available.tuple[0]}
|
|
144
|
+
#{@tp.column.date_created.tuple[0]}
|
|
145
|
+
#{@tp.column.date_issued.tuple[0]}
|
|
146
|
+
#{@tp.column.date_modified.tuple[0]}
|
|
147
|
+
#{@tp.column.date_published.tuple[0]}
|
|
148
|
+
#{@tp.column.date_valid.tuple[0]}
|
|
149
|
+
#{@tp.column.date_translated.tuple[0]}
|
|
150
|
+
#{@tp.column.date_original_publication.tuple[0]}
|
|
151
|
+
#{@tp.column.date_generated.tuple[0]}
|
|
152
|
+
#{@tp.column.publisher.tuple[0]}
|
|
153
|
+
#{@tp.column.original_publisher.tuple[0]}
|
|
154
|
+
#{@tp.column.original_language.tuple[0]}
|
|
155
|
+
#{@tp.column.original_language_char.tuple[0]}
|
|
156
|
+
#{@tp.column.original_source.tuple[0]}
|
|
157
|
+
#{@tp.column.original_institution.tuple[0]}
|
|
158
|
+
#{@tp.column.original_nationality.tuple[0]}
|
|
159
|
+
#{@tp.column.rights_all.tuple[0]}
|
|
160
|
+
#{@tp.column.rights_copyright_text.tuple[0]}
|
|
161
|
+
#{@tp.column.rights_copyright_translation.tuple[0]}
|
|
162
|
+
#{@tp.column.rights_copyright_illustrations.tuple[0]}
|
|
163
|
+
#{@tp.column.rights_copyright_photographs.tuple[0]}
|
|
164
|
+
#{@tp.column.rights_copyright_preparation.tuple[0]}
|
|
165
|
+
#{@tp.column.rights_copyright_digitization.tuple[0]}
|
|
166
|
+
#{@tp.column.rights_copyright_audio.tuple[0]}
|
|
167
|
+
#{@tp.column.rights_copyright_video.tuple[0]}
|
|
168
|
+
#{@tp.column.rights_license.tuple[0]}
|
|
169
|
+
#{@tp.column.classify_topic_register.tuple[0]}
|
|
170
|
+
#{@tp.column.classify_subject.tuple[0]}
|
|
171
|
+
#{@tp.column.classify_loc.tuple[0]}
|
|
172
|
+
#{@tp.column.classify_dewey.tuple[0]}
|
|
173
|
+
#{@tp.column.classify_keywords.tuple[0]}
|
|
174
|
+
#{@tp.column.identifier_oclc.tuple[0]}
|
|
175
|
+
#{@tp.column.identifier_isbn.tuple[0]}
|
|
176
|
+
#{@tp.column.notes_abstract.tuple[0]}
|
|
177
|
+
#{@tp.column.notes_description.tuple[0]}
|
|
178
|
+
#{@tp.column.notes_comment.tuple[0]}
|
|
179
|
+
#{@tp.column.notes_history.tuple[0]}
|
|
180
|
+
#{@tp.column.notes_format.tuple[0]}
|
|
181
|
+
#{@tp.column.notes_relation.tuple[0]}
|
|
182
|
+
#{@tp.column.notes_coverage.tuple[0]}
|
|
183
|
+
#{@tp.column.notes_type.tuple[0]}
|
|
184
|
+
#{@tp.column.notes_prefix.tuple[0]}
|
|
185
|
+
#{@tp.column.notes_prefix_a.tuple[0]}
|
|
186
|
+
#{@tp.column.notes_prefix_b.tuple[0]}
|
|
187
|
+
#{@tp.column.notes_suffix.tuple[0]}
|
|
188
|
+
#{@tp.column.src_filename.tuple[0]}
|
|
189
|
+
#{@tp.column.src_fingerprint.tuple[0]}
|
|
190
|
+
#{@tp.column.src_filesize.tuple[0]}
|
|
191
|
+
#{@tp.column.src_word_count.tuple[0]}
|
|
192
|
+
#{@tp.column.src_txt.tuple[0]}
|
|
193
|
+
#{@tp.column.fulltext.tuple[0]}
|
|
194
|
+
#{@tp.column.links.tuple[0]}
|
|
195
|
+
tid)
|
|
196
|
+
" +
|
|
197
|
+
"VALUES (
|
|
198
|
+
#{@tp.column.title.tuple[1]}
|
|
199
|
+
#{@tp.column.title_main.tuple[1]}
|
|
200
|
+
#{@tp.column.title_sub.tuple[1]}
|
|
201
|
+
#{@tp.column.title_short.tuple[1]}
|
|
202
|
+
#{@tp.column.title_edition.tuple[1]}
|
|
203
|
+
#{@tp.column.title_note.tuple[1]}
|
|
204
|
+
#{@tp.column.title_language.tuple[1]}
|
|
205
|
+
#{@tp.column.title_language_char.tuple[1]}
|
|
206
|
+
#{@tp.column.creator_author.tuple[1]}
|
|
207
|
+
#{@tp.column.creator_author_honorific.tuple[1]}
|
|
208
|
+
#{@tp.column.creator_author_nationality.tuple[1]}
|
|
209
|
+
#{@tp.column.creator_editor.tuple[1]}
|
|
210
|
+
#{@tp.column.creator_contributor.tuple[1]}
|
|
211
|
+
#{@tp.column.creator_illustrator.tuple[1]}
|
|
212
|
+
#{@tp.column.creator_photographer.tuple[1]}
|
|
213
|
+
#{@tp.column.creator_translator.tuple[1]}
|
|
214
|
+
#{@tp.column.creator_prepared_by.tuple[1]}
|
|
215
|
+
#{@tp.column.creator_digitized_by.tuple[1]}
|
|
216
|
+
#{@tp.column.creator_audio.tuple[1]}
|
|
217
|
+
#{@tp.column.creator_video.tuple[1]}
|
|
218
|
+
#{@tp.column.language_document.tuple[1]}
|
|
219
|
+
#{@tp.column.language_document_char.tuple[1]}
|
|
220
|
+
#{@tp.column.language_original.tuple[1]}
|
|
221
|
+
#{@tp.column.language_original_char.tuple[1]}
|
|
222
|
+
#{@tp.column.date_added_to_site.tuple[1]}
|
|
223
|
+
#{@tp.column.date_available.tuple[1]}
|
|
224
|
+
#{@tp.column.date_created.tuple[1]}
|
|
225
|
+
#{@tp.column.date_issued.tuple[1]}
|
|
226
|
+
#{@tp.column.date_modified.tuple[1]}
|
|
227
|
+
#{@tp.column.date_published.tuple[1]}
|
|
228
|
+
#{@tp.column.date_valid.tuple[1]}
|
|
229
|
+
#{@tp.column.date_translated.tuple[1]}
|
|
230
|
+
#{@tp.column.date_original_publication.tuple[1]}
|
|
231
|
+
#{@tp.column.date_generated.tuple[1]}
|
|
232
|
+
#{@tp.column.publisher.tuple[1]}
|
|
233
|
+
#{@tp.column.original_publisher.tuple[1]}
|
|
234
|
+
#{@tp.column.original_language.tuple[1]}
|
|
235
|
+
#{@tp.column.original_language_char.tuple[1]}
|
|
236
|
+
#{@tp.column.original_source.tuple[1]}
|
|
237
|
+
#{@tp.column.original_institution.tuple[1]}
|
|
238
|
+
#{@tp.column.original_nationality.tuple[1]}
|
|
239
|
+
#{@tp.column.rights_all.tuple[1]}
|
|
240
|
+
#{@tp.column.rights_copyright_text.tuple[1]}
|
|
241
|
+
#{@tp.column.rights_copyright_translation.tuple[1]}
|
|
242
|
+
#{@tp.column.rights_copyright_illustrations.tuple[1]}
|
|
243
|
+
#{@tp.column.rights_copyright_photographs.tuple[1]}
|
|
244
|
+
#{@tp.column.rights_copyright_preparation.tuple[1]}
|
|
245
|
+
#{@tp.column.rights_copyright_digitization.tuple[1]}
|
|
246
|
+
#{@tp.column.rights_copyright_audio.tuple[1]}
|
|
247
|
+
#{@tp.column.rights_copyright_video.tuple[1]}
|
|
248
|
+
#{@tp.column.rights_license.tuple[1]}
|
|
249
|
+
#{@tp.column.classify_topic_register.tuple[1]}
|
|
250
|
+
#{@tp.column.classify_subject.tuple[1]}
|
|
251
|
+
#{@tp.column.classify_loc.tuple[1]}
|
|
252
|
+
#{@tp.column.classify_dewey.tuple[1]}
|
|
253
|
+
#{@tp.column.classify_keywords.tuple[1]}
|
|
254
|
+
#{@tp.column.identifier_oclc.tuple[1]}
|
|
255
|
+
#{@tp.column.identifier_isbn.tuple[1]}
|
|
256
|
+
#{@tp.column.notes_abstract.tuple[1]}
|
|
257
|
+
#{@tp.column.notes_comment.tuple[1]}
|
|
258
|
+
#{@tp.column.notes_description.tuple[1]}
|
|
259
|
+
#{@tp.column.notes_history.tuple[1]}
|
|
260
|
+
#{@tp.column.notes_format.tuple[1]}
|
|
261
|
+
#{@tp.column.notes_relation.tuple[1]}
|
|
262
|
+
#{@tp.column.notes_coverage.tuple[1]}
|
|
263
|
+
#{@tp.column.notes_type.tuple[1]}
|
|
264
|
+
#{@tp.column.notes_prefix.tuple[1]}
|
|
265
|
+
#{@tp.column.notes_prefix_a.tuple[1]}
|
|
266
|
+
#{@tp.column.notes_prefix_b.tuple[1]}
|
|
267
|
+
#{@tp.column.notes_suffix.tuple[1]}
|
|
268
|
+
#{@tp.column.src_filename.tuple[1]}
|
|
269
|
+
#{@tp.column.src_fingerprint.tuple[1]}
|
|
270
|
+
#{@tp.column.src_filesize.tuple[1]}
|
|
271
|
+
#{@tp.column.src_word_count.tuple[1]}
|
|
272
|
+
#{@tp.column.src_txt.tuple[1]}
|
|
273
|
+
#{@tp.column.fulltext.tuple[1]}
|
|
274
|
+
#{@tp.column.links.tuple[1]}
|
|
275
|
+
#{@id}
|
|
276
|
+
);"
|
|
277
|
+
if @md.opt.act[:maintenance][:set]==:on
|
|
278
|
+
puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file_maint.inspect}"
|
|
279
|
+
@file_maint.puts sql_entry
|
|
280
|
+
else
|
|
281
|
+
if @md.opt.act[:verbose_plus][:set]==:on
|
|
282
|
+
@file_maint.puts sql_entry
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
sql_entry
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
class LoadUrls
|
|
289
|
+
def initialize(conn,f,u,id,opt,file_maint)
|
|
290
|
+
@conn,@f,@u,@id,@opt,@file_maint=conn,f,u,id,opt,file_maint
|
|
291
|
+
end
|
|
292
|
+
def tuple
|
|
293
|
+
sql_entry="INSERT INTO urls (#{@f[:txt]} #{@f[:html_toc]} #{@f[:html_doc]} #{@f[:xhtml]} #{@f[:xml_sax]} #{@f[:xml_dom]} #{@f[:odf]} #{@f[:pdf_p]} #{@f[:pdf_l]} #{@f[:concordance]} #{@f[:latex_p]} #{@f[:latex_l]} #{@f[:manifest]} #{@f[:digest]} #{@f[:markup]} #{@f[:sisupod]} metadata_tid) " +
|
|
294
|
+
"VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id});"
|
|
295
|
+
if @opt.act[:maintenance][:set]==:on
|
|
296
|
+
@file_maint.puts sql_entry
|
|
297
|
+
else
|
|
298
|
+
if @opt.act[:verbose_plus][:set]==:on
|
|
299
|
+
@file_maint.puts sql_entry
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
sql_entry
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
class LoadEndnotes
|
|
306
|
+
def initialize(conn,en,opt,file_maint)
|
|
307
|
+
@conn,@en,@opt,@file_maint=conn,en,opt,file_maint
|
|
308
|
+
end
|
|
309
|
+
def tuple
|
|
310
|
+
sql_entry="INSERT INTO #{@en[:type]} (nid, document_lid, nr, clean, body, ocn, ocnd, ocns, metadata_tid, digest_clean) " +
|
|
311
|
+
"VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}');"
|
|
312
|
+
if @opt.act[:maintenance][:set]==:on
|
|
313
|
+
@file_maint.puts sql_entry
|
|
314
|
+
else
|
|
315
|
+
if @opt.act[:verbose_plus][:set]==:on
|
|
316
|
+
@file_maint.puts sql_entry
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
sql_entry
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
__END__
|