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,191 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** shared xml parts
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_parts.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Parts_XML
58
+ require_relative 'generic_parts' # generic_parts.rb
59
+ include SiSU_Parts_Generic
60
+ def the_line_break
61
+ '<br />'
62
+ end
63
+ def the_table_close
64
+ '</td></tr>
65
+ </table>'
66
+ end
67
+ def the_url_decoration
68
+ def xml_open #'&lt;'
69
+ Dx[:url_o]
70
+ end
71
+ def xml_close #'&gt;'
72
+ Dx[:url_c]
73
+ end
74
+ def txt_open
75
+ '<'
76
+ end
77
+ def txt_close
78
+ '>'
79
+ end
80
+ self
81
+ end
82
+ def the_color
83
+ def white
84
+ '#ffffff'
85
+ end
86
+ def black
87
+ '#000000'
88
+ end
89
+ def grey_pale
90
+ '#eeeeee'
91
+ end
92
+ def grey_medium
93
+ '#cccccc'
94
+ end
95
+ def grey
96
+ '#999999'
97
+ end
98
+ def blue_ink
99
+ '#003399'
100
+ end
101
+ def blue_tinge
102
+ '#e3ecef'
103
+ end
104
+ def yellow_light
105
+ '#fff3b6'
106
+ end
107
+ def table1
108
+ 'ffffcc'
109
+ end
110
+ def table2
111
+ 'c0d0f0'
112
+ end
113
+ def band1
114
+ %{"#{white}"}
115
+ end
116
+ def band2
117
+ %{"#{white}"}
118
+ end
119
+ self
120
+ end
121
+ def the_png
122
+ def _url_path_image_base #used for html image display
123
+ "#{Xx[:html_relative2]}_sisu/image"
124
+ end
125
+ def ico
126
+ %{ <link rel="shortcut icon" href="../_sisu/image/#{the_icon.i_ico}" />}
127
+ end
128
+ def png_home
129
+ %{<img border="0" src="#{_url_path_image_base}/#{the_icon.home_button}" alt="#{the_text.home} --&gt;" />}
130
+ end
131
+ def png_home_button
132
+ rel=@dir.path_rel_links.html_scroll_2
133
+ %{<img border="0" src="#{rel}/#{the_icon.home_button}" alt="#{the_text.home} --&gt;" />}
134
+ end
135
+ self
136
+ end
137
+ def the_font
138
+ def set_fonts
139
+ 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman'
140
+ #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman'
141
+ end
142
+ def set_face
143
+ %{face="#{set_fonts}"}
144
+ end
145
+ #def set_color
146
+ # 'color="#000000"'
147
+ #end
148
+ #def set_size_endnote
149
+ # 'size="3"'
150
+ #end
151
+ #def set_small
152
+ # 'size="3"'
153
+ #end
154
+ #def set_tiny
155
+ # 'size="2"'
156
+ #end
157
+ #def paragraph_font_tiny
158
+ # %{<font #{set_tiny} #{set_face}>}
159
+ #end
160
+ #def paragraph_font_small
161
+ # %{<font #{set_small} #{set_face}>}
162
+ #end
163
+ self
164
+ end
165
+ def the_banner
166
+ def home_button_only
167
+ %{<a href="#{url.site}/">
168
+ #{the_png.png_home_button}
169
+ </a>}
170
+ end
171
+ def banner_band
172
+ %{<table summary="home button" width="100%" border="0" cellpadding="3" align="center">
173
+ <tr><td align="left" valign="middle">
174
+ <a href="#{url.site}/" target="_top">
175
+ #{the_png.png_home}
176
+ </a>
177
+ </td>
178
+ <td width="90%">
179
+ #{the_table_close}}
180
+ end
181
+ self
182
+ end
183
+ end
184
+ module SiSU_Proj_XML
185
+ require_relative 'html_parts' # html_parts.rb
186
+ require_relative 'se' # se.rb
187
+ include SiSU_Env
188
+ class Bits < SiSU_Proj_HTML::Bits
189
+ end
190
+ end
191
+ __END__
@@ -0,0 +1,126 @@
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/xml_persist.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_XML_Persist
58
+ class Persist
59
+ @@persist=nil
60
+ attr_accessor :head,:toc,:body,:tail,:open,:close,:sc,:endnotes,:book_idx,:metadata
61
+ #attr_accessor :head,:body,:tail,:open,:close,:sc
62
+ #@@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] }
63
+ def initialize(args=nil)
64
+ @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
65
+ @head=args[:head]
66
+ @toc=args[:toc]
67
+ @body=args[:body]
68
+ @tail=args[:tail]
69
+ @open=args[:open]
70
+ @close=args[:close]
71
+ @sc=args[:sc]
72
+ @endnotes=args[:endnotes]
73
+ @book_idx=args[:book_idx]
74
+ @metadata=args[:metadata]
75
+ end
76
+ def head
77
+ @head
78
+ end
79
+ def toc
80
+ @toc
81
+ end
82
+ def body
83
+ @body
84
+ end
85
+ def tail
86
+ @tail
87
+ end
88
+ def open
89
+ @open
90
+ end
91
+ def close
92
+ @close
93
+ end
94
+ def sc
95
+ @sc
96
+ end
97
+ def endnotes
98
+ @endnotes
99
+ end
100
+ def book_idx
101
+ @book_idx
102
+ end
103
+ def metadata
104
+ @metadata
105
+ end
106
+ def persist_init_hash_values
107
+ {
108
+ head: [],
109
+ toc: [],
110
+ body: [],
111
+ tail: [],
112
+ open: [],
113
+ close: [],
114
+ sc: [],
115
+ endnotes: [],
116
+ book_idx: [],
117
+ metadata: [],
118
+ }
119
+ end
120
+ def persist_init
121
+ @@persist=nil
122
+ Persist.new(persist_init_hash_values)
123
+ end
124
+ end
125
+ end
126
+ __END__
@@ -0,0 +1,521 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** xml output (sax style) 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/xml.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_XML_SAX
58
+ require_relative 'se_hub_particulars' # se_hub_particulars.rb
59
+ include SiSU_Particulars
60
+ require_relative 'se' # se.rb
61
+ include SiSU_Env
62
+ require_relative 'xml_shared' # xml_shared.rb
63
+ include SiSU_XML_Munge
64
+ require_relative 'xml_format' # xml_format.rb
65
+ include SiSU_XML_Format
66
+ require_relative 'xml_persist' # xml_persist.rb
67
+ require_relative 'rexml' # rexml.rb
68
+ include SiSU_Rexml
69
+ require_relative 'shared_metadata' # shared_metadata.rb
70
+ @@alt_id_count=0
71
+ @@tablefoot=''
72
+ class Source
73
+ def initialize(opt)
74
+ @opt=opt
75
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
76
+ end
77
+ def read
78
+ begin
79
+ @env, @md, @ao_arr=
80
+ @particulars.env,@particulars.md,@particulars.ao_array
81
+ unless @opt.act[:quiet][:set]==:on
82
+ tool=if (@opt.act[:verbose_plus][:set]==:on \
83
+ || @opt.act[:maintenance][:set]==:on)
84
+ @env.program.web_browser \
85
+ + ' file://' \
86
+ + @md.file.output_path.xml_sax.dir + '/' \
87
+ + @md.file.base_filename.xml_sax + "\n\t" \
88
+ + @env.program.xml_viewer \
89
+ + ' file://' \
90
+ + @md.file.output_path.xml_sax.dir + '/' \
91
+ + @md.file.base_filename.xml_sax
92
+ elsif @opt.act[:verbose][:set]==:on
93
+ @env.program.web_browser \
94
+ + ' file://' \
95
+ + @md.file.output_path.xml_sax.dir + '/' \
96
+ + @md.file.base_filename.xml_sax
97
+ else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
98
+ end
99
+ (@opt.act[:verbose][:set]==:on \
100
+ || @opt.act[:verbose_plus][:set]==:on \
101
+ || @opt.act[:maintenance][:set]==:on) \
102
+ ? SiSU_Screen::Ansi.new(
103
+ @opt.act[:color_state][:set],
104
+ 'XML SAX',
105
+ tool
106
+ ).green_hi_blue
107
+ : SiSU_Screen::Ansi.new(
108
+ @opt.act[:color_state][:set],
109
+ 'XML SAX',
110
+ tool
111
+ ).green_title_hi
112
+ if (@opt.act[:verbose_plus][:set]==:on \
113
+ || @opt.act[:maintenance][:set]==:on)
114
+ SiSU_Screen::Ansi.new(
115
+ @opt.act[:color_state][:set],
116
+ @opt.fns,
117
+ 'file://' \
118
+ + @md.file.output_path.xml_sax.dir + '/' \
119
+ + @md.file.base_filename.xml_sax
120
+ ).flow
121
+ end
122
+ end
123
+ SiSU_XML_SAX::Source::Songsheet.new(@particulars).song
124
+ rescue
125
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
126
+ __LINE__.to_s + ':' + __FILE__
127
+ end
128
+ ensure
129
+ #file closed in songsheet
130
+ SiSU_Env::CreateSite.new(@opt).cp_css
131
+ Dir.chdir(@opt.f_pth[:pth])
132
+ end
133
+ end
134
+ private
135
+ class Songsheet
136
+ def initialize(particulars)
137
+ @env, @md, @ao_arr, @particulars=
138
+ particulars.env,particulars.md,particulars.ao_array,particulars
139
+ @file=SiSU_Env::FileOp.new(@md)
140
+ end
141
+ def song
142
+ begin
143
+ SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet
144
+ if (@md.opt.act[:verbose][:set]==:on \
145
+ || @md.opt.act[:verbose_plus][:set]==:on \
146
+ || @md.opt.act[:maintenance][:set]==:on)
147
+ SiSU_XML_SAX::Source::Tidy.new(@md,@file.place_file.xml_sax.dir).xml # test wellformedness, comment out when not in use
148
+ end
149
+ SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.act[:maintenance][:set]==:on # test rexml parsing, comment out when not in use #debug
150
+ rescue
151
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
152
+ __LINE__.to_s + ':' + __FILE__
153
+ end
154
+ ensure
155
+ end
156
+ end
157
+ end
158
+ class Scroll
159
+ require_relative 'txt_shared' # txt_shared.rb
160
+ include SiSU_TextUtils
161
+ require_relative 'css' # css.rb
162
+ require_relative 'xhtml_shared' # decide use, whether xml rather than xhtml
163
+ def initialize(particulars)
164
+ @env, @md, @ao_arr=
165
+ particulars.env,particulars.md,particulars.ao_array
166
+ @trans=SiSU_XML_Munge::Trans.new(@md)
167
+ @sys=SiSU_Env::SystemCall.new
168
+ @per=SiSU_XML_Persist::Persist.new
169
+ end
170
+ def songsheet
171
+ begin
172
+ pre
173
+ @data=markup(@ao_arr)
174
+ post
175
+ publish
176
+ ensure
177
+ SiSU_XML_Persist::Persist.new.persist_init
178
+ end
179
+ end
180
+ protected
181
+ def embedded_endnotes(dob='')
182
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,
183
+ '<endnote><number>\1</number><note>\2</note></endnote> ').
184
+ gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/,
185
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ').
186
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,
187
+ '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')
188
+ end
189
+ def extract_endnotes(dob='')
190
+ notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)
191
+ notes.flatten.each do |e|
192
+ s=e.to_s
193
+ util=SiSU_TextUtils::Wrap.new(s,70)
194
+ wrap=util.line_wrap
195
+ wrap=wrap.gsub(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK
196
+ #{Ax[:tab]*1}<endnote notenumber="\\1">
197
+ #{Ax[:tab]*2}<number>\\1</number>
198
+ #{Ax[:tab]*2}<note>
199
+ #{Ax[:tab]*3}\\2
200
+ #{Ax[:tab]*2}</note>
201
+ #{Ax[:tab]*1}</endnote>
202
+ WOK
203
+ ).
204
+ gsub(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK
205
+ #{Ax[:tab]*1}<endnote symbol="\\1">
206
+ #{Ax[:tab]*2}<symbol>\\1</symbol>
207
+ #{Ax[:tab]*2}<note>
208
+ #{Ax[:tab]*3}\\2
209
+ #{Ax[:tab]*2}</note>
210
+ #{Ax[:tab]*1}</endnote>
211
+ WOK
212
+ ).
213
+ gsub(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK
214
+ #{Ax[:tab]*1}<endnote symbol="\\1.length">
215
+ #{Ax[:tab]*2}<symbol>\\1</symbol>
216
+ #{Ax[:tab]*2}<note>
217
+ #{Ax[:tab]*3}\\2
218
+ #{Ax[:tab]*2}</note>
219
+ #{Ax[:tab]*1}</endnote>
220
+ WOK
221
+ )
222
+ @endnotes << wrap
223
+ end
224
+ end
225
+ def xml_head
226
+ metadata=SiSU_Metadata::Summary.new(@md).xml_sax.metadata
227
+ @per.head << metadata
228
+ end
229
+ def xml_sc(md='')
230
+ sc=if @md.sc_info
231
+ <<WOK
232
+ <source_control>
233
+ <meta>filename:</meta>
234
+ <sc class="sourcefile">
235
+ #{@md.sc_filename}
236
+ </sc><br />
237
+ <meta>version number:</meta>
238
+ <sc class="number">
239
+ #{@md.sc_number}
240
+ </sc><br />
241
+ <meta>version date:</meta>
242
+ <sc class="date">
243
+ #{@md.sc_date}
244
+ </sc><br />
245
+ </source_control>
246
+ WOK
247
+ else ''
248
+ end
249
+ @per.sc=sc
250
+ end
251
+ def xml_structure(dob,type='norm')
252
+ if dob.is==:heading
253
+ lv=dob.ln
254
+ dob.ln + 2
255
+ else lv=nil
256
+ end
257
+ extract_endnotes(dob)
258
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
259
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
260
+ #if defined? dob.obj
261
+ #t_ograph="#{dob.obj}"
262
+ util=SiSU_TextUtils::Wrap.new(dob.obj,70)
263
+ wrapped=util.line_wrap
264
+ #end
265
+ @per.body << if defined? dob.ocn; %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
266
+ else "#{Ax[:tab]*0}<object>"
267
+ end
268
+ @per.body << "#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>" if defined? dob.ocn
269
+ @per.body << if lv; %{#{Ax[:tab]*1}<text class="h#{lv}">\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>}
270
+ else %{#{Ax[:tab]*1}<text class="#{type}">\n#{Ax[:tab]*2}#{wrapped}\n#{Ax[:tab]*1}</text>} # main text, contents, body KEEP
271
+ end
272
+ @per.body << @endnotes if @endnotes
273
+ ##@per.body << "#{Ax[:tab]*1}<text>#{dob[@regx,2]}</text>" if dob[@regx,2] # old unwrapped main text, contents, body KEEP
274
+ @per.body << "#{Ax[:tab]*0}</object>"
275
+ @endnotes=[]
276
+ end
277
+ def block_structure(dob='')
278
+ extract_endnotes(dob)
279
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
280
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
281
+ dob=@trans.markup_block(dob)
282
+ dob.obj=dob.obj.strip
283
+ @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
284
+ @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
285
+ @per.body << %{#{Ax[:tab]*1}<text class="block">#{Ax[:tab]*1}}
286
+ @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
287
+ @per.body << %{#{Ax[:tab]*1}</text>}
288
+ @per.body << "#{Ax[:tab]*0}</object>"
289
+ @per.body << @endnotes if @endnotes
290
+ @endnotes=[]
291
+ end
292
+ def group_structure(dob='')
293
+ extract_endnotes(dob)
294
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean
295
+ gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean
296
+ dob=@trans.markup_group(dob)
297
+ dob.obj=dob.obj.strip
298
+ @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
299
+ @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
300
+ @per.body << %{#{Ax[:tab]*1}<text class="group">#{Ax[:tab]*1}}
301
+ @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
302
+ @per.body << %{#{Ax[:tab]*1}</text>}
303
+ @per.body << "#{Ax[:tab]*0}</object>"
304
+ @per.body << @endnotes if @endnotes
305
+ @endnotes=[]
306
+ end
307
+ def poem_structure(dob='')
308
+ dob=@trans.markup_group(dob)
309
+ #dob.obj.gsub(/\s\s/,'&#160;&#160;')
310
+ dob.obj=dob.obj.strip
311
+ @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
312
+ @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
313
+ @per.body << %{#{Ax[:tab]*1}<text class="verse">#{Ax[:tab]*1}}
314
+ @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
315
+ @per.body << %{#{Ax[:tab]*1}</text>}
316
+ @per.body << %{#{Ax[:tab]*0}</object>}
317
+ end
318
+ def code_structure(dob='')
319
+ dob=@trans.markup_group(dob)
320
+ dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;').strip
321
+ @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
322
+ @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
323
+ @per.body << %{#{Ax[:tab]*1}<text class="code">#{Ax[:tab]*1}}
324
+ @per.body << %{#{Ax[:tab]*2}#{dob.obj}#{Ax[:tab]*1}}
325
+ @per.body << %{#{Ax[:tab]*1}</text>}
326
+ @per.body << "#{Ax[:tab]*0}</object>"
327
+ end
328
+ def table_structure(dob)
329
+ table=SiSU_XHTML_Shared::TableXHTML.new(dob)
330
+ @per.body << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}
331
+ @per.body << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}
332
+ @per.body << %{#{Ax[:tab]*1}<text class="table">#{Ax[:tab]*1}}
333
+ @per.body << %{#{Ax[:tab]*2}#{table.table.obj}}
334
+ @per.body << %{#{Ax[:tab]*1}</text>}
335
+ #@per.body << %{#{tab*1}</text>}
336
+ @per.body << "#{Ax[:tab]*0}</object>"
337
+ #@per.body << %{#{Ax[:tab]*0}<object id="#{ocn}">}
338
+ #@per.body << %{#{Ax[:tab]*1}#{table}\n#{Ax[:tab]*1}} # unless lv # main text, contents, body KEEP
339
+ #@per.body << "#{Ax[:tab]*0}</object>"
340
+ #@endnotes=[]
341
+ end
342
+ def markup(data)
343
+ xml_sc(@md)
344
+ @endnotes,@level,@cont,@copen,@xml_contents_close=[],[],[],[],[]
345
+ @rcdc=false
346
+ xml_head
347
+ (0..7).each { |x| @cont[x]=@level[x]=false }
348
+ (4..7).each { |x| @xml_contents_close[x]='' }
349
+ data.each do |dob|
350
+ @trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8
351
+ dob=@trans.markup(dob)
352
+ if @rcdc==false \
353
+ and (dob.is ==:meta \
354
+ and dob.obj =~/Document Information/)
355
+ @rcdc=true
356
+ end
357
+ if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
358
+ if defined? dob.ocn #look to move to format section
359
+ ocn=((dob.ocn.to_s =~/\d+/) ? dob.ocn : nil)
360
+ @p_num=SiSU_XML_Format::ParagraphNumber.new(@md,ocn)
361
+ end
362
+ if not @rcdc
363
+ if defined? dob.ocn \
364
+ and dob.ocn.to_s =~/\d+/
365
+ x=SiSU_XML_Format::FormatSeg.new(@md,dob)
366
+ if dob.is==:heading
367
+ xml_structure(dob)
368
+ dob.obj=case dob.ln
369
+ when 1 then x.heading_body1
370
+ when 2 then x.heading_body2
371
+ when 3 then x.heading_body3
372
+ when 4 then x.heading_body4
373
+ when 5 then x.heading_body5
374
+ when 6 then x.heading_body6
375
+ when 7 then x.heading_body7
376
+ end
377
+ else
378
+ if dob.is==:verse
379
+ poem_structure(dob)
380
+ elsif dob.is==:group
381
+ group_structure(dob)
382
+ elsif dob.is==:block
383
+ block_structure(dob)
384
+ elsif dob.is==:code
385
+ code_structure(dob)
386
+ elsif dob.is==:table # FIX, check css, will need to modify
387
+ table_structure(dob)
388
+ elsif dob.is ==:para \
389
+ and dob.indent.to_s =~/[1-9]/ \
390
+ and dob.bullet_==true
391
+ xml_structure(dob,"indent_bullet#{dob.indent}")
392
+ elsif dob.is ==:para \
393
+ and dob.indent.to_s =~/[1-9]/ \
394
+ and dob.indent == dob.hang
395
+ xml_structure(dob,"indent#{dob.indent}")
396
+ elsif dob.is ==:para \
397
+ and dob.hang.to_s =~/[0-9]/ \
398
+ and dob.indent != dob.hang
399
+ xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}")
400
+ else xml_structure(dob)
401
+ end
402
+ end
403
+ elsif dob.obj =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
404
+ elsif dob.obj =~/MetaData/
405
+ txt_obj={ txt: '<br /><a name="metadata">MetaData</a>' }
406
+ format_scroll=FormatScroll.new(@md,txt_obj)
407
+ dob.obj=format_scroll.bold_para
408
+ elsif dob.obj =~/(Owner Details)/
409
+ # txt_obj={ txt: '<br /><a name="owner.details">Owner Details</a>' }
410
+ # format_scroll=FormatScroll.new(@md,txt_obj)
411
+ # @per.owner_details=format_scroll.bold_para
412
+ dob.obj=''
413
+ end
414
+ if dob.obj =~/<a name="n\d+">/ \
415
+ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
416
+ dob.obj=''
417
+ end
418
+ if dob.obj =~/.*<:#>.*$/ #investigate removal
419
+ dob.obj=if dob.obj =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/
420
+ txt_obj={ txt: dob }
421
+ format_text=FormatTextObject.new(@md,txt_obj)
422
+ format_text.scr_inden_ocn_e_no_paranum
423
+ end
424
+ end
425
+ else #
426
+ end
427
+ dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj
428
+ end
429
+ end
430
+ 7.downto(4) do |x|
431
+ y=x - 1; v=x - 3
432
+ @per.body << "#{Ax[:tab]*5}</content>\n#{Ax[:tab]*y}</contents#{v}>" if @level[x]==true
433
+ end
434
+ 3.downto(1) do |x|
435
+ y=x - 1
436
+ @per.body << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]==true
437
+ end
438
+ #7.downto(1) { |x| y=x - 1; @per.body << "#{Ax[:tab]*y}</level #{x}>" if @level[x]==true }
439
+ end
440
+ def pre
441
+ rdf=SiSU_XML_Tags::RDF.new(@md)
442
+ @per.head,@per.body=[],[]
443
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_sax').stylesheet
444
+ encoding=if @sys.locale =~/utf-?8/i then '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
445
+ else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
446
+ end
447
+ @per.open =<<WOK
448
+ #{encoding}
449
+ #{stylesheet.css_head_xml}
450
+ #{rdf.comment_xml}
451
+ <document>
452
+ WOK
453
+ @per.head << '<head>'
454
+ @per.body << '<body>'
455
+ end
456
+ def post
457
+ @per.head << @per.sc
458
+ @per.head << '</head>'
459
+ @per.body << '</body>'
460
+ @per.close = '</document>'
461
+ end
462
+ def publish
463
+ content=[]
464
+ content << @per.open << @per.head << @per.body #<< @per.metadata
465
+ #content << @per.owner_details if @md.stmp =~/\w\w/
466
+ content << @per.tail << @per.close
467
+ content=content.flatten.compact
468
+ Output.new(content,@md).xml
469
+ @@xml={}
470
+ end
471
+ end
472
+ class Output
473
+ def initialize(data,md)
474
+ @data,@md=data,md
475
+ @file=SiSU_Env::FileOp.new(@md)
476
+ end
477
+ def xml
478
+ SiSU_Env::FileOp.new(@md).mkdir
479
+ filename_xml=@file.write_file.xml_sax
480
+ @data.each do |str|
481
+ str=str.gsub(/\A\s+\Z/m,'')
482
+ filename_xml.puts str unless str.empty?
483
+ end
484
+ filename_xml.close
485
+ end
486
+ end
487
+ class Tidy
488
+ def initialize(md,file)
489
+ @md,@file=md,file
490
+ @prog=SiSU_Env::InfoProgram.new
491
+ end
492
+ def xml
493
+ if @prog.tidy !=false #note values can be other than true
494
+ if (@md.opt.act[:verbose_plus][:set]==:on \
495
+ || @md.opt.act[:maintenance][:set]==:on)
496
+ unless @md.opt.act[:quiet][:set]==:on
497
+ SiSU_Screen::Ansi.new(
498
+ @md.opt.act[:color_state][:set],
499
+ 'invert',
500
+ 'Using XML Tidy',
501
+ 'check document structure'
502
+ ).colorize
503
+ tell=SiSU_Screen::Ansi.new(
504
+ @md.opt.act[:color_state][:set],
505
+ 'invert',
506
+ '',
507
+ ''
508
+ )
509
+ tell.grey_open
510
+ end
511
+ tidyfile='/dev/null' #don't want one or screen output, check for alternative flags
512
+ tidy=SiSU_Env::SystemCall.new(@file,tidyfile)
513
+ tidy.well_formed?
514
+ tell.p_off unless @md.opt.act[:quiet][:set]==:on
515
+ end
516
+ end
517
+ end
518
+ end
519
+ end
520
+ end
521
+ __END__