sisu 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/sisu/se_css.rb
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** system environment, resource control and configuration details
|
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/se_css.rb;hb=HEAD>
|
55
|
+
|
56
|
+
=end
|
57
|
+
module SiSU_CSS
|
58
|
+
require_relative 'constants' # constants.rb
|
59
|
+
require_relative 'utils' # utils.rb
|
60
|
+
require_relative 'se_info_env' # se_info_env.rb
|
61
|
+
class CSS_Default
|
62
|
+
def html
|
63
|
+
'html.css'
|
64
|
+
end
|
65
|
+
def html_tables
|
66
|
+
'html_tables.css'
|
67
|
+
end
|
68
|
+
def xhtml
|
69
|
+
'xhtml.css'
|
70
|
+
end
|
71
|
+
def xml_sax
|
72
|
+
'sax.css'
|
73
|
+
end
|
74
|
+
def xml_dom
|
75
|
+
'dom.css'
|
76
|
+
end
|
77
|
+
def xml_docbook
|
78
|
+
'docbook.css'
|
79
|
+
end
|
80
|
+
def homepage
|
81
|
+
'homepage.css'
|
82
|
+
end
|
83
|
+
def harvest
|
84
|
+
'harvest.css'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
class CSS_Select < SiSU_Info_Env::InfoEnv # se_info_env.rb
|
88
|
+
def initialize(md)
|
89
|
+
@md=md
|
90
|
+
@env=SiSU_Env::InfoEnv.new('',@md)
|
91
|
+
end
|
92
|
+
def html
|
93
|
+
if @md.doc_css \
|
94
|
+
and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css")
|
95
|
+
@md.doc_css + '_html.css'
|
96
|
+
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html.css")
|
97
|
+
@env.path.base_markup_dir_stub + '_html.css'
|
98
|
+
else
|
99
|
+
SiSU_Env::CSS_Default.new.html
|
100
|
+
end
|
101
|
+
end
|
102
|
+
def html_tables
|
103
|
+
if @md.doc_css \
|
104
|
+
and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css")
|
105
|
+
@md.doc_css + '_html_tables.css'
|
106
|
+
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html_tables.css")
|
107
|
+
@env.path.base_markup_dir_stub + '_html_tables.css'
|
108
|
+
else SiSU_Env::CSS_Default.new.html_tables
|
109
|
+
end
|
110
|
+
end
|
111
|
+
def xhtml
|
112
|
+
if @md.doc_css \
|
113
|
+
and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css")
|
114
|
+
@md.doc_css + '_xhtml.css'
|
115
|
+
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xhtml.css")
|
116
|
+
@env.path.base_markup_dir_stub + '_xhtml.css'
|
117
|
+
else SiSU_Env::CSS_Default.new.xhtml
|
118
|
+
end
|
119
|
+
end
|
120
|
+
def xml_sax
|
121
|
+
if @md.doc_css \
|
122
|
+
and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css")
|
123
|
+
@md.doc_css + '_xml_sax.css'
|
124
|
+
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_sax.css")
|
125
|
+
@env.path.base_markup_dir_stub + '_xml_sax.css'
|
126
|
+
else SiSU_Env::CSS_Default.new.xml_sax
|
127
|
+
end
|
128
|
+
end
|
129
|
+
def xml_dom
|
130
|
+
if @md.doc_css \
|
131
|
+
and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css")
|
132
|
+
@md.doc_css + '_xml_dom.css'
|
133
|
+
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_dom.css")
|
134
|
+
@env.path.base_markup_dir_stub + '_xml_dom.css'
|
135
|
+
else SiSU_Env::CSS_Default.new.xml_dom
|
136
|
+
end
|
137
|
+
end
|
138
|
+
def xml_docbook
|
139
|
+
if @md.doc_css \
|
140
|
+
and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css")
|
141
|
+
@md.doc_css + '_xml_dom.css'
|
142
|
+
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_docbook.css")
|
143
|
+
@env.path.base_markup_dir_stub + '_docbook.css'
|
144
|
+
else SiSU_Env::CSS_Default.new.xml_docbook
|
145
|
+
end
|
146
|
+
end
|
147
|
+
def homepage
|
148
|
+
if @md.doc_css \
|
149
|
+
and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css")
|
150
|
+
@md.doc_css + '_homepage.css'
|
151
|
+
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_homepage.css")
|
152
|
+
@env.path.base_markup_dir_stub + '_homepage.css'
|
153
|
+
else SiSU_Env::CSS_Default.new.homepage
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
class CSS_Stylesheet
|
158
|
+
def initialize(md)
|
159
|
+
@md=md
|
160
|
+
@css=SiSU_Env::CSS_Select.new(@md)
|
161
|
+
@env=SiSU_Env::InfoEnv.new('',@md)
|
162
|
+
@file=SiSU_Env::FileOp.new(@md)
|
163
|
+
end
|
164
|
+
def html
|
165
|
+
stylesheet=
|
166
|
+
@file.path_rel_links.html_scroll_css \
|
167
|
+
+ @env.path.style + '/' \
|
168
|
+
+ @css.html
|
169
|
+
%{ <link href="#{stylesheet}" rel="stylesheet">}
|
170
|
+
end
|
171
|
+
def html_seg
|
172
|
+
stylesheet=
|
173
|
+
@file.path_rel_links.html_seg_css \
|
174
|
+
+ @env.path.style + '/' \
|
175
|
+
+ @css.html
|
176
|
+
%{ <link href="#{stylesheet}" rel="stylesheet">}
|
177
|
+
end
|
178
|
+
def html_tables
|
179
|
+
stylesheet=
|
180
|
+
@file.path_rel_links.html_seg_css \
|
181
|
+
+ @env.path.style + '/' \
|
182
|
+
+ @css.html
|
183
|
+
%{ <link href="#{stylesheet}" rel="stylesheet">}
|
184
|
+
end
|
185
|
+
def xhtml_epub
|
186
|
+
%{ <link rel="stylesheet" href="css/xhtml.css" type="text/css" />}
|
187
|
+
end
|
188
|
+
def epub
|
189
|
+
xhtml_epub
|
190
|
+
end
|
191
|
+
def xhtml
|
192
|
+
stylesheet=
|
193
|
+
@file.path_rel_links.xhtml_css \
|
194
|
+
+ @env.path.style + '/' \
|
195
|
+
+ @css.xhtml
|
196
|
+
%{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>}
|
197
|
+
end
|
198
|
+
def xml_sax
|
199
|
+
stylesheet=
|
200
|
+
@file.path_rel_links.xml_css \
|
201
|
+
+ @env.path.style + '/' \
|
202
|
+
+ @css.xml_sax
|
203
|
+
%{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>}
|
204
|
+
end
|
205
|
+
def xml_dom
|
206
|
+
stylesheet=
|
207
|
+
@file.path_rel_links.xml_css \
|
208
|
+
+ @env.path.style + '/' \
|
209
|
+
+ @css.xml_dom
|
210
|
+
%{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>}
|
211
|
+
end
|
212
|
+
def xml_docbook
|
213
|
+
stylesheet=
|
214
|
+
@file.path_rel_links.xml_css \
|
215
|
+
+ @env.path.style + '/' \
|
216
|
+
+ @css.xml_docbook
|
217
|
+
%{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>}
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
__END__
|
data/lib/sisu/se_date.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** system environment, resource control and configuration details
|
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/se_date.rb;hb=HEAD>
|
55
|
+
|
56
|
+
=end
|
57
|
+
module SiSU_Info_Date
|
58
|
+
require_relative 'constants' # constants.rb
|
59
|
+
require_relative 'utils' # utils.rb
|
60
|
+
class InfoDate
|
61
|
+
begin
|
62
|
+
require 'date'
|
63
|
+
rescue LoadError
|
64
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
65
|
+
error('date NOT FOUND (LoadError)')
|
66
|
+
end
|
67
|
+
attr_accessor :dt,:t
|
68
|
+
def initialize
|
69
|
+
@dt,@t=Date.today.to_s,Time.now
|
70
|
+
end
|
71
|
+
def week
|
72
|
+
w=@t.strftime('%W')
|
73
|
+
"#{@t.year}w#{w}"
|
74
|
+
end
|
75
|
+
def month
|
76
|
+
"#{@t.year}#{@t.month}"
|
77
|
+
end
|
78
|
+
def year
|
79
|
+
@t.year
|
80
|
+
end
|
81
|
+
def weekonly
|
82
|
+
@t.strftime('%W')
|
83
|
+
end
|
84
|
+
def monthonly
|
85
|
+
@t.month
|
86
|
+
end
|
87
|
+
def year_static
|
88
|
+
YEAR
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
__END__
|
data/lib/sisu/se_db.rb
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
=begin
|
3
|
+
|
4
|
+
* Name: SiSU
|
5
|
+
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
7
|
+
*** system environment, resource control and configuration details
|
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/se_db.rb;hb=HEAD>
|
55
|
+
|
56
|
+
=end
|
57
|
+
module SiSU_Info_Db
|
58
|
+
require_relative 'constants' # constants.rb
|
59
|
+
require_relative 'utils' # utils.rb
|
60
|
+
require_relative 'se_info_env' # se_info_env.rb
|
61
|
+
class InfoDb < SiSU_Info_Env::InfoEnv # se_info_env.rb
|
62
|
+
@@rc=nil
|
63
|
+
def initialize
|
64
|
+
@@pwd=@pwd=SiSU_Utils::Path.new.base_markup
|
65
|
+
@env=SiSU_Env::InfoEnv.new
|
66
|
+
pt=Pathname.new(@pwd)
|
67
|
+
r=Px[:lng_lst_rgx]
|
68
|
+
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
|
69
|
+
@pwd_stub=pt.realpath.to_s[u,1]
|
70
|
+
@rc=@@rc ||=SiSU_Env::GetInit.new.sisu_yaml.rc
|
71
|
+
@defaults=SiSU_Env::InfoEnv.new.defaults
|
72
|
+
end
|
73
|
+
def share_source?
|
74
|
+
((defined? @rc['db']['share_source']) \
|
75
|
+
&& @rc['db']['share_source']==true) \
|
76
|
+
? @rc['db']['share_source']
|
77
|
+
: false
|
78
|
+
end
|
79
|
+
def engine
|
80
|
+
def default
|
81
|
+
((defined? @rc['db']['engine']['default']) \
|
82
|
+
&& @rc['db']['engine']['default']=~/postgresql|sqlite/) \
|
83
|
+
? @rc['db']['engine']['default']
|
84
|
+
: 'sqlite'
|
85
|
+
end
|
86
|
+
self
|
87
|
+
end
|
88
|
+
def psql
|
89
|
+
def user(opt=nil)
|
90
|
+
if opt \
|
91
|
+
and opt.selections.str =~/--db-user[=-]["']?(\S+)["']+/
|
92
|
+
$1
|
93
|
+
elsif opt \
|
94
|
+
and opt.selections.str =~/--webserv[=-]webrick/
|
95
|
+
@env.user
|
96
|
+
else
|
97
|
+
((defined? @rc['db']['postgresql']['user']) \
|
98
|
+
&& @rc['db']['postgresql']['user']=~/\S+/) \
|
99
|
+
? @rc['db']['postgresql']['user']
|
100
|
+
: @env.user
|
101
|
+
end
|
102
|
+
end
|
103
|
+
def db #db_name
|
104
|
+
"#{Db[:name_prefix]}#{@pwd_stub}"
|
105
|
+
end
|
106
|
+
def port #PGPORT
|
107
|
+
((defined? @rc['db']['postgresql']['port']) \
|
108
|
+
&& ( @rc['db']['postgresql']['port'] =~/\d+/ \
|
109
|
+
|| @rc['db']['postgresql']['port'].is_a?(Fixnum))) \
|
110
|
+
? @rc['db']['postgresql']['port']
|
111
|
+
: (@defaults[:postgresql_port])
|
112
|
+
end
|
113
|
+
def password
|
114
|
+
((defined? @rc['db']['postgresql']['password']) \
|
115
|
+
&& @rc['db']['postgresql']['password']=~/\S+/) \
|
116
|
+
? @rc['db']['postgresql']['password']
|
117
|
+
: ''
|
118
|
+
end
|
119
|
+
def host
|
120
|
+
((defined? @rc['db']['postgresql']['host']) \
|
121
|
+
&& @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
|
122
|
+
? @rc['db']['postgresql']['host']
|
123
|
+
: ''
|
124
|
+
end
|
125
|
+
def dbi
|
126
|
+
PG::Connection.open(:dbname => psql.db)
|
127
|
+
end
|
128
|
+
def dbi_
|
129
|
+
(psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \
|
130
|
+
? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}"
|
131
|
+
: "DBI:Pg:database=#{psql.db};port=#{psql.port}"
|
132
|
+
end
|
133
|
+
def conn_dbi
|
134
|
+
DBI.connect(psql.dbi,psql.user,psql.db)
|
135
|
+
end
|
136
|
+
def conn_pg
|
137
|
+
begin
|
138
|
+
require 'pg'
|
139
|
+
rescue LoadError
|
140
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
141
|
+
error('pg NOT FOUND (LoadError)')
|
142
|
+
end
|
143
|
+
PG::Connection.new(dbname: psql.db, port: psql.port)
|
144
|
+
end
|
145
|
+
self
|
146
|
+
end
|
147
|
+
def sqlite
|
148
|
+
def db
|
149
|
+
"#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
|
150
|
+
end
|
151
|
+
def db_discrete(md)
|
152
|
+
# "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db"
|
153
|
+
end
|
154
|
+
def dbi
|
155
|
+
"DBI:SQLite3:#{sqlite.db}" #sqlite3 ?
|
156
|
+
end
|
157
|
+
def sqlite3
|
158
|
+
sqlite.db #sqlite3 ?
|
159
|
+
end
|
160
|
+
def conn_dbi
|
161
|
+
DBI.connect(sqlite.dbi)
|
162
|
+
end
|
163
|
+
def conn_sqlite3
|
164
|
+
SQLite3::Database.new(sqlite.sqlite3)
|
165
|
+
end
|
166
|
+
self
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
module SiSU_Db_Op
|
171
|
+
require_relative 'constants' # constants.rb
|
172
|
+
require_relative 'utils' # utils.rb
|
173
|
+
class DbOp < SiSU_Info_Db::InfoDb
|
174
|
+
def initialize(md)
|
175
|
+
begin
|
176
|
+
@md=md
|
177
|
+
rescue
|
178
|
+
SiSU_Screen::Ansi.new(md.opt.selections.str,$!,$@).rescue do
|
179
|
+
__LINE__.to_s + ':' + __FILE__
|
180
|
+
end
|
181
|
+
ensure
|
182
|
+
end
|
183
|
+
end
|
184
|
+
def sqlite_discrete
|
185
|
+
def db
|
186
|
+
@md.file.output_path.sqlite_discrete.dir \
|
187
|
+
+ '/' \
|
188
|
+
+ @md.file.base_filename.sqlite_discrete
|
189
|
+
end
|
190
|
+
def dbi
|
191
|
+
"DBI:SQLite3:#{sqlite_discrete.db}"
|
192
|
+
end
|
193
|
+
def sqlite3
|
194
|
+
sqlite_discrete.db
|
195
|
+
end
|
196
|
+
def conn_dbi
|
197
|
+
DBI.connect(sqlite_discrete.dbi)
|
198
|
+
end
|
199
|
+
def conn_sqlite3
|
200
|
+
begin
|
201
|
+
$sqlite3=:yes
|
202
|
+
require 'sqlite3'
|
203
|
+
SQLite3::Database.new(sqlite_discrete.sqlite3)
|
204
|
+
rescue LoadError
|
205
|
+
$sqlite3=:no
|
206
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
207
|
+
error('sqlite3 NOT FOUND (LoadError)')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
self
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
__END__
|