sisu 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. checksums.yaml +7 -0
  2. data/bin/sisu +367 -0
  3. data/bin/sisugem +367 -0
  4. data/data/sisu/image/arrow_next_red.png +0 -0
  5. data/data/sisu/image/arrow_prev_red.png +0 -0
  6. data/data/sisu/image/arrow_up_red.png +0 -0
  7. data/data/sisu/image/b_bluebell.png +0 -0
  8. data/data/sisu/image/b_doc.png +0 -0
  9. data/data/sisu/image/b_epub.png +0 -0
  10. data/data/sisu/image/b_home.png +0 -0
  11. data/data/sisu/image/b_info.png +0 -0
  12. data/data/sisu/image/b_odf.png +0 -0
  13. data/data/sisu/image/b_pdf.png +0 -0
  14. data/data/sisu/image/b_search.png +0 -0
  15. data/data/sisu/image/b_toc.png +0 -0
  16. data/data/sisu/image/bullet_08.png +0 -0
  17. data/data/sisu/image/bullet_09.png +0 -0
  18. data/data/sisu/image/bullet_10.png +0 -0
  19. data/data/sisu/image/bullet_11.png +0 -0
  20. data/data/sisu/image/bullet_12.png +0 -0
  21. data/data/sisu/image/bullet_doc.png +0 -0
  22. data/data/sisu/image/bullet_red.png +0 -0
  23. data/data/sisu/image/dot_clear.png +0 -0
  24. data/data/sisu/image/dot_white.png +0 -0
  25. data/data/sisu/image/gplv3.png +0 -0
  26. data/data/sisu/image/gplv3_free_software.png +0 -0
  27. data/data/sisu/image/next.png +0 -0
  28. data/data/sisu/image/previous.png +0 -0
  29. data/data/sisu/image/rb7.ico +0 -0
  30. data/data/sisu/image/sisu.png +0 -0
  31. data/data/sisu/image/toctoc.png +0 -0
  32. data/data/sisu/version.yml +5 -0
  33. data/lib/sisu.rb +94 -0
  34. data/lib/sisu/air.rb +80 -0
  35. data/lib/sisu/ao.rb +590 -0
  36. data/lib/sisu/ao_character_check.rb +102 -0
  37. data/lib/sisu/ao_composite.rb +286 -0
  38. data/lib/sisu/ao_doc_objects.rb +565 -0
  39. data/lib/sisu/ao_doc_str.rb +2269 -0
  40. data/lib/sisu/ao_endnotes.rb +136 -0
  41. data/lib/sisu/ao_expand_insertions.rb +514 -0
  42. data/lib/sisu/ao_hash_digest.rb +174 -0
  43. data/lib/sisu/ao_idx.rb +422 -0
  44. data/lib/sisu/ao_images.rb +187 -0
  45. data/lib/sisu/ao_metadata.rb +86 -0
  46. data/lib/sisu/ao_misc_arrange.rb +207 -0
  47. data/lib/sisu/ao_numbering.rb +720 -0
  48. data/lib/sisu/ao_persist.rb +194 -0
  49. data/lib/sisu/ao_references.rb +502 -0
  50. data/lib/sisu/ao_syntax.rb +640 -0
  51. data/lib/sisu/cgi.rb +84 -0
  52. data/lib/sisu/cgi_pgsql.rb +270 -0
  53. data/lib/sisu/cgi_sql_common.rb +986 -0
  54. data/lib/sisu/cgi_sqlite.rb +244 -0
  55. data/lib/sisu/conf.rb +287 -0
  56. data/lib/sisu/constants.rb +388 -0
  57. data/lib/sisu/css.rb +3484 -0
  58. data/lib/sisu/db_columns.rb +1997 -0
  59. data/lib/sisu/db_create.rb +689 -0
  60. data/lib/sisu/db_dbi.rb +90 -0
  61. data/lib/sisu/db_drop.rb +207 -0
  62. data/lib/sisu/db_import.rb +877 -0
  63. data/lib/sisu/db_indexes.rb +146 -0
  64. data/lib/sisu/db_load_tuple.rb +323 -0
  65. data/lib/sisu/db_remove.rb +182 -0
  66. data/lib/sisu/db_select.rb +230 -0
  67. data/lib/sisu/db_sqltxt.rb +173 -0
  68. data/lib/sisu/db_tests.rb +114 -0
  69. data/lib/sisu/dbi.rb +166 -0
  70. data/lib/sisu/dbi_discrete.rb +206 -0
  71. data/lib/sisu/digests.rb +306 -0
  72. data/lib/sisu/dp.rb +1606 -0
  73. data/lib/sisu/dp_identify_markup.rb +161 -0
  74. data/lib/sisu/dp_make.rb +668 -0
  75. data/lib/sisu/embedded.rb +149 -0
  76. data/lib/sisu/errors.rb +84 -0
  77. data/lib/sisu/generic_parts.rb +131 -0
  78. data/lib/sisu/git.rb +277 -0
  79. data/lib/sisu/html.rb +775 -0
  80. data/lib/sisu/html_concordance.rb +391 -0
  81. data/lib/sisu/html_format.rb +1348 -0
  82. data/lib/sisu/html_harvest.rb +109 -0
  83. data/lib/sisu/html_harvest_author_format.rb +111 -0
  84. data/lib/sisu/html_harvest_authors.rb +466 -0
  85. data/lib/sisu/html_harvest_topics.rb +893 -0
  86. data/lib/sisu/html_lite_shared.rb +324 -0
  87. data/lib/sisu/html_manifest.rb +1032 -0
  88. data/lib/sisu/html_minitoc.rb +230 -0
  89. data/lib/sisu/html_parts.rb +437 -0
  90. data/lib/sisu/html_persist.rb +237 -0
  91. data/lib/sisu/html_promo.rb +440 -0
  92. data/lib/sisu/html_scroll.rb +235 -0
  93. data/lib/sisu/html_segments.rb +716 -0
  94. data/lib/sisu/html_shared.rb +62 -0
  95. data/lib/sisu/html_table.rb +64 -0
  96. data/lib/sisu/html_tune.rb +301 -0
  97. data/lib/sisu/hub.rb +277 -0
  98. data/lib/sisu/hub_actions.rb +1122 -0
  99. data/lib/sisu/hub_loop_markup_files.rb +170 -0
  100. data/lib/sisu/hub_options.rb +1695 -0
  101. data/lib/sisu/i18n.rb +702 -0
  102. data/lib/sisu/manpage.rb +377 -0
  103. data/lib/sisu/manpage_format.rb +85 -0
  104. data/lib/sisu/object_munge.rb +307 -0
  105. data/lib/sisu/prog_text_translation.rb +1702 -0
  106. data/lib/sisu/qrcode.rb +754 -0
  107. data/lib/sisu/relaxng.rb +1153 -0
  108. data/lib/sisu/remote.rb +246 -0
  109. data/lib/sisu/rexml.rb +148 -0
  110. data/lib/sisu/se.rb +158 -0
  111. data/lib/sisu/se_cleanoutput.rb +145 -0
  112. data/lib/sisu/se_clear.rb +105 -0
  113. data/lib/sisu/se_createsite.rb +273 -0
  114. data/lib/sisu/se_css.rb +221 -0
  115. data/lib/sisu/se_date.rb +92 -0
  116. data/lib/sisu/se_db.rb +214 -0
  117. data/lib/sisu/se_envcall.rb +326 -0
  118. data/lib/sisu/se_file_op.rb +2758 -0
  119. data/lib/sisu/se_filemap.rb +247 -0
  120. data/lib/sisu/se_get_init.rb +238 -0
  121. data/lib/sisu/se_hub_particulars.rb +234 -0
  122. data/lib/sisu/se_info_env.rb +2179 -0
  123. data/lib/sisu/se_info_port.rb +70 -0
  124. data/lib/sisu/se_info_system.rb +202 -0
  125. data/lib/sisu/se_load.rb +108 -0
  126. data/lib/sisu/se_processing.rb +659 -0
  127. data/lib/sisu/se_programs.rb +394 -0
  128. data/lib/sisu/se_remotes.rb +553 -0
  129. data/lib/sisu/se_standardise_lang.rb +176 -0
  130. data/lib/sisu/se_version.rb +174 -0
  131. data/lib/sisu/shared_images.rb +137 -0
  132. data/lib/sisu/shared_markup_alt.rb +336 -0
  133. data/lib/sisu/shared_metadata.rb +1361 -0
  134. data/lib/sisu/shared_sem.rb +156 -0
  135. data/lib/sisu/sisu_thor_lib.rb +407 -0
  136. data/lib/sisu/sitemaps.rb +224 -0
  137. data/lib/sisu/src_kdissert_share.rb +102 -0
  138. data/lib/sisu/src_po4a_share.rb +309 -0
  139. data/lib/sisu/src_po4a_shelf.rb +1217 -0
  140. data/lib/sisu/src_po4a_shelf_set.rb +297 -0
  141. data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
  142. data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
  143. data/lib/sisu/src_po4a_sstm.rb +135 -0
  144. data/lib/sisu/src_shared.rb +347 -0
  145. data/lib/sisu/src_sisupod_make.rb +171 -0
  146. data/lib/sisu/src_sisupod_sstm.rb +109 -0
  147. data/lib/sisu/sst_convert_markup.rb +323 -0
  148. data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
  149. data/lib/sisu/sst_from_xml.rb +178 -0
  150. data/lib/sisu/sst_identify_markup.rb +482 -0
  151. data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
  152. data/lib/sisu/termsheet.rb +163 -0
  153. data/lib/sisu/texinfo.rb +430 -0
  154. data/lib/sisu/texinfo_format.rb +541 -0
  155. data/lib/sisu/texpdf.rb +1162 -0
  156. data/lib/sisu/texpdf_format.rb +1689 -0
  157. data/lib/sisu/texpdf_parts.rb +235 -0
  158. data/lib/sisu/txt_asciidoc.rb +354 -0
  159. data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
  160. data/lib/sisu/txt_markdown.rb +389 -0
  161. data/lib/sisu/txt_markdown_decorate.rb +207 -0
  162. data/lib/sisu/txt_orgmode.rb +376 -0
  163. data/lib/sisu/txt_orgmode_decorate.rb +186 -0
  164. data/lib/sisu/txt_output.rb +86 -0
  165. data/lib/sisu/txt_plain.rb +410 -0
  166. data/lib/sisu/txt_plain_decorate.rb +189 -0
  167. data/lib/sisu/txt_read.rb +109 -0
  168. data/lib/sisu/txt_rst.rb +371 -0
  169. data/lib/sisu/txt_rst_decorate.rb +186 -0
  170. data/lib/sisu/txt_shared.rb +241 -0
  171. data/lib/sisu/txt_textile.rb +367 -0
  172. data/lib/sisu/txt_textile_decorate.rb +186 -0
  173. data/lib/sisu/update.rb +141 -0
  174. data/lib/sisu/urls.rb +696 -0
  175. data/lib/sisu/utils.rb +232 -0
  176. data/lib/sisu/utils_composite.rb +115 -0
  177. data/lib/sisu/utils_response.rb +114 -0
  178. data/lib/sisu/utils_screen_text_color.rb +472 -0
  179. data/lib/sisu/utils_spell.rb +99 -0
  180. data/lib/sisu/webrick.rb +191 -0
  181. data/lib/sisu/wikispeak.rb +375 -0
  182. data/lib/sisu/xhtml.rb +472 -0
  183. data/lib/sisu/xhtml_epub2.rb +890 -0
  184. data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
  185. data/lib/sisu/xhtml_epub2_format.rb +2272 -0
  186. data/lib/sisu/xhtml_epub2_persist.rb +278 -0
  187. data/lib/sisu/xhtml_epub2_segments.rb +599 -0
  188. data/lib/sisu/xhtml_epub2_tune.rb +330 -0
  189. data/lib/sisu/xhtml_parts.rb +183 -0
  190. data/lib/sisu/xhtml_shared.rb +62 -0
  191. data/lib/sisu/xhtml_table.rb +97 -0
  192. data/lib/sisu/xml_docbook5.rb +376 -0
  193. data/lib/sisu/xml_dom.rb +624 -0
  194. data/lib/sisu/xml_fictionbook2.rb +389 -0
  195. data/lib/sisu/xml_format.rb +865 -0
  196. data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
  197. data/lib/sisu/xml_odf_odt.rb +887 -0
  198. data/lib/sisu/xml_odf_odt_format.rb +674 -0
  199. data/lib/sisu/xml_parts.rb +191 -0
  200. data/lib/sisu/xml_persist.rb +126 -0
  201. data/lib/sisu/xml_sax.rb +521 -0
  202. data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
  203. data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
  204. data/lib/sisu/xml_shared.rb +665 -0
  205. data/lib/sisu/xml_tables.rb +261 -0
  206. data/lib/sisu/zap.rb +90 -0
  207. metadata +251 -0
@@ -0,0 +1,145 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/se_cleanoutput.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Clean_Output
58
+ require_relative 'constants' # constants.rb
59
+ require_relative 'utils' # utils.rb
60
+ class CleanOutput
61
+ begin
62
+ require 'fileutils'
63
+ include FileUtils::Verbose
64
+ rescue LoadError
65
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
66
+ error('fileutils NOT FOUND (LoadError)')
67
+ end
68
+ def initialize(opt)
69
+ @opt=opt
70
+ z=SiSU_Env::FileMap.new(opt)
71
+ zap=z.local_sisu_source
72
+ if opt.cmd =~ /h/i
73
+ zap=Dir.glob(zap).join(' ')
74
+ @zap=if opt.cmd !~ /w/
75
+ zap.gsub(/#{@source_path}\/concordance.html/,'')
76
+ else zap
77
+ end
78
+ end
79
+ @env=SiSU_Env::InfoEnv.new
80
+ end
81
+ def zap
82
+ def deletion(fn)
83
+ if FileTest.file?(fn)==true
84
+ File.delete(fn)
85
+ tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove: ' + fn)
86
+ tell.warn unless @opt.cmd =~/q/
87
+ end
88
+ end
89
+ def remove_output
90
+ if @opt.act[:maintenance][:set] == :on
91
+ m=InfoFile.new(@opt.fnc)
92
+ tell=SiSU_Screen::Ansi.new(
93
+ @opt.cmd,@opt.fns,
94
+ 'remove maintenance files from: ' + @env.processing_path.ao
95
+ )
96
+ tell.warn unless @opt.cmd =~/q/
97
+ deletion(m.marshal.ao_content)
98
+ deletion(m.marshal.ao_idx_sst_rel_html_seg)
99
+ deletion(m.ao_idx_sst_rel)
100
+ deletion(m.ao_idx_html)
101
+ deletion(m.ao_idx_xhtml)
102
+ deletion(m.ao_metadata)
103
+ deletion(m.ao_map_nametags)
104
+ deletion(m.ao_map_ocn_htmlseg)
105
+ deletion(m.html_tune)
106
+ end
107
+ md=SiSU_Param::Parameters.new(@opt).get
108
+ f=SiSU_Env::FileOp.new(md)
109
+ deletion(f.place_file.html_segtoc.dir)
110
+ deletion(f.place_file.html_scroll.dir)
111
+ deletion(f.place_file.html_book_index.dir)
112
+ deletion(f.place_file.html_concordance.dir)
113
+ deletion(f.place_file.epub.dir)
114
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_letter}")
115
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_letter}")
116
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a4}")
117
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a4}")
118
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a5}")
119
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a5}")
120
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_b5}")
121
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_b5}")
122
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}")
123
+ deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}")
124
+ deletion(f.place_file.odt.dir)
125
+ deletion(f.place_file.xhtml.dir)
126
+ deletion(f.place_file.xml_sax.dir)
127
+ deletion(f.place_file.xml_dom.dir)
128
+ deletion(f.place_file.xml_scaffold_structure_sisu.dir)
129
+ deletion(f.place_file.xml_scaffold_structure_collapse.dir)
130
+ deletion(f.place_file.info.dir)
131
+ deletion(f.place_file.manpage.dir)
132
+ deletion(f.place_file.sqlite_discrete.dir)
133
+ deletion(f.place_file.txt.dir)
134
+ deletion(f.place_file.hash_digest.dir)
135
+ deletion(f.place_file.manifest.dir)
136
+ deletion(f.place_file.qrcode_md.dir)
137
+ deletion(f.place_file.qrcode_title.dir)
138
+ deletion(f.place_file.src.dir)
139
+ deletion(f.place_file.sisupod.dir)
140
+ end
141
+ self
142
+ end
143
+ end
144
+ end
145
+ __END__
@@ -0,0 +1,105 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/se_clear.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Clear
58
+ require_relative 'constants' # constants.rb
59
+ require_relative 'utils' # utils.rb
60
+ require_relative 'se_info_env' # se_info_env.rb
61
+ begin
62
+ require 'singleton'
63
+ rescue LoadError
64
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
65
+ error('singleton NOT FOUND (LoadError)')
66
+ end
67
+ class Clear < SiSU_Info_Env::InfoEnv # se_info_env.rb
68
+ #todo unify with FileOp
69
+ def initialize(cmd,fns,operation='')
70
+ @cmd=cmd
71
+ begin
72
+ super(fns)
73
+ @env=SiSU_Env::InfoEnv.new(fns)
74
+ SiSU_Env::InfoVersion.instance
75
+ if operation.class.inspect =~/SiSU_Param/
76
+ @md=operation
77
+ end
78
+ case operation #watch
79
+ when /pdf/ then @env_out=''
80
+ when /sql/
81
+ when /xml|plaintext|ascii/ then @env_out=@env.path.output + @fnb #check change of name to plaintext from ascii
82
+ else
83
+ if defined? @md.sfx_src \
84
+ and @md.sfx_src =~/ss[ftsumc]/
85
+ @env_out_root=@env.path.output
86
+ @env_out="#{@env.path.output}/#{@fnb}"
87
+ @@publisher='SiSU http://www.jus.uio.no/sisu'
88
+ @env_pdf="#{@env_out_root}/pdf"
89
+ end
90
+ end
91
+ rescue
92
+ SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue do
93
+ __LINE__.to_s + ':' + __FILE__
94
+ end
95
+ ensure
96
+ end
97
+ end
98
+ def param_instantiate
99
+ @cX||=SiSU_Screen::Ansi.new(@cmd)
100
+ @@date=SiSU_Env::InfoDate.new
101
+ @@publisher='SiSU scribe'
102
+ end
103
+ end
104
+ end
105
+ __END__
@@ -0,0 +1,273 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, resource control and configuration details
8
+
9
+ ** Author: Ralph Amissah
10
+ <ralph@amissah.com>
11
+ <ralph.amissah@gmail.com>
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
15
+ All Rights Reserved.
16
+
17
+ ** License: GPL 3 or later:
18
+
19
+ SiSU, a framework for document structuring, publishing and search
20
+
21
+ Copyright (C) Ralph Amissah
22
+
23
+ This program is free software: you can redistribute it and/or modify it
24
+ under the terms of the GNU General Public License as published by the Free
25
+ Software Foundation, either version 3 of the License, or (at your option)
26
+ any later version.
27
+
28
+ This program is distributed in the hope that it will be useful, but WITHOUT
29
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
30
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31
+ more details.
32
+
33
+ You should have received a copy of the GNU General Public License along with
34
+ this program. If not, see <http://www.gnu.org/licenses/>.
35
+
36
+ If you have Internet connection, the latest version of the GPL should be
37
+ available at these locations:
38
+ <http://www.fsf.org/licensing/licenses/gpl.html>
39
+ <http://www.gnu.org/licenses/gpl.html>
40
+
41
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
42
+
43
+ ** SiSU uses:
44
+ * Standard SiSU markup syntax,
45
+ * Standard SiSU meta-markup syntax, and the
46
+ * Standard SiSU object citation numbering and system
47
+
48
+ ** Hompages:
49
+ <http://www.jus.uio.no/sisu>
50
+ <http://www.sisudoc.org>
51
+
52
+ ** Git
53
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
54
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/se_createsite.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Create_Site
58
+ require_relative 'constants' # constants.rb
59
+ require_relative 'html_parts' # html_parts.rb
60
+ require_relative 'utils' # utils.rb
61
+ require_relative 'utils_screen_text_color' # utils_screen_text_color.rb
62
+ require_relative 'se_info_env' # se_info_env.rb
63
+ begin
64
+ require 'fileutils'
65
+ include FileUtils::Verbose
66
+ rescue LoadError
67
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
68
+ error('fileutils NOT FOUND (LoadError)')
69
+ end
70
+ class CreateSite < SiSU_Info_Env::InfoEnv # se_info_env.rb
71
+ require_relative 'css' # css.rb
72
+ include SiSU_Style
73
+ def initialize(opt)
74
+ @opt=opt
75
+ @env=SiSU_Env::InfoEnv.new
76
+ @init=SiSU_Env::GetInit.new
77
+ @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd
78
+ @rc=SiSU_Env::GetInit.new.sisu_yaml.rc
79
+ @home_set=SiSU_Proj_HTML::Home.new
80
+ end
81
+ def create_default_sisu_homepage(action=:none)
82
+ if action==:none
83
+ puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)}
84
+ else # turned off, unless something other than :none passed
85
+ puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)}
86
+ filename_homepage=
87
+ @env.path.webserv + '/' \
88
+ + @env.path.base_markup_dir_stub + '/index.html'
89
+ filename_home_toc=
90
+ @env.path.webserv + '/' \
91
+ + @env.path.base_markup_dir_stub + '/toc.html'
92
+ file_homepage=File.new(filename_homepage,'w')
93
+ file_home_toc=File.new(filename_home_toc,'w')
94
+ file_homepage << @home_set.homepage
95
+ file_home_toc << @home_set.homepage
96
+ file_homepage.close
97
+ file_home_toc.close
98
+ end
99
+ end
100
+ def homepage
101
+ home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html")
102
+ FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") \
103
+ unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}")
104
+ if home_pages_manually_created.length > 0
105
+ home_pages_manually_created.each do |homepage|
106
+ FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}")
107
+ end
108
+ else
109
+ create_default_sisu_homepage(:none) # :default
110
+ end
111
+ end
112
+ def cp_images(src_path,dest_path)
113
+ if FileTest.directory?(src_path)
114
+ FileUtils::cd(src_path)
115
+ source=Dir.glob("*.{png,jpg,gif,ico}")
116
+ FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path)
117
+ FileUtils::chmod(0755,dest_path)
118
+ source.each do |i|
119
+ if FileTest.file?(i)
120
+ FileUtils::cp(i,"#{dest_path}/#{i}")
121
+ FileUtils::chmod(0644,"#{dest_path}/#{i}")
122
+ else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]}
123
+ end
124
+ end
125
+ FileUtils::cd(@pwd)
126
+ else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]}
127
+ end
128
+ end
129
+ def cp_local_images
130
+ src=@pwd + '/_sisu/image'
131
+ dest=
132
+ @env.path.webserv + '/' \
133
+ + @env.path.base_markup_dir_stub + '/_sisu/image'
134
+ cp_images(src,dest) if FileTest.directory?(src)
135
+ end
136
+ def cp_external_images
137
+ src=@env.processing_path.processing + '/' \
138
+ + 'external_document/image'
139
+ dest=
140
+ @env.path.webserv + '/' \
141
+ + @env.path.base_markup_dir_stub + '/' \
142
+ + '_sisu/image_external'
143
+ if FileTest.directory?(src)
144
+ cp_images(src,dest) if FileTest.directory?(src)
145
+ end
146
+ end
147
+ def cp_webserver_images
148
+ src=@env.path.image_source
149
+ dest_arr=[
150
+ "#{@env.path.webserv}/_sisu/image",
151
+ "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image",
152
+ ]
153
+ dest_arr.each do |dest|
154
+ cp_images(src,dest) if FileTest.directory?(src)
155
+ end
156
+ end
157
+ def cp_webserver_images_local #this should not have been necessary
158
+ src=@env.path.image_source
159
+ dest=
160
+ @env.path.webserv + '/' \
161
+ + @env.path.base_markup_dir_stub + '/' \
162
+ + '_sisu/image'
163
+ cp_images(src,dest) if FileTest.directory?(src)
164
+ end
165
+ def cp_base_images #fix images
166
+ src=SiSU_is.path_base_system_data? + '/image'
167
+ dest_arr=[
168
+ "#{@env.path.webserv}/_sisu/image_sys",
169
+ "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_sys"
170
+ ]
171
+ dest_arr.each do |dest|
172
+ cp_images(src,dest) if FileTest.directory?(src)
173
+ end
174
+ end
175
+ def cp_css
176
+ FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") \
177
+ unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
178
+ css_path=[
179
+ '/etc/sisu/css',
180
+ "#{@home}/.sisu/css",
181
+ "#{@pwd}/_sisu/css",
182
+ ] #BROKEN
183
+ if defined? @rc['permission_set']['css_modify'] \
184
+ and @rc['permission_set']['css_modify']
185
+ SiSU_Screen::Ansi.new(
186
+ @opt.selections.str,
187
+ "*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}"
188
+ ).warn if @opt.act[:verbose_plus][:set]==:on \
189
+ or @opt.act[:maintenance][:set]==:on
190
+ css_path.each do |x|
191
+ if FileTest.directory?(x)
192
+ FileUtils::cd(x)
193
+ source=Dir.glob("*.{css}")
194
+ source.each do |i|
195
+ if FileTest.file?(i)
196
+ FileUtils::cp(
197
+ i,
198
+ @env.path.output + '/' + @env.path.style
199
+ )
200
+ else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]}
201
+ end
202
+ end
203
+ FileUtils::cd(@pwd)
204
+ end
205
+ end
206
+ else
207
+ SiSU_Screen::Ansi.new(
208
+ @opt.selections.str,
209
+ "*WARN* modify css is not set or is set to: false"
210
+ ).warn if @opt.act[:verbose_plus][:set]==:on \
211
+ or @opt.act[:maintenance][:set]==:on
212
+ end
213
+ fn_css=SiSU_Env::CSS_Default.new
214
+ css=SiSU_Style::CSS.new
215
+ path_style="#{@env.path.output}/#{@env.path.style}"
216
+ FileUtils::mkdir_p(path_style) \
217
+ unless FileTest.directory?(path_style)
218
+ if @opt.act[:site_init][:set]==:on \
219
+ or not FileTest.file?("#{path_style}/#{fn_css.homepage}")
220
+ style=File.new("#{path_style}/#{fn_css.homepage}",'w')
221
+ style << css.homepage
222
+ style.close
223
+ end
224
+ if @opt.act[:site_init][:set]==:on \
225
+ or not FileTest.file?("#{path_style}/#{fn_css.html_tables}")
226
+ style=File.new("#{path_style}/#{fn_css.html_tables}",'w')
227
+ style << css.html_tables
228
+ style.close
229
+ end
230
+ if @opt.act[:site_init][:set]==:on \
231
+ or not FileTest.file?("#{path_style}/#{fn_css.html}")
232
+ style=File.new("#{path_style}/#{fn_css.html}",'w')
233
+ style << css.html
234
+ style.close
235
+ end
236
+ if @opt.act[:site_init][:set]==:on \
237
+ or not FileTest.file?("#{path_style}/#{fn_css.harvest}")
238
+ style=File.new("#{path_style}/#{fn_css.harvest}",'w')
239
+ style << css.harvest
240
+ style.close
241
+ end
242
+ if @opt.act[:site_init][:set]==:on \
243
+ or (@opt.act[:xml_sax][:set]==:on \
244
+ and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}"))
245
+ style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
246
+ style << css.xml_sax
247
+ style.close
248
+ end
249
+ if @opt.act[:site_init][:set]==:on \
250
+ or (@opt.act[:xml_dom][:set]==:on \
251
+ and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}"))
252
+ style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
253
+ style << css.xml_dom
254
+ style.close
255
+ end
256
+ if @opt.act[:site_init][:set]==:on \
257
+ or (@opt.act[:xml_docbook_book][:set] == :on \
258
+ and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}"))
259
+ style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w')
260
+ style << css.xml_docbook
261
+ style.close
262
+ end
263
+ if @opt.act[:site_init][:set]==:on \
264
+ or (@opt.act[:xhtml][:set] == :on \
265
+ and not FileTest.file?("#{path_style}/#{fn_css.xhtml}"))
266
+ style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
267
+ style << css.xhtml
268
+ style.close
269
+ end
270
+ end
271
+ end
272
+ end
273
+ __END__