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
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ ---
2
+ :project: SiSU
3
+ :version: 7.0.0
4
+ :date_stamp: 2015w17/5
5
+ :date: "2015-05-01"
data/lib/sisu.rb ADDED
@@ -0,0 +1,94 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** hub
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.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_libs
58
+ require_relative 'sisu/hub' # sisu/hub.rb
59
+ require_relative 'sisu/se' # sisu/se.rb
60
+ require_relative 'sisu/utils' # sisu/utils.rb
61
+ class CallHubMaster
62
+ def initialize(argv,sisu_runtime)
63
+ begin
64
+ SiSU::HubMaster.new(argv,sisu_runtime)
65
+ rescue
66
+ SiSU_Screen::Ansi.new(argv).rescue do
67
+ __LINE__.to_s + ':' + __FILE__
68
+ end
69
+ ensure
70
+ Dir.chdir(sisu_runtime[:call_path])
71
+ end
72
+ end
73
+ end
74
+ class HubClose
75
+ def initialize(argv,call_path)
76
+ begin
77
+ env=SiSU_Env::InfoEnv.new
78
+ rescue
79
+ ensure
80
+ if FileTest.directory?(env.processing_path.processing) \
81
+ and FileTest.directory?(env.processing_path.processing_base_tmp) \
82
+ and env.processing_path.processing_base_tmp =~/#{env.processing_path.processing}/ \
83
+ and env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ \
84
+ and not argv.inspect =~/"--maintenance"|"-M"/
85
+ FileUtils::cd(env.processing_path.processing_base_tmp) do
86
+ FileUtils::rm_rf('.')
87
+ end
88
+ end
89
+ Dir.chdir(call_path)
90
+ end
91
+ end
92
+ end
93
+ end
94
+ __END__
data/lib/sisu/air.rb ADDED
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/air.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Air
58
+ require_relative 'se_hub_particulars' # se_hub_particulars.rb
59
+ class Source
60
+ @@ao_array=[]
61
+ @@fns=nil
62
+ def initialize(opt)
63
+ @opt=opt
64
+ @@fns||@opt.fns
65
+ @particulars=SiSU_Particulars::Combined.new(opt)
66
+ #@env=@particulars.env
67
+ #@md=@particulars.md
68
+ #@ao_array=@particulars.ao_array
69
+ end
70
+ def read
71
+ end
72
+ protected
73
+ def print
74
+ puts @particulars.md.inspect
75
+ puts @particulars.env.inspect
76
+ puts @particulars.ao_array
77
+ end
78
+ end
79
+ end
80
+ __END__
data/lib/sisu/ao.rb ADDED
@@ -0,0 +1,590 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** preprocessing, (document abstraction), data abstraction used in subsequent
8
+ processing
9
+
10
+ ** Author: Ralph Amissah
11
+ <ralph@amissah.com>
12
+ <ralph.amissah@gmail.com>
13
+
14
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
15
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
16
+ All Rights Reserved.
17
+
18
+ ** License: GPL 3 or later:
19
+
20
+ SiSU, a framework for document structuring, publishing and search
21
+
22
+ Copyright (C) Ralph Amissah
23
+
24
+ This program is free software: you can redistribute it and/or modify it
25
+ under the terms of the GNU General Public License as published by the Free
26
+ Software Foundation, either version 3 of the License, or (at your option)
27
+ any later version.
28
+
29
+ This program is distributed in the hope that it will be useful, but WITHOUT
30
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
32
+ more details.
33
+
34
+ You should have received a copy of the GNU General Public License along with
35
+ this program. If not, see <http://www.gnu.org/licenses/>.
36
+
37
+ If you have Internet connection, the latest version of the GPL should be
38
+ available at these locations:
39
+ <http://www.fsf.org/licensing/licenses/gpl.html>
40
+ <http://www.gnu.org/licenses/gpl.html>
41
+
42
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
43
+
44
+ ** SiSU uses:
45
+ * Standard SiSU markup syntax,
46
+ * Standard SiSU meta-markup syntax, and the
47
+ * Standard SiSU object citation numbering and system
48
+
49
+ ** Hompages:
50
+ <http://www.jus.uio.no/sisu>
51
+ <http://www.sisudoc.org>
52
+
53
+ ** Git
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
55
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao.rb;hb=HEAD>
56
+
57
+ =end
58
+ module SiSU_AO
59
+ require_relative 'se' # se.rb
60
+ include SiSU_Env
61
+ require_relative 'dp' # dp.rb
62
+ include SiSU_Param
63
+ require_relative 'ao_doc_objects' # ao_doc_objects.rb
64
+ require_relative 'ao_syntax' # ao_syntax.rb
65
+ include SiSU_AO_Syntax
66
+ require_relative 'ao_doc_str' # ao_doc_str.rb
67
+ require_relative 'ao_references' # ao_references.rb
68
+ require_relative 'ao_idx' # ao_idx.rb
69
+ require_relative 'ao_numbering' # ao_numbering.rb
70
+ require_relative 'ao_hash_digest' # ao_hash_digest.rb
71
+ require_relative 'ao_endnotes' # ao_endnotes.rb
72
+ require_relative 'ao_images' # ao_images.rb
73
+ require_relative 'ao_metadata' # ao_metadata.rb
74
+ require_relative 'ao_character_check' # ao_character_check.rb
75
+ require_relative 'ao_misc_arrange' # ao_misc_arrange.rb
76
+ require_relative 'ao_expand_insertions' # ao_expand_insertions.rb
77
+ require_relative 'ao_persist' # ao_persist.rb
78
+ require_relative 'prog_text_translation' # prog_text_translation.rb
79
+ require_relative 'shared_sem' # shared_sem.rb
80
+ class Instantiate < SiSU_Param::Parameters::Instructions
81
+ def initialize
82
+ @@flag_vocab=0
83
+ @@line_mode=''
84
+ end
85
+ end
86
+ class Source <Instantiate
87
+ def initialize(opt,fnx=nil,process=:complete)
88
+ @opt,@fnx,@process=opt,fnx,process
89
+ @per ||=SiSU_AO_Persist::Persist.new.persist_init
90
+ @per.fns ||=opt.fns
91
+ fn_use=if fnx \
92
+ and fnx =~/\.ss[tmi]$/
93
+ fnx
94
+ elsif opt.fns =~/\.ssm$/
95
+ opt.fns + '.sst'
96
+ else
97
+ opt.fns
98
+ end
99
+ @make_fns=SiSU_Env::InfoFile.new(fn_use)
100
+ @fnm=@make_fns.marshal.ao_metadata
101
+ @fnc=@make_fns.marshal.ao_content
102
+ @idx_sst=@make_fns.marshal.ao_idx_sst_rel_html_seg
103
+ @idx_raw=@make_fns.marshal.ao_idx_sst_rel
104
+ @idx_html=@make_fns.marshal.ao_idx_html
105
+ @idx_xhtml=@make_fns.marshal.ao_idx_xhtml
106
+ @map_nametags=@make_fns.marshal.ao_map_nametags
107
+ @map_ocn_htmlseg=@make_fns.marshal.ao_map_ocn_htmlseg
108
+ @env=SiSU_Env::InfoEnv.new
109
+ end
110
+ def read #creates ao
111
+ begin
112
+ @per=SiSU_AO_Persist::Persist.new
113
+ @per.ao_arr=[]
114
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
115
+ ? @fnx
116
+ : @opt.fns
117
+ create_ao
118
+ rescue
119
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@per.fns).location do
120
+ __LINE__.to_s + ':' + __FILE__
121
+ end
122
+ ensure
123
+ SiSU_AO_Persist::Persist.new.persist_init
124
+ SiSU_AO::Instantiate.new
125
+ end
126
+ end
127
+ def get #reads ao, unless does not exist then creates first
128
+ begin
129
+ ao=[]
130
+ unless @per.fns==@opt.fns \
131
+ or @per.fns==@fnx
132
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
133
+ ? @fnx
134
+ : @opt.fns
135
+ @per.ao_arr=[]
136
+ end
137
+ ao=(@per.ao_arr.empty?) \
138
+ ? read_fnc
139
+ : @per.ao_arr.dup
140
+ rescue
141
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
142
+ __LINE__.to_s + ':' + __FILE__
143
+ end
144
+ ensure
145
+ SiSU_AO::Instantiate.new
146
+ end
147
+ end
148
+ def get_idx_sst #reads ao idx.sst, #unless does not exist then creates first
149
+ begin
150
+ ao=[]
151
+ unless @per.fns==@opt.fns \
152
+ or @per.fns==@fnx
153
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
154
+ ? @fnx
155
+ : @opt.fns
156
+ @per.idx_arr_sst=[]
157
+ end
158
+ ao=(@per.idx_arr_sst.empty?) \
159
+ ? read_idx_sst
160
+ : @per.idx_arr_sst.dup #check
161
+ rescue
162
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
163
+ __LINE__.to_s + ':' + __FILE__
164
+ end
165
+ ensure
166
+ SiSU_AO::Instantiate.new
167
+ end
168
+ end
169
+ def get_idx_raw
170
+ begin
171
+ ao=[]
172
+ unless @per.fns==@opt.fns \
173
+ or @per.fns==@fnx
174
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
175
+ ? @fnx
176
+ : @opt.fns
177
+ @per.idx_arr_tex=[]
178
+ end
179
+ ao=(@per.idx_arr_tex.empty?) \
180
+ ? read_idx_raw
181
+ : @per.idx_arr_tex.dup #check
182
+ rescue
183
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
184
+ __LINE__.to_s + ':' + __FILE__
185
+ end
186
+ ensure
187
+ SiSU_AO::Instantiate.new
188
+ end
189
+ end
190
+ def get_idx_html #reads ao idx.html, #unless does not exist then creates first
191
+ begin
192
+ ao=[]
193
+ unless @per.fns==@opt.fns \
194
+ or @per.fns==@fnx
195
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
196
+ ? @fnx
197
+ : @opt.fns
198
+ @per.idx_arr_html=[]
199
+ end
200
+ ao=(@per.idx_arr_html.empty?) \
201
+ ? read_idx_html
202
+ : @per.idx_arr_html.dup
203
+ rescue
204
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
205
+ __LINE__.to_s + ':' + __FILE__
206
+ end
207
+ ensure
208
+ SiSU_AO::Instantiate.new
209
+ end
210
+ end
211
+ def get_idx_xhtml #reads ao idx.xhtml, #unless does not exist then creates first
212
+ begin
213
+ ao=[]
214
+ unless @per.fns==@opt.fns \
215
+ or @per.fns==@fnx
216
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
217
+ ? @fnx
218
+ : @opt.fns
219
+ @per.idx_arr_xhtml=[] #...
220
+ end
221
+ ao=(@per.idx_arr_xhtml.empty?) \
222
+ ? read_idx_xhtml
223
+ : @per.idx_arr_xhtml.dup
224
+ rescue
225
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
226
+ __LINE__.to_s + ':' + __FILE__
227
+ end
228
+ ensure
229
+ SiSU_AO::Instantiate.new
230
+ end
231
+ end
232
+ def get_map_nametags #reads ao map.nametags, #unless does not exist then creates first
233
+ begin
234
+ ao=[]
235
+ unless @per.fns==@opt.fns \
236
+ or @per.fns==@fnx
237
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
238
+ ? @fnx
239
+ : @opt.fns
240
+ @per.map_arr_nametags=[]
241
+ end
242
+ ao=(@per.map_arr_nametags.empty?) \
243
+ ? read_map_nametags
244
+ : @per.map_arr_nametags.dup
245
+ rescue
246
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
247
+ __LINE__.to_s + ':' + __FILE__
248
+ end
249
+ ensure
250
+ SiSU_AO::Instantiate.new
251
+ end
252
+ end
253
+ def get_map_ocn_htmlseg #reads ao map.ocn_htmlseg, #unless does not exist then creates first
254
+ begin
255
+ ao=[]
256
+ unless @per.fns==@opt.fns \
257
+ or @per.fns==@fnx
258
+ @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
259
+ ? @fnx
260
+ : @opt.fns
261
+ @per.map_arr_ocn_htmlseg=[]
262
+ end
263
+ ao=(@per.map_arr_ocn_htmlseg.empty?) \
264
+ ? read_map_ocn_htmlseg
265
+ : @per.map_arr_ocn_htmlseg.dup
266
+ rescue
267
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
268
+ __LINE__.to_s + ':' + __FILE__
269
+ end
270
+ ensure
271
+ SiSU_AO::Instantiate.new
272
+ end
273
+ end
274
+ protected
275
+ def create_ao
276
+ ao_array=[]
277
+ fnp = @fnx ? "#{@opt.fno} #{@fnx}" : @opt.fno
278
+ unless @opt.act[:quiet][:set]==:on
279
+ tell=(@opt.act[:verbose][:set]==:on \
280
+ || @opt.act[:verbose_plus][:set]==:on \
281
+ || @opt.act[:maintenance][:set]==:on) \
282
+ ? SiSU_Screen::Ansi.new(
283
+ @opt.act[:color_state][:set],
284
+ 'Document Abstraction'
285
+ )
286
+ : SiSU_Screen::Ansi.new(
287
+ @opt.act[:color_state][:set],
288
+ 'Document Abstraction',
289
+ "[#{@opt.f_pth[:lng_is]}] #{fnp}"
290
+ )
291
+ tell.blue_title_hi
292
+ end
293
+ fn=(@fnx && @fnx =~/\.ss[tmi]$/) \
294
+ ? @fnx
295
+ : @opt.fns
296
+ if @opt.fno =~/\.txz$/
297
+ Dir.chdir(@opt.f_pth[:pth])
298
+ end
299
+ meta=file_array=@env.source_file_processing_array(fn)
300
+ @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
301
+ meta=nil
302
+ ao=SiSU_AO::Make.new(fn,@md,file_array,@fnx,@process).song
303
+ if (@opt.act[:verbose][:set]==:on \
304
+ || @opt.act[:verbose_plus][:set]==:on \
305
+ || @opt.act[:maintenance][:set]==:on)
306
+ cf=SiSU_Env::CreateFile.new(fn)
307
+ if (@opt.act[:verbose][:set]==:on \
308
+ || @opt.act[:verbose_plus][:set]==:on)
309
+ SiSU_Screen::Ansi.new(
310
+ @opt.act[:color_state][:set],
311
+ @opt.fns,
312
+ "~meta/#{@opt.fns}.meta"
313
+ ).output
314
+ elsif @opt.act[:maintenance][:set]==:on
315
+ SiSU_Screen::Ansi.new(
316
+ @opt.act[:color_state][:set],
317
+ "ao -> #{cf.meta}"
318
+ ).txt_grey
319
+ end
320
+ end
321
+ ao.each {|s| ao_array << s}
322
+ if @opt.act[:maintenance][:set]==:on
323
+ ao_array.each do |obj|
324
+ if defined? obj.parent
325
+ if defined? obj.ln
326
+ if defined? obj.node
327
+ puts %{#{obj.ln}: #{obj.ocn} : #{obj.parent} : #{obj.node} - #{obj.lc}}
328
+ else
329
+ puts %{#{obj.ln}: #{obj.ocn} : #{obj.parent}}
330
+ end
331
+ else
332
+ if defined? obj.node
333
+ puts %{ #{obj.ocn} : #{obj.parent} : #{obj.node} - #{obj.lc}}
334
+ else
335
+ puts %{ #{obj.ocn} : #{obj.parent}}
336
+ end
337
+ end
338
+ end
339
+ end
340
+ end
341
+ ao_array
342
+ end
343
+ def read_fnm
344
+ ao=[]
345
+ ao=(FileTest.file?(@fnm)) \
346
+ ? (File.open(@fnm,'r:utf-8'){ |f| ao=Marshal.load(f)})
347
+ : SiSU_AO::Source.new(@opt).create_ao
348
+ end
349
+ def read_fnc
350
+ ao=[]
351
+ ao=(FileTest.file?(@fnc)) \
352
+ ? (File.open(@fnc,'r:utf-8'){ |f| ao=Marshal.load(f)})
353
+ : SiSU_AO::Source.new(@opt,@fnx,@process).create_ao
354
+ end
355
+ def read_idx_sst
356
+ m=[]
357
+ m=(FileTest.file?(@idx_sst)) \
358
+ ? (File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)})
359
+ : nil
360
+ end
361
+ def read_idx_raw
362
+ m=[]
363
+ m=(FileTest.file?(@idx_raw)) \
364
+ ? (File.open(@idx_raw,'r:utf-8'){ |f| m=Marshal.load(f)})
365
+ : nil
366
+ end
367
+ def read_idx_html
368
+ m=[]
369
+ m=(FileTest.file?(@idx_html)) \
370
+ ? (File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)})
371
+ : nil
372
+ end
373
+ def read_idx_xhtml
374
+ m=[]
375
+ m=(FileTest.file?(@idx_xhtml)) \
376
+ ? (File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)})
377
+ : nil
378
+ end
379
+ def read_map_nametags
380
+ m=[]
381
+ m=(FileTest.file?(@map_nametags)) \
382
+ ? (File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)})
383
+ : nil
384
+ end
385
+ def read_map_ocn_htmlseg
386
+ m=[]
387
+ m=(FileTest.file?(@map_ocn_htmlseg)) \
388
+ ? (File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)})
389
+ : nil
390
+ end
391
+ end
392
+ class Output
393
+ def initialize(fn,md,data)
394
+ @fn,@md,@data=fn,md,data
395
+ @cf=SiSU_Env::CreateFile.new(@fn)
396
+ @make=SiSU_Env::InfoFile.new(@fn)
397
+ @dir=SiSU_Env::InfoEnv.new(@fn)
398
+ end
399
+ def screen_dump(o)
400
+ if defined? o.of
401
+ print %{OF: #{o.of}; }
402
+ end
403
+ if defined? o.is
404
+ print %{IS: #{o.is.to_s}; }
405
+ end
406
+ if defined? o.ocn
407
+ print %{OCN: #{o.ocn}; }
408
+ end
409
+ if defined? o.node
410
+ print %{NODE: #{o.node}; }
411
+ end
412
+ if defined? o.parent
413
+ print %{Parent: #{o.parent}; }
414
+ end
415
+ if defined? o.obj and not o.obj.empty?
416
+ puts %{\n#{o.obj}; }
417
+ else "\n"
418
+ end
419
+ end
420
+ def screen_print(t_o)
421
+ if defined? t_o
422
+ print ' ' + t_o.to_s
423
+ end
424
+ end
425
+ def screen_output(data)
426
+ data.each do |o|
427
+ print o.class
428
+ screen_print(o.ocn)
429
+ screen_print(o.obj)
430
+ puts "\n"
431
+ end
432
+ end
433
+ def hard_output
434
+ if @md.opt.act[:maintenance][:set]==:on
435
+ filename_meta=@cf.metaverse.file_meta
436
+ @data.each {|o| filename_meta.puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier
437
+ filename_txt=@cf.metaverse.file_txt
438
+ @data.each do |o|
439
+ if defined? o.ocn
440
+ filename_txt.puts case o.is
441
+ when :heading
442
+ "[#{o.is.to_s} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}"
443
+ else "[#{o.is.to_s} [#{o.ocn}]] #{o.obj}"
444
+ end
445
+ else
446
+ filename_txt.puts case o.is
447
+ when :meta
448
+ "[m~#{o.tag}] #{o.obj}"
449
+ else "[#{o.is.to_s}] #{o.obj}"
450
+ end
451
+ end
452
+ end
453
+ filename_debug=@cf.file_debug
454
+ @data.each do |o|
455
+ if defined? o.ocn
456
+ case o.is
457
+ when :heading
458
+ filename_debug.puts
459
+ "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}"
460
+ end
461
+ end
462
+ end
463
+ else
464
+ hard="#{@dir.processing_path.ao}/#{@md.fns}.meta"
465
+ File.unlink(hard) if FileTest.file?(hard)
466
+ hard="#{@dir.processing_path.ao}/#{@md.fns}.txt"
467
+ File.unlink(hard) if FileTest.file?(hard)
468
+ hard="#{@dir.processing_path.ao}/#{@md.fns}.debug.txt"
469
+ File.unlink(hard) if FileTest.file?(hard)
470
+ end
471
+ end
472
+ def make_marshal_content
473
+ marshal_ao=@make.marshal.ao_content
474
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
475
+ end
476
+ def make_marshal_metadata
477
+ marshal_ao=@make.marshal.ao_metadata
478
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
479
+ end
480
+ def idx_html_hard_output
481
+ if @md.book_idx \
482
+ and @md.opt.act[:maintenance][:set]==:on
483
+ filename_meta=@cf.file_meta_idx_html
484
+ if @data.is_a?(Array)
485
+ @data.each {|s| p s.inspect + "\n" unless s.is_a?(String)}
486
+ @data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
487
+ end
488
+ else
489
+ hard_idx_html="#{@dir.processing_path.ao}/#{@md.fns}.idx.html"
490
+ File.unlink(hard_idx_html) if FileTest.file?(hard_idx_html)
491
+ end
492
+ end
493
+ def make_marshal_idx_sst_html_seg
494
+ marshal_ao=@make.marshal.ao_idx_sst_rel_html_seg
495
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
496
+ if @data.is_a?(Array)
497
+ end
498
+ def make_marshal_idx_sst_rel
499
+ marshal_ao=@make.marshal.ao_idx_sst_rel
500
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
501
+ if @data.is_a?(Array)
502
+ end
503
+ def make_marshal_idx_html
504
+ marshal_ao=@make.marshal.ao_idx_html
505
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
506
+ if @data.is_a?(Array)
507
+ end
508
+ def make_marshal_idx_xhtml
509
+ marshal_ao=@make.marshal.ao_idx_xhtml
510
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
511
+ if @data.is_a?(Array)
512
+ end
513
+ def make_marshal_map_nametags
514
+ marshal_ao=@make.marshal.ao_map_nametags
515
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
516
+ if @data.is_a?(Hash)
517
+ end
518
+ def make_marshal_map_name_ocn_htmlseg
519
+ marshal_ao=@make.marshal.ao_map_ocn_htmlseg
520
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
521
+ if @data.is_a?(Hash)
522
+ end
523
+ end
524
+ class Make
525
+ def initialize(fn,md,data,fnx,process)
526
+ @fn,@md,@data,@fnx,@process=fn,md,data,fnx,process
527
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
528
+ end
529
+ def reset
530
+ @@flag_vocab=0
531
+ @@line_mode=''
532
+ end
533
+ def song
534
+ reset
535
+ data_txt=@data
536
+ data_txt=
537
+ SiSU_AO_Insertions::Insertions.new(@md,data_txt). # ao_expand_insertions.rb
538
+ expand_insertions?
539
+ data_txt=
540
+ SiSU_AO_MiscArrangeText::SI.new(@md,data_txt). # ao_misc_arrange.rb
541
+ prepare_text
542
+ data_obj,
543
+ metadata,
544
+ bibliography=
545
+ SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt). # ao_doc_str.rb
546
+ identify_parts
547
+ data_obj=
548
+ SiSU_AO_Syntax::Markup.new(@md,data_obj,bibliography).songsheet # ao_syntax.rb
549
+ data_obj,
550
+ endnote_array=
551
+ SiSU_AO_CharacterCheck::Check.new(data_obj). # ao_character_check.rb
552
+ character_check_and_oldstyle_endnote_array
553
+ data_obj=
554
+ SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb
555
+ data_obj,
556
+ tags_map,
557
+ ocn_html_seg_map=
558
+ SiSU_AO_Numbering::Numbering.new(@md,data_obj,@fnx,@process). # ao_numbering.rb
559
+ numbering_song
560
+ data_obj,
561
+ book_index_rel,
562
+ book_index_rel_html_seg,
563
+ html_idx,
564
+ xhtml_idx=
565
+ SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env). # ao_idx.rb
566
+ indexing_song if @md.book_idx
567
+ data_obj=
568
+ SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array). # ao_endnotes.rb
569
+ endnotes
570
+ outputdata=data_obj
571
+ if (@md.opt.act[:ao][:set]==:on \
572
+ || @md.opt.act[:maintenance][:set]==:on)
573
+ SiSU_AO::Output.new(@fn,@md,outputdata).hard_output
574
+ SiSU_AO::Output.new(@fn,@md,outputdata).make_marshal_content
575
+ SiSU_AO::Output.new(@fn,@md,metadata).make_marshal_metadata
576
+ SiSU_AO::Output.new(@fn,@md,html_idx).idx_html_hard_output
577
+ SiSU_AO::Output.new(@fn,@md,book_index_rel_html_seg).make_marshal_idx_sst_html_seg
578
+ SiSU_AO::Output.new(@fn,@md,book_index_rel).make_marshal_idx_sst_rel
579
+ SiSU_AO::Output.new(@fn,@md,html_idx).make_marshal_idx_html
580
+ SiSU_AO::Output.new(@fn,@md,xhtml_idx).make_marshal_idx_xhtml
581
+ SiSU_AO::Output.new(@fn,@md,tags_map).make_marshal_map_nametags
582
+ SiSU_AO::Output.new(@fn,@md,ocn_html_seg_map).make_marshal_map_name_ocn_htmlseg
583
+ end
584
+ reset
585
+ outputdata
586
+ end
587
+ protected
588
+ end
589
+ end
590
+ __END__