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,541 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** texinfo formatting template
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/texinfo_format.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_TexInfoFormat
58
+ @@table_pg_break_counter=1
59
+ require_relative 'dp' # dp.rb
60
+ include SiSU_Param
61
+ class Texinfo
62
+ @@tex_1='\\\\~' #?? debug
63
+ @@tabular="{tabular}"
64
+ @@tex_pattern_margin_number="\\\\marginpar.+?\s+"
65
+ def initialize(md,dob=nil,up='')
66
+ @md,@dob,@up=md,dob,up
67
+ if dob.is_a?(Hash)
68
+ p dob.class
69
+ p caller
70
+ elsif dob.is_a?(String)
71
+ p dob.class
72
+ p caller
73
+ end
74
+ end
75
+ def head
76
+ t=Time.now
77
+ year=t.year
78
+ title=spec_char(@md.title.full)
79
+ title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").
80
+ gsub(/\$/,"\\$").
81
+ gsub(/[,]\s*/,' - ')
82
+ if @md.title.sub
83
+ subtitle=spec_char(@md.title.sub)
84
+ subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").
85
+ gsub(/\$/,"\\$").
86
+ gsub(/[,]\s*/,' - ')
87
+ subtitle="\n@subtitle #{subtitle}\n"
88
+ end
89
+ subtitle ||=''
90
+ author=@md.author if @md.author
91
+ author ||=''
92
+ author=author.gsub(/[\*]/,'') #if author
93
+ #SiSU_Env::InfoVersion.instance.get_version
94
+ head =<<WOK
95
+ \\input texinfo @c -*-texinfo-*-
96
+ @comment %**start of header
97
+ @setfilename #{@md.fnb}.info
98
+ @settitle #{title}
99
+ @syncodeindex pg cp
100
+ @comment %**end of header
101
+ @c %% 2
102
+ @copying
103
+ SiSU texinfo of #{title}
104
+
105
+ Copyright @copyright{} #{year} #{author}.
106
+
107
+ @quotation
108
+ Copyright #{author}, generated by ``SiSU''
109
+ @end quotation
110
+ @end copying
111
+
112
+ @dircategory SiSU Texinfo
113
+ @direntry
114
+ * sisu: SiSU texinfo file.
115
+ @end direntry
116
+ WOK
117
+ if @md.title.sub
118
+ titlepage=<<WOK
119
+ @c %% 3
120
+ @titlepage
121
+ @title #{title} #{subtitle}
122
+ @author #{author}
123
+ @page
124
+ @vskip 0pt plus 1filll
125
+ @insertcopying
126
+ @end titlepage
127
+ @contents
128
+ WOK
129
+ else
130
+ titlepage=<<WOK
131
+ @c %% 3
132
+ @titlepage
133
+ @title #{title}
134
+ @author #{author}
135
+ @page
136
+ @vskip 0pt plus 1filll
137
+ @insertcopying
138
+ @end titlepage
139
+
140
+ @contents
141
+ WOK
142
+ end
143
+ "#{head}#{titlepage}"
144
+ end
145
+ def topnode(txt)
146
+ txt=spec_char(txt)
147
+ txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").
148
+ gsub(/\$/,"\\$").
149
+ gsub(/[,]\s*/,' - ')
150
+ "@c %% 4\n" +
151
+ "@ifnottex\n" +
152
+ "@node Top\n" +
153
+ "@top #{txt}\n\n" +
154
+ "@insertcopying\n" +
155
+ "@end ifnottex\n\n" +
156
+ "@menu\n"
157
+ end
158
+ def dublincore
159
+ if defined? @md.title.full \
160
+ and @md.title.full=~/\S+/
161
+ full_title=spec_char(@md.title.full)
162
+ end
163
+ if defined? @md.creator.author \
164
+ and @md.creator.author=~/\S+/
165
+ author=spec_char(@md.creator.author)
166
+ end
167
+ if defined? @md.publisher \
168
+ and @md.publisher=~/\S+/
169
+ publisher=spec_char(@md.publisher)
170
+ end
171
+ if defined? @md.creator.contributor \
172
+ and @md.creator.contributor=~/\S+/
173
+ contributor=spec_char(@md.contributor)
174
+ end
175
+ if defined? @md.date.published \
176
+ and @md.date.published=~/\S+/
177
+ date=spec_char(@md.date.published)
178
+ end
179
+ if defined? @md.date.created \
180
+ and @md.date.created=~/\S+/
181
+ date_created=spec_char(@md.date.created)
182
+ end
183
+ if defined? @md.date.issued \
184
+ and @md.date.issued=~/\S+/
185
+ date_issued=spec_char(@md.date.issued)
186
+ end
187
+ if defined? @md.date.available \
188
+ and @md.date.available=~/\S+/
189
+ date_available=spec_char(@md.date.available)
190
+ end
191
+ if defined? @md.date.valid \
192
+ and @md.date.valid=~/\S+/
193
+ date_valid=spec_char(@md.date.valid)
194
+ end
195
+ if defined? @md.date.modified \
196
+ and @md.date.modified=~/\S+/
197
+ date_modified=spec_char(@md.date.modified)
198
+ end
199
+ if defined? @md.classify.subject \
200
+ and @md.classify.subject=~/\S+/
201
+ subject=spec_char(@md.classify.subject)
202
+ end
203
+ if defined? @md.notes.description \
204
+ and @md.notes.description=~/\S+/
205
+ description=spec_char(@md.description)
206
+ end
207
+ if defined? @md.notes.coverage \
208
+ and @md.notes.coverage=~/\S+/
209
+ coverage=spec_char(@md.notes.coverage)
210
+ end
211
+ if defined? @md.notes.relation \
212
+ and @md.notes.relation=~/\S+/
213
+ relation=spec_char(@md.notes.relation)
214
+ end
215
+ #type=spec_char(@md.type) if @md.type #dc
216
+ if defined? @md.notes.format \
217
+ and @md.notes.format=~/\S+/
218
+ format=spec_char(@md.notes.format)
219
+ end
220
+ #if defined? @md.identifier.sisupod \
221
+ #and @md.identifier.sisupod=~/\S+/
222
+ # identifier=spec_char(@md.identifier.sisupod)
223
+ #end
224
+ if defined? @md.original.source \
225
+ and @md.original.source=~/\S+/
226
+ source=spec_char(@md.original.source)
227
+ end
228
+ if defined? @md.title.language \
229
+ and @md.title.language=~/\S+/
230
+ language=spec_char(@md.title.language)
231
+ end
232
+ if defined? @md.rights.all \
233
+ and @md.rights.all=~/\S+/
234
+ rights=spec_char(@md.rights.all)
235
+ end
236
+ rights=spec_char(@md.rights.all)
237
+ full_title="Title: #{full_title}\n\n" if full_title #dc
238
+ author="Author: #{author}\n\n" if author #dc
239
+ subject="Subject: #{subject}\n\n" if subject #dc
240
+ description="Description: #{description}\n\n" if description #dc
241
+ publisher="Publisher: #{publisher}\n\n" if publisher #dc
242
+ contributor="Contributor: #{contributor}\n\n" if contributor #dc
243
+ date="Date: #{date}\n\n" if date #dc
244
+ date_created="Date Created: #{date_created}\n\n" if date_created #dc
245
+ date_issued="Date Issued: #{date_issued}\n\n" if date_issued #dc
246
+ date_available="Date Available: #{date_available}\n\n" if date_available #dc
247
+ date_valid="Date Valid: #{date_valid}\n\n" if date_valid #dc
248
+ date_modified="Date Modified: #{date_modified}\n\n" if date_modified #dc
249
+ format="Format: #{format}\n\n" if format #dc
250
+ identifier="Identifier: #{identifier}\n\n" if identifier #watch #dc
251
+ source="Source: #{source}\n\n" if source #dc
252
+ language="Language: #{language}\n\n" if language #dc
253
+ relation="Relation: #{relation}\n\n" if relation #dc
254
+ coverage="Coverage: #{coverage}\n\n" if coverage #dc
255
+ rights="Rights: #{rights}\n\n" if rights #dc
256
+ <<WOK
257
+ @node Dublin Core
258
+ @unnumbered Dublin Core
259
+ @cindex chapter, Dublin Core
260
+
261
+ #{full_title}#{author}#{subject}#{description}#{publisher}#{contributor}#{date}#{date_created}#{date_issued}#{date_available}#{date_valid}#{date_modified}#{format}#{identifier}#{source}#{language}#{relation}#{coverage}#{rights}
262
+
263
+ WOK
264
+ end
265
+ def tail
266
+ <<WOK
267
+ @c %% 6
268
+ @node Index
269
+ @unnumbered Index
270
+ @printindex cp
271
+
272
+ @bye
273
+ WOK
274
+ end
275
+ def clean(dob)
276
+ if dob.is==:heading \
277
+ and dob.obj !~/#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}/
278
+ dob.obj=dob.ocn.is_a?(Fixnum) \
279
+ ? "#{dob.obj} #{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : dob.obj
280
+ end
281
+ dob.obj=dob.obj.gsub(/\n/m,' ').
282
+ gsub(/,\s+/,' - ').
283
+ strip
284
+ dob
285
+ end
286
+ def menu
287
+ dob=clean(@dob)
288
+ m=dob.obj.gsub(/[:,]\s*/,' - ').
289
+ gsub(/@footnote\{.+?\}\s+/,'')
290
+ m="* #{m}::"
291
+ end
292
+ def level_common
293
+ dob=clean(@dob)
294
+ nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'').
295
+ gsub(/: \s*/,' - ')
296
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n\n"
297
+ dob
298
+ end
299
+ def level_sub(up)
300
+ dob=clean(@dob)
301
+ nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'').
302
+ gsub(/: \s*/,' - ')
303
+ dob.obj="@node #{nd}, #{up}\n@comment node-name, up\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n\n"
304
+ dob
305
+ end
306
+ def level0
307
+ level_common
308
+ end
309
+ def level1
310
+ level_common
311
+ end
312
+ def level2
313
+ level_common
314
+ end
315
+ def level3
316
+ level_common
317
+ end
318
+ def level4
319
+ level_common
320
+ end
321
+ def level5
322
+ level_sub(@up)
323
+ end
324
+ def level6
325
+ level_sub(@up)
326
+ end
327
+ def spec_char(txt) # special characters
328
+ txt=txt.gsub(/#{Mx[:br_eof]}/i,'').
329
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)').
330
+ gsub(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>').
331
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
332
+ gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
333
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
334
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
335
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
336
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
337
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
338
+ gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\').
339
+ gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n"). # watch
340
+ gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ').
341
+ #gsub(/\\/,'\\backslash ').
342
+ gsub(/<:pb>/,'\\newpage').
343
+ gsub(/\\backslash copyright/,'\\copyright ').
344
+ gsub(/\^/,'\\wedge ').
345
+ gsub(/(\$)/,"\\$").
346
+ gsub(/\~/,'\\~').
347
+ gsub(/#{Mx[:url_o]}(https?:\S+?)#{Mx[:url_c]}/,'<\1>').
348
+ gsub(/#{Mx[:url_o]}_(https?:\S+?)#{Mx[:url_c]}/,'\1').
349
+ gsub(/§/i,'\S').
350
+ gsub(/£/i,'\pounds').
351
+ gsub(/å/,'\aa').gsub(/Å/,'\AA').
352
+ gsub(/æ/,'\ae').gsub(/Æ/,'\AE').
353
+ gsub(/ø/,'\o').gsub(/Ø/,'\O').
354
+ gsub(/<a href=".+?">/i,' ').
355
+ gsub(/<\/a>/i,' ').
356
+ gsub(/<!>/i,' ').
357
+ gsub(/#{Mx[:br_paragrph]}/i,''). #watch
358
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*').
359
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/').
360
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_').
361
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]').
362
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^').
363
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+').
364
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
365
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-').
366
+ gsub(/@/i,'@@').
367
+ gsub(/\{/,'@{').gsub(/\}/,'@}').
368
+ gsub(/(?:&nbsp;|#{Mx[:nbsp]})+/,' '). # ~ character for hardspace
369
+ gsub(/&(\S+?);/,' ').
370
+ gsub(/&/,'<=and>').
371
+ gsub(/(\s+&\s+)/,' and ').
372
+ gsub(/(\&)/,"\\&").
373
+ gsub(/"(.+?)"/,"`\\1'"). # open & close "
374
+ gsub(/\s+"/," `"). # open "
375
+ gsub(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`'). # open "
376
+ gsub(/"(\s|\.|,|:|;)/,"'\\1"). # close "
377
+ gsub(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1"). # close "
378
+ gsub(/"(\.|,)/,"'"). # close "
379
+ gsub(/\s+'/," `"). # open '
380
+ gsub(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`'). # open '
381
+ gsub(/(<font.*?>|<\/font>)/,'')
382
+ end
383
+ def longtable
384
+ @end_table="\\end{longtable}"
385
+ @row_break='\\\\\\'
386
+ if @dob[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #CHECK !> closure #fix
387
+ no_of_cols,cols_width=$1,$2
388
+ @@tableheader=1 if @dob =~ /#{Mx[:gr_o]}Th/i #fix
389
+ @w=cols_width.split(/;\s+/)
390
+ @@number_of_cols=no_of_cols
391
+ @colW=[]
392
+ @colW << '{'
393
+ @w.each do |x|
394
+ col_w=x.gsub(/.+/,'l\|') #unless x.nil?
395
+ @colW << "#{col_w}" if col_w
396
+ end
397
+ @colW << '}'
398
+ @colW=@colW.join
399
+ @@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
400
+ "\\begin{longtable}[hb]#{@colW}\n"
401
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix
402
+ end
403
+ if @dob =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ #fix
404
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #{@end_table}") #fix
405
+ end
406
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
407
+ if @@tableheader==1
408
+ if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
409
+ tablefoot=para[/\<!f(.+?)!\>/,1]
410
+ @dob.obj=@dob.obj.gsub(/\<!f(.+?)!\>/,'').
411
+ gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,
412
+ "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&").
413
+ gsub(/&>\s*$/,
414
+ " #{@row_break} \\hline\\endhead #{@row_break}")
415
+ @dob="#{@dob} \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
416
+ @@tableheader=0
417
+ @@number_of_cols=0
418
+ end
419
+ else
420
+ if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
421
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&").
422
+ gsub(/&>\s*$/," #{@row_break}")
423
+ end
424
+ end
425
+ @dob
426
+ end
427
+ def scopedtable
428
+ # some features related to headers have been incorporated in longtable
429
+ # that are not included yet here, so until synced is broken on some
430
+ # input files, work needs to be done if is to work as before
431
+ @end_table="\\end{tabular}"
432
+ @row_break='\\\\\\\\'
433
+ @break_page="#{@row_break}\n#{@row_break} \n"
434
+ if @dob[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #fix
435
+ cols_width=$2
436
+ @w=cols_width.split(/;\s+/)
437
+ @colW=[]
438
+ @w.each do |x|
439
+ col_w=((x.to_i*12)/100.00).to_s #unless x.nil?
440
+ @colW << "p{#{col_w}cm}" if col_w
441
+ end
442
+ @@start_table="\\begin{tabular}{#{@colW}}\n"
443
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix
444
+ end
445
+ if @dob =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ #fix
446
+ @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#{@end_table}") #fix
447
+ @@table_pg_break_counter=1
448
+ end
449
+ if @dob =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u
450
+ if @@table_pg_break_counter==28 # taken from 34 ideal for portrait to 28 which suits landscape
451
+ @dob =
452
+ "\n\n#{@end_table} \n" +
453
+ "#{@break_page}" +
454
+ "#{@@start_table}\n"
455
+ @@table_pg_break_counter=1
456
+ else
457
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
458
+ @@table_pg_break_counter+=1
459
+ @dob.obj=@dob.obj.gsub(/\<!f(.+?)!\>/,'')
460
+ end
461
+ end
462
+ if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
463
+ @dob.obj=@dob.obj.gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&").
464
+ gsub(/&>\s*$/,"#{@row_break}")
465
+ end
466
+ @dob
467
+ end
468
+ def graphics
469
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
470
+ @dob.obj=@dob.obj.gsub(/<::\s+(\S+?)\s+>/i, #watch
471
+ "\\includegraphics*[width=11pt]{#{dir.path.image_source_include}/c_\\1.png}")
472
+ end
473
+ def image
474
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
475
+ width="100"
476
+ width=@dob[/<:image.+?width=``(\d+)''.+?>/im,1]
477
+ width=width.to_i*0.4
478
+ @dob.obj=@dob.obj.gsub(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i,
479
+ "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\2}}").
480
+ gsub(/<:image\s+(\S+)\s+.+\s+?>/i,
481
+ "\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\1}")
482
+ end
483
+ def png
484
+ # very messy clean up ! - work area, testing
485
+ z=@dob[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile !
486
+ image=z.scan(/\S+/)[0] #image,w,x,y=z.scan(/\S+/)
487
+ image=image.gsub(/\\/,'')
488
+ @dob.obj=@dob.obj.gsub(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile !
489
+ end
490
+ def http
491
+ # very messy clean up ! - work area, testing
492
+ z=@dob[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,1] # match operator for z \\ fragile !
493
+ url=@dob[/((?:https?|file|ftp):\S+)/im,1]
494
+ if @dob =~/\.(png|jpg|gif)/
495
+ image=z.scan(/\S+/)[0] #image,w,x,y=z.scan(/\S+/)
496
+ image=image.gsub(/\\/,'')
497
+ width=200
498
+ width=z[/w=(\d+)/im,1] if z =~/w=(\d+)/
499
+ width=width.to_i*0.8
500
+ width=400 if width > 400
501
+ c=z[/``(.+?)''/im,1]
502
+ caption="{\\\\\\\ \n\\begin{scriptsize}#{c}\\end{scriptsize}&}" if c
503
+ end
504
+ if image
505
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
506
+ @dob.obj=@dob.obj.gsub(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/, # fragile match operator\\ fragile !
507
+ "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/#{image}}}#{caption}")
508
+ else
509
+ link=z[/(.+?)\\/im,1]
510
+ @dob.obj=@dob.obj.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+#{Mx[:url_c]}/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile !
511
+ end
512
+ end
513
+ end
514
+ class TeXinfoTxt
515
+ def initialize(md,dob,txt)
516
+ @md,@dob,@txt=md,dob,txt
517
+ end
518
+ def clean(dob,txt)
519
+ if dob.is==:heading \
520
+ and txt !~/#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}/
521
+ txt=dob.ocn.is_a?(Fixnum) \
522
+ ? "#{dob.obj} #{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : dob.obj
523
+ end
524
+ txt.strip
525
+ end
526
+ def submenu
527
+ txt=@txt.join("\n")
528
+ txt=clean(@dob,txt)
529
+ txt="@menu\n#{txt}\n@end menu\n\n"
530
+ txt=txt.gsub(/.+/m,"#{txt}")
531
+ end
532
+ def subsubmenu
533
+ txt=@txt.join("\n")
534
+ txt=clean(@dob,txt)
535
+ txt="@menu\n#{txt}\n@end menu\n\n"
536
+ txt=txt.gsub(/.+/m,"#{txt}")
537
+ end
538
+ end
539
+ end
540
+ __END__
541
+ watch title, might need full_title