sisu 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,237 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** html segment generation, processing
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/html_persist.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_HTML_Persist
58
+ class Persist
59
+ @@persist=nil
60
+ attr_accessor :is0,:is1,:is2,:is3,:is4,:heading0,:heading1,:heading2,:heading3,:heading4, :title, :dot_nav, :tocband_banner, :tocband_bannerless, :headings, :heading_endnotes, :main, :endnote_all, :tail, :credits, :heading_idx, :idx, :seg_endnotes, :seg_endnotes_array, :segtocband, :get_hash_fn, :get_hash_to, :seg_subtoc, :seg_subtoc_array, :fn, :seg_name ,:seg_name_x,:seg_name_x_tracker
61
+ def initialize(args=nil)
62
+ @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
63
+ @is0=args[:is0]
64
+ @is1=args[:is1]
65
+ @is2=args[:is2]
66
+ @is3=args[:is3]
67
+ @is4=args[:is4]
68
+ @heading0=args[:heading0]
69
+ @heading1=args[:heading1]
70
+ @heading2=args[:heading2]
71
+ @heading3=args[:heading3]
72
+ @heading4=args[:heading4]
73
+ @title=args[:title]
74
+ @dot_nav=args[:dot_nav]
75
+ @tocband_banner=args[:tocband_banner]
76
+ @tocband_bannerless=args[:tocband_bannerless]
77
+ @headings=args[:headings]
78
+ @heading_endnotes=args[:heading_endnotes]
79
+ @main=args[:main]
80
+ @endnote_all=args[:endnote_all]
81
+ @tail=args[:tail]
82
+ @credits=args[:credits]
83
+ @heading_idx=args[:heading_idx]
84
+ @idx=args[:idx]
85
+ @seg_endnotes=args[:seg_endnotes]
86
+ @seg_endnotes_array=args[:seg_endnotes_array]
87
+ @get_hash_to=args[:get_hash_to]
88
+ @get_hash_fn=args[:get_hash_fn]
89
+ @seg_subtoc=args[:seg_subtoc]
90
+ @seg_subtoc_array=args[:seg_subtoc_array]
91
+ @segtocband=args[:fn]
92
+ @fn=args[:fn]
93
+ @seg_name=args[:seg_name]
94
+ @seg_name_x=args[:seg_name_x]
95
+ @seg_name_x_tracker=args[:seg_name_x_tracker]
96
+ end
97
+ def is0
98
+ @is0
99
+ end
100
+ def is1
101
+ @is1
102
+ end
103
+ def is2
104
+ @is2
105
+ end
106
+ def is3
107
+ @is3
108
+ end
109
+ def is4
110
+ @is4
111
+ end
112
+ def heading0
113
+ @heading0
114
+ end
115
+ def heading1
116
+ @heading1
117
+ end
118
+ def heading2
119
+ @heading2
120
+ end
121
+ def heading3
122
+ @heading3
123
+ end
124
+ def heading4
125
+ @heading4
126
+ end
127
+ def title
128
+ @title
129
+ end
130
+ def dot_nav
131
+ @dot_nav
132
+ end
133
+ def tocband_banner
134
+ @tocband_banner
135
+ end
136
+ def tocband_bannerless
137
+ @tocband_bannerless
138
+ end
139
+ def headings
140
+ @headings
141
+ end
142
+ def heading_endnotes
143
+ @heading_endnotes
144
+ end
145
+ def main
146
+ @main
147
+ end
148
+ def endnote_all
149
+ @endnote_all
150
+ end
151
+ def tail
152
+ @tail
153
+ end
154
+ def credits
155
+ @credits
156
+ end
157
+ def heading_idx
158
+ @heading_idx
159
+ end
160
+ def idx
161
+ @idx
162
+ end
163
+ def seg_endnotes
164
+ @seg_endnotes
165
+ end
166
+ def seg_endnotes_array
167
+ @seg_endnotes_array
168
+ end
169
+ def get_hash_to
170
+ @get_hash_to
171
+ end
172
+ def get_hash_fn
173
+ @get_hash_fn
174
+ end
175
+ def seg_subtoc
176
+ @seg_subtoc
177
+ end
178
+ def seg_subtoc_array
179
+ @seg_subtoc_array
180
+ end
181
+ def segtocband
182
+ @segtocband
183
+ end
184
+ def fn
185
+ @fn
186
+ end
187
+ def seg_name
188
+ @seg_name
189
+ end
190
+ def seg_name_x
191
+ @seg_name_x
192
+ end
193
+ def seg_name_x_tracker
194
+ @seg_name_x_tracker
195
+ end
196
+ def persist_init_hash_values
197
+ {
198
+ is0: 0,
199
+ is1: 0,
200
+ is2: 0,
201
+ is3: 0,
202
+ is4: 0,
203
+ heading0: '',
204
+ heading1: '',
205
+ heading2: '',
206
+ heading3: '',
207
+ heading4: '',
208
+ tocband_banner: [],
209
+ tocband_bannerless: [],
210
+ title: [],
211
+ headings: [],
212
+ main: [],
213
+ idx: [],
214
+ tail: [],
215
+ credits: [],
216
+ endnote_all: [],
217
+ heading_endnotes: '',
218
+ seg_endnotes: {},
219
+ seg_endnotes_array: [],
220
+ get_hash_fn: '',
221
+ get_hash_to: '',
222
+ seg_subtoc: {},
223
+ seg_subtoc_array: [],
224
+ segtocband: '',
225
+ fn: '',
226
+ seg_name: [],
227
+ seg_name_x: [],
228
+ seg_name_x_tracker: 0,
229
+ }
230
+ end
231
+ def persist_init
232
+ @@persist=nil
233
+ Persist.new(persist_init_hash_values)
234
+ end
235
+ end
236
+ end
237
+ __END__
@@ -0,0 +1,440 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** html advertising component, build here, mockup
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/html_promo.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_HTML_Promo
58
+ require_relative 'se' # se.rb
59
+ include SiSU_Env
60
+ class Ad
61
+ def initialize(md)
62
+ @md=md
63
+ @env=SiSU_Env::InfoEnv.new(@md.fns,@md)
64
+ @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
65
+ @ad=SiSU_Env::GetInit.new.ads
66
+ @flag=@env.widget.promo?
67
+ @make=SiSU_Env::ProcessingSettings.new(@md)
68
+ end
69
+ def div
70
+ def major
71
+ (@make.build.html_right_pane? \
72
+ && @flag[:ad]) \
73
+ ? '<div id="pane_major">'
74
+ : ''
75
+ end
76
+ def minor
77
+ (@make.build.html_right_pane? \
78
+ && @flag[:ad]) \
79
+ ? '<div id="pane_minor">'
80
+ : ''
81
+ end
82
+ def close
83
+ (@make.build.html_right_pane? \
84
+ && @flag[:ad]) \
85
+ ? '</div>'
86
+ : ''
87
+ end
88
+ self
89
+ end
90
+ def display
91
+ ads_array,promo_array=[],[]
92
+ if @make.build.html_right_pane? \
93
+ && @flag[:ad]
94
+ ads=if @md.promo && @md.promo.length > 0 #promo set in document
95
+ promo_array=@md.promo
96
+ elsif @flag[:rc] #promo set in rc file
97
+ promo_array=if @rc['html']['promo'].is_a?(String)
98
+ @rc['html']['promo'].split(/[,;]\s*/)
99
+ else @rc['html']['promo']
100
+ end
101
+ else advert_extract_all
102
+ end
103
+ ads=if promo_array.length > 0
104
+ promo_array.each do |x|
105
+ ads_array << advert_extract_subject(x)
106
+ end
107
+ ads_array
108
+ end
109
+ adverts(ads.join)
110
+ end
111
+ end
112
+ def cell(prod,id)
113
+ @prod,@id=prod,id
114
+ def title
115
+ @prod['title'] ? %{<b>#{@prod['title']}</b>} : ''
116
+ end
117
+ def subtitle
118
+ @prod['subtitle'] ? %{ - #{@prod['subtitle']}} : ''
119
+ end
120
+ def author
121
+ @prod['author'] ? %{<p class="pane">#{@prod['author']}</p>} : ''
122
+ end
123
+ def editor
124
+ @prod['editor'] ? %{<p class="pane">#{@prod['editor']}</p>} : ''
125
+ end
126
+ def year
127
+ @prod['year'] ? %{<p class="pane">#{@prod['year']}</p>} : ''
128
+ end
129
+ def date
130
+ @prod['date'] ? %{<p class="pane">On: #{@prod['date']}</p>} : ''
131
+ end
132
+ def location
133
+ @prod['at'] ? %{<p class="pane">At: #{@prod['at']}</p>} : ''
134
+ end
135
+ def pages
136
+ @prod['pages'] ? %{<p class="pane">Pages: #{@prod['pages']} pages</p>} : ''
137
+ end
138
+ def form
139
+ @prod['form'] ? %{<p class="pane">#{@prod['form']}</p>} : ''
140
+ end
141
+ def nick
142
+ @prod['nick'] ? %{(#{@prod['nick']})<br>} : ''
143
+ end
144
+ def update
145
+ @prod['update'] ? %{<p class="pane">Updated: #{@prod['update']}</p>} : ''
146
+ end
147
+ def issn
148
+ @prod['issn'] ? %{<p class="pane">issn: #{@prod['issn']}</p>} : ''
149
+ end
150
+ def blurb
151
+ @prod['blurb'] ? %{<p class="pane_blurb">#{@prod['blurb']}</p>} : ''
152
+ end
153
+ def search_form_sisu(table=true)
154
+ db=if @prod['db']=~/\S+/
155
+ (@prod['db']=~/^#{Db[:name_prefix]}\S+/) ? @prod['db'] : "#{Db[:name_prefix]}#{@prod['db']}"
156
+ elsif defined? @rc['search']['sisu']['db'] \
157
+ and @rc['search']['sisu']['db'] =~/\S+/
158
+ (@rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \
159
+ ? @prod['search']['sisu']['db']
160
+ : "#{Db[:name_prefix]}#{@prod['db']}"
161
+ else nil
162
+ end
163
+ action=if @prod['action']=~/^https?:\/\//
164
+ @prod['action']
165
+ elsif defined? @rc['search']['sisu']['action'] \
166
+ and @rc['search']['sisu']['action'] =~/^https?:\/\//
167
+ @rc['search']['sisu']['action']
168
+ else nil
169
+ end
170
+ if action \
171
+ and db
172
+ @env.widget.search_form('sisusearch',action,db,table)
173
+ else ''
174
+ end
175
+ end
176
+ def search_form_hyperestraier(table=true)
177
+ action=if defined? @rc['search']['hyperestraier']['action'] \
178
+ and @rc['search']['hyperestraier']['action'] =~/^https?:\/\//
179
+ @rc['search']['hyperestraier']['action']
180
+ else nil
181
+ end
182
+ form=if action
183
+ '<br>' + @env.widget.search_form('hyperestraier',action,'',table)
184
+ else ''
185
+ end
186
+ form
187
+ end
188
+ def links
189
+ if @prod['links'] #and @prod['links']==Array
190
+ links_a=[]
191
+ @prod['links'].each do |x|
192
+ if x \
193
+ and x['url'] \
194
+ and x['title']
195
+ subtitle=x['subtitle'] ? %{ - #{x['subtitle']}} : ''
196
+ url_=(x['url'] =~/https?:/) ? x['url'] : "../#{x['url']}"
197
+ links_a << %{<p class="pane_link"><a href="#{url_}">#{x['title']}#{subtitle}</a></p>\n}
198
+ end
199
+ end
200
+ links_a.join
201
+ else ''
202
+ end
203
+ end
204
+ def image
205
+ @prod['image'] ? %{<img border="0" src="../_sisu/image/#{@prod['image']}" /><br>} : ''
206
+ end
207
+ def url_link
208
+ @url_=if @prod['url'] =~/https?:/
209
+ "#{@prod['url']}"
210
+ else "../#{@prod['url']}" # "#{@env.url.root}/#{@prod['url']}"
211
+ end
212
+ def show
213
+ @prod['url'] ? %{<p class="pane_link"><a href="#{@url_}">#{@url_}</a></p>} : ''
214
+ end
215
+ def url
216
+ @prod['url'] ? %{<a href="#{@url_}">} : ''
217
+ end
218
+ def url_relative
219
+ @prod['url'] ? %{<a href="../#{@prod['url']}/toc.html">} : ''
220
+ end
221
+ self
222
+ end
223
+ def flyer
224
+ if @prod['flyer']
225
+ %{<p class="pane"><a href="../man/pdf/#{@id}.pdf"><img border="0" height="18" width="15" src="../_sisu/image/b_pdf.png">&nbsp;PDF&nbsp;flyer</a></p>}
226
+ else ''
227
+ end
228
+ end
229
+ def price
230
+ def gbp
231
+ if defined? @prod['price']['gbp'] \
232
+ and @prod['price']['gbp']
233
+ " &nbsp;&pound;&nbsp;#{@prod['price']['gbp']}&nbsp;(GBP)&nbsp;"
234
+ else ''
235
+ end
236
+ end
237
+ def euro
238
+ if defined? @prod['price']['euro'] \
239
+ and @prod['price']['euro']
240
+ " &nbsp;&euro;&nbsp;#{@prod['price']['euro']}&nbsp;(Euro)&nbsp;"
241
+ else ''
242
+ end
243
+ end
244
+ def usd
245
+ if defined? @prod['price']['usd'] \
246
+ and @prod['price']['usd']
247
+ " &nbsp;$&nbsp;#{@prod['price']['usd']}&nbsp;(USD)&nbsp;"
248
+ else ''
249
+ end
250
+ end
251
+ %{<p class="pane">Price:#{gbp}#{euro}#{usd}</p>}
252
+ end
253
+ def adsense #draw content from a configuration file
254
+ def column_right
255
+ if defined? @ad[:promo]['ad']['adsense']['column_right']
256
+ @ad[:promo]['ad']['adsense']['column_right'].join("\n")
257
+ else ''
258
+ end
259
+ end
260
+ def line_single
261
+ if defined? @ad[:promo]['ad']['adsense']['line_single']
262
+ @ad[:promo]['ad']['adsense']['line_single'].join("\n")
263
+ else ''
264
+ end
265
+ end
266
+ self
267
+ end
268
+ def site_link #Work area
269
+ if url_link.url
270
+ <<-WOK
271
+ <p class="pane">
272
+ #{url_link.url}
273
+ #{image}
274
+ #{title}
275
+ #{subtitle}
276
+ </a>#{nick}</p>
277
+ WOK
278
+ else
279
+ <<-WOK
280
+ <p class="pane">
281
+ #{image}
282
+ #{title}
283
+ #{subtitle}
284
+ </p>
285
+ WOK
286
+ end
287
+ end
288
+ self
289
+ end
290
+ def output_form_sponsor(type,id)
291
+ cell=cell(@ad[:promo][type][id],prod_id)
292
+ <<-WOK
293
+ <br>
294
+ #{cell.site_link}
295
+ #{cell.blurb}
296
+ #{cell.links}
297
+ WOK
298
+ end
299
+ def output_form_link(type,id)
300
+ prod_id=id.gsub(/id_/,'')
301
+ cell=cell(@ad[:promo][type][id],prod_id)
302
+ <<WOK
303
+ <br>
304
+ #{cell.site_link}
305
+ #{cell.author}
306
+ #{cell.year}
307
+ #{cell.blurb}
308
+ #{cell.links}
309
+ WOK
310
+ end
311
+ def output_form_search_sisu(type,id)
312
+ prod_id=id.gsub(/id_/,'')
313
+ cell=cell(@ad[:promo][type][id],prod_id)
314
+ cell.search_form_sisu(false)
315
+ end
316
+ def output_form_search_hyperestraier(type,id)
317
+ prod_id=id.gsub(/id_/,'')
318
+ cell=cell(@ad[:promo][type][id],prod_id)
319
+ cell.search_form_hyperestraier(false)
320
+ end
321
+ def output_form_book(type,id)
322
+ prod_id=id.gsub(/id_/,'')
323
+ cell=cell(@ad[:promo][type][id],prod_id)
324
+ prod_type=((id=~/id_(?:[0-9x]){10,13}/i) ? 'isbn' : 'id')
325
+ id_detail=%{<p class="pane">#{prod_type}: #{prod_id}</p>}
326
+ <<WOK
327
+ <br>
328
+ #{cell.site_link}
329
+ #{cell.author}
330
+ #{cell.year}
331
+ #{id_detail}
332
+ #{cell.pages}#{cell.form}
333
+ #{cell.price}
334
+ #{cell.flyer}
335
+ #{cell.blurb}
336
+ #{cell.links}
337
+ WOK
338
+ end
339
+ def output_form_journal(type,id)
340
+ prod_id=id.gsub(/id_/,'')
341
+ cell=cell(@ad[:promo][type][id],prod_id)
342
+ <<WOK
343
+ <br>
344
+ #{cell.site_link}
345
+ #{cell.editor}
346
+ #{cell.issn}
347
+ #{cell.update}
348
+ #{cell.form}
349
+ #{cell.price.gsub(/Price:/,'Subscription:')}
350
+ #{cell.flyer}
351
+ #{cell.blurb}
352
+ #{cell.links}
353
+ WOK
354
+ end
355
+ def output_form_conference(type,id)
356
+ prod_id=id.gsub(/id_/,'')
357
+ cell=cell(@ad[:promo][type][id],prod_id)
358
+ #translate date (dd month yyyy) from 2007-03-04 and ruby conversion
359
+ <<WOK
360
+ <br>
361
+ #{cell.site_link}
362
+ #{cell.date}
363
+ #{cell.location}
364
+ #{cell.price}
365
+ #{cell.flyer}
366
+ #{cell.blurb}
367
+ #{cell.links}
368
+ WOK
369
+ end
370
+ def output_form_select(type,id)
371
+ case type
372
+ when /site/
373
+ output_form_link(type,id)
374
+ when /sponsor/
375
+ output_form_sponsor(type,id)
376
+ when /search/
377
+ if id=~/hyperestraier/
378
+ output_form_search_hyperestraier(type,id)
379
+ else output_form_search_sisu(type,id)
380
+ end
381
+ when /book/
382
+ output_form_book(type,id)
383
+ when /journal/
384
+ output_form_journal(type,id)
385
+ when /conference/
386
+ output_form_conference(type,id)
387
+ end
388
+ end
389
+ def advert_extract_subject(category) #extracts products from category/subject list
390
+ adverts=[]
391
+ if defined? @ad[:promo_list][category] \
392
+ and @ad[:promo_list][category]
393
+ @ad[:promo_list][category].keys.each do |type|
394
+ @ad[:promo_list][category][type].each do |i|
395
+ if i
396
+ id=((i.inspect =~/^\d/) ? "id_#{i.to_s.strip}" : i.to_s.strip) #watch remove .to_s ?
397
+ if defined? @ad[:promo][type][id] \
398
+ and not @ad[:promo][type][id].nil?
399
+ adverts << output_form_select(type,id)
400
+ else
401
+ if defined? @ad[:promo][category][type][id] \
402
+ and @ad[:promo][category][type][id].is_a?(Array) \
403
+ and @ad[:promo][category][type][id].length > 0
404
+ adverts << @ad[:promo][category][type][id].join("\n")
405
+ end
406
+ end
407
+ end
408
+ end
409
+ end
410
+ else
411
+ SiSU_Screen::Ansi.new(
412
+ @md.opt.act[:color_state][:set],
413
+ "*WARN* category not found: #{category}"
414
+ ).warn unless @md.opt.act[:quiet][:set]==:on
415
+ end
416
+ adverts.join
417
+ end
418
+ def advert_extract_all #extracts all products from list (which is broken down into categories)
419
+ adverts=[]
420
+ @ad[:promo_list].keys.each do |category|
421
+ adverts << advert_extract_subject(category)
422
+ end
423
+ adverts.flatten
424
+ end
425
+ def adverts(ads)
426
+ <<WOK
427
+ #{div.minor}
428
+ #{ads}
429
+ #{div.close}
430
+ WOK
431
+ end
432
+ def no_adverts
433
+ <<WOK
434
+ #{div.minor}
435
+ #{div.close}
436
+ WOK
437
+ end
438
+ end
439
+ end
440
+ __END__