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,149 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** sitemap created from parameters extracted from input file(s)
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/embedded.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Embedded
58
+ require_relative 'dp' # dp.rb
59
+ include SiSU_Param
60
+ require_relative 'se' # se.rb
61
+ include SiSU_Env
62
+ class Source
63
+ def initialize(opt)
64
+ @opt=opt
65
+ @md=SiSU_Param::Parameters.new(@opt).get
66
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
67
+ @rhost=SiSU_Env::InfoRemote.new(@opt).remote_host_base
68
+ @base_src_dir=@opt.f_pth[:pth].sub(/\/#{@opt.f_pth[:lng]}$/,'')
69
+ @f=SiSU_Env::FileOp.new(@md)
70
+ end
71
+ def read
72
+ songsheet
73
+ end
74
+ def songsheet
75
+ images
76
+ audio
77
+ multimedia
78
+ begin
79
+ rescue
80
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
81
+ __LINE__.to_s + ':' + __FILE__
82
+ end
83
+ ensure
84
+ end
85
+ end
86
+ def images
87
+ src="#{@base_src_dir}/_sisu/image"
88
+ ldest=@env.path.output
89
+ img_dir="#{@env.path.output}/_sisu/image"
90
+ @rhost.each do |remote_conn|
91
+ if (@md.opt.act[:verbose][:set]==:on \
92
+ || @md.opt.act[:verbose_plus][:set]==:on \
93
+ || @md.opt.act[:maintenance][:set]==:on \
94
+ || @md.opt.act[:rsync][:set]==:on) \
95
+ and FileTest.directory?(src)
96
+ FileUtils::mkdir_p(img_dir) unless FileTest.directory?(img_dir)
97
+ src_ec=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/")
98
+ unless @opt.fns =~/\.-sst$/
99
+ SiSU_Env::SystemCall.new(src_ec,ldest,'q').rsync('--relative',@opt.base_path)
100
+ #if @md.opt.selections.str.inspect =~/R/ #rsync to remote image directory
101
+ # SiSU_Env::SystemCall.new(src_ec,remote_rel,'q').rsync('--relative')
102
+ #end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ def audio
108
+ #p @md.ec[:audio]
109
+ src="#{@base_src_dir}/_sisu/mm/audio"
110
+ ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio"
111
+ @rhost.each do |remote_conn|
112
+ rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio"
113
+ if (@md.opt.act[:verbose][:set]==:on \
114
+ || @md.opt.act[:verbose_plus][:set]==:on \
115
+ || @md.opt.act[:maintenance][:set]==:on \
116
+ || @md.opt.act[:rsync][:set]==:on) \
117
+ and FileTest.directory?(src)
118
+ FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest)
119
+ src_ec="#{src}/" + @md.ec[:audio].join(" #{src}/")
120
+ SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync
121
+ if @md.opt.act[:rsync][:set]==:on #rsync to remote audio directory
122
+ SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync
123
+ end
124
+ end
125
+ end
126
+ end
127
+ def multimedia
128
+ #p @md.ec[:multimedia]
129
+ src="#{@base_src_dir}/_sisu/mm/video"
130
+ ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video"
131
+ @rhost.each do |remote_conn|
132
+ rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video"
133
+ if (@md.opt.act[:verbose][:set]==:on \
134
+ || @md.opt.act[:verbose_plus][:set]==:on \
135
+ || @md.opt.act[:maintenance][:set]==:on \
136
+ || @md.opt.act[:rsync][:set]==:on) \
137
+ and FileTest.directory?(src)
138
+ FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest)
139
+ src_ec="#{src}/" + @md.ec[:multimedia].join(" #{src}/")
140
+ SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync
141
+ if @md.opt.act[:rsync][:set]==:on #rsync to remote video directory
142
+ SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
149
+ __END__
@@ -0,0 +1,84 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** system environment, error screen reporting
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/errors.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Errors
58
+ require_relative 'se' # se.rb
59
+ include SiSU_Env; include SiSU_Screen
60
+ class Rescued <CreateFile
61
+ def initialize(error,errorlist,cmd,fns='')
62
+ @fns,@cmd,@error,@errorlist=fns,cmd,error,errorlist
63
+ @cmd=(cmd \
64
+ && (cmd =~/c/)) \
65
+ ? 'Vc'
66
+ : 'V'
67
+ end
68
+ def location
69
+ file=@fns \
70
+ ? (SiSU_Env::CreateFile.new(@fns).file_error)
71
+ : (File.new('/tmp/errorlog.sisu','w+'))
72
+ file << @fns << "\n" << @error << "\n" << @errorlist
73
+ file.close
74
+ if @cmd=~/[vVM]/
75
+ SiSU_Screen::Ansi.new('',$!,$@).rescue do
76
+ (block_given?) ? yield : __LINE__.to_s + ':' + __FILE__
77
+ end
78
+ else
79
+ SiSU_Screen::Ansi.new('',"rescued, exception raised, silenced").puts_grey
80
+ end
81
+ end
82
+ end
83
+ end
84
+ __END__
@@ -0,0 +1,131 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** shared html 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_Generic
58
+ def the_url
59
+ def urify(uri)
60
+ URI.parse(uri)
61
+ end
62
+ def sisu
63
+ 'http://www.sisudoc.org/'
64
+ end
65
+ def sisudoc
66
+ 'http://www.sisudoc.org'
67
+ end
68
+ def footer_signature
69
+ 'http://www.sisudoc.org/'
70
+ end
71
+ def rl_root
72
+ '/sisu' #watch
73
+ end
74
+ def root_http
75
+ 'http://www.sisudoc.org/' #watch
76
+ end
77
+ def home
78
+ 'http://www.sisudoc.org/' # used in pdf header
79
+ end
80
+ def site #used as stub... where there are subdirectories and is different from home
81
+ home
82
+ end
83
+ def home_txt
84
+ 'www.sisudoc.org'
85
+ end
86
+ def sisu_txt
87
+ 'www.sisudoc.org'
88
+ end
89
+ self
90
+ end
91
+ def the_text
92
+ def home
93
+ 'SiSU'
94
+ end
95
+ def txt_hp
96
+ '&nbsp;SiSU'
97
+ end
98
+ def txt_hp_alias
99
+ 'SiSU'
100
+ end
101
+ def txt_home
102
+ 'SiSU'
103
+ end
104
+ def txt_signature # used in latex/pdf footer
105
+ 'SiSU'
106
+ end
107
+ def url_open
108
+ '<'
109
+ end
110
+ def url_close
111
+ '>'
112
+ end
113
+ self
114
+ end
115
+ def the_icon
116
+ def i_ico
117
+ 'rb7.ico'
118
+ end
119
+ def i_home_button
120
+ 'sisu.png'
121
+ end
122
+ def i_choice
123
+ 'b_choice.png'
124
+ end
125
+ def i_new
126
+ 'b_new.png'
127
+ end
128
+ self
129
+ end
130
+ end
131
+ __END__
data/lib/sisu/git.rb ADDED
@@ -0,0 +1,277 @@
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/git.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_Git
58
+ require_relative 'dp' # dp.rb
59
+ require_relative 'se' # se.rb
60
+ require_relative 'ao' # ao.rb
61
+ class Source
62
+ def initialize(opt,process=:complete)
63
+ @opt,@process=opt,process
64
+ @env=SiSU_Env::InfoEnv.new
65
+ @md=SiSU_Param::Parameters.new(@opt).get
66
+ @file=SiSU_Env::FileOp.new(@md)
67
+ l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
68
+ unless @opt.lng==l[:c] # @md.i18n[0]==l[:c]
69
+ p "using: #{@opt.lng} (@make: :language:); filename #{@md.fns} filename language: #{l[:c]}, mismatch"
70
+ end
71
+ if @env.output_dir_structure.multilingual?
72
+ m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss
73
+ fnb,fnt=@opt.fns[m,2],@opt.fns[m,3]
74
+ else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/
75
+ fnb=@fnn=@opt.fns[m,1]
76
+ fnt=@opt.fns[m,2]
77
+ end
78
+ git_path_fnb=@env.processing_path.git + '/' + fnb
79
+ lng=(@md.opt.lng) ? (@md.opt.lng) : (@md.i18n[0])
80
+ @git_path={
81
+ fnb: git_path_fnb,
82
+ doc: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:doc] + '/' + lng,
83
+ po: git_path_fnb + '/' + Gt[:po] + '/' + lng,
84
+ pot: git_path_fnb + '/' + Gt[:pot],
85
+ conf: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:conf],
86
+ image: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:image],
87
+ audio: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:audio],
88
+ video: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:video],
89
+ conf: git_path_fnb + '/' + Gt[:sisupod] + '/' + Gt[:conf]
90
+ }
91
+ SiSU_AO::Source.new(@opt,nil,@process).read # -m
92
+ end
93
+ def create_file_structure_git
94
+ make_dir_fnb
95
+ if program_found?
96
+ git_init
97
+ end
98
+ end
99
+ def read
100
+ create_file_structure_git
101
+ populate.sisusrc_files
102
+ #if program_found?
103
+ # git_commit
104
+ #end
105
+ unless @opt.act[:quiet][:set]==:on
106
+ (@opt.act[:verbose][:set]==:on \
107
+ || @opt.act[:verbose_plus][:set]==:on \
108
+ || @opt.act[:maintenance][:set]==:on) \
109
+ ? SiSU_Screen::Ansi.new(
110
+ @opt.act[:color_state][:set],
111
+ 'Git path',
112
+ @git_path[:fnb]
113
+ ).green_hi_blue
114
+ : SiSU_Screen::Ansi.new(
115
+ @opt.act[:color_state][:set],
116
+ 'Git path',
117
+ @git_path[:fnb]
118
+ ).green_title_hi
119
+ if (@opt.act[:verbose][:set]==:on \
120
+ || @opt.act[:verbose_plus][:set]==:on \
121
+ || @opt.act[:maintenance][:set]==:on)
122
+ SiSU_Screen::Ansi.new(
123
+ @opt.act[:color_state][:set],
124
+ "Git path",
125
+ "#{@opt.fns} -> #{@git_path[:fnb]}"
126
+ ).warn
127
+ end
128
+ end
129
+ end
130
+ def program_found?
131
+ found=`whereis git`
132
+ (found =~/bin\/git\b/) ? true : false
133
+ end
134
+ def make_dir_fnb
135
+ FileUtils::mkdir_p(@git_path[:fnb]) \
136
+ unless FileTest.directory?(@git_path[:fnb])
137
+ FileUtils::mkdir_p(@git_path[:doc]) \
138
+ unless FileTest.directory?(@git_path[:doc])
139
+ FileUtils::mkdir_p(@git_path[:po]) \
140
+ unless FileTest.directory?(@git_path[:po])
141
+ FileUtils::mkdir_p(@git_path[:pot]) \
142
+ unless FileTest.directory?(@git_path[:pot])
143
+ FileUtils::mkdir_p(@git_path[:conf]) \
144
+ unless FileTest.directory?(@git_path[:conf])
145
+ FileUtils::mkdir_p(@git_path[:image]) \
146
+ unless FileTest.directory?(@git_path[:image])
147
+ #FileUtils::mkdir_p(@git_path[:audio]) \
148
+ # unless FileTest.directory?(@git_path[:audio])
149
+ #FileUtils::mkdir_p(@git_path[:video]) \
150
+ # unless FileTest.directory?(@git_path[:video])
151
+ end
152
+ def git_init
153
+ unless FileTest.directory?("#{@git_path[:fnb]}/.git")
154
+ pwd=Dir.pwd
155
+ Dir.chdir(@git_path[:fnb])
156
+ system("git init ")
157
+ Dir.chdir(pwd)
158
+ end
159
+ end
160
+ def git_commit
161
+ if program_found?
162
+ if FileTest.directory?("#{@git_path[:fnb]}")
163
+ pwd=Dir.pwd
164
+ Dir.chdir(@git_path[:fnb])
165
+ system("
166
+ git add . \
167
+ && git commit -a
168
+ ")
169
+ Dir.chdir(pwd)
170
+ end
171
+ end
172
+ end
173
+ def populate
174
+ def identify_language_versions
175
+ print __FILE__ + ':'
176
+ p __LINE__
177
+ end
178
+ def copy_src_head
179
+ if @opt.f_pth[:lng] \
180
+ and File.exist?("#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}")
181
+ FileUtils::cp_r(
182
+ "#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{@opt.fns}",
183
+ @git_path[:doc]
184
+ )
185
+ elsif @opt.fns =~/\.ssm\.sst/
186
+ ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm')
187
+ FileUtils::cp_r(
188
+ "#{@env.path.pwd}/#{ssm}",
189
+ @git_path[:doc]
190
+ )
191
+ elsif File.exist?("#{@env.path.pwd}/#{@opt.fns}")
192
+ FileUtils::cp_r(
193
+ "#{@env.path.pwd}/#{@opt.fns}",
194
+ @git_path[:doc]
195
+ )
196
+ end
197
+ end
198
+ def copy_related_sst_ssi
199
+ doc_import=[]
200
+ @rgx_doc_import=/^<<\s(\S+?\.ss[ti])/
201
+ file_array=IO.readlines(@opt.fns,'')
202
+ file_array.each do |f|
203
+ if f =~@rgx_doc_import
204
+ doc_import = doc_import \
205
+ + f.scan(@rgx_doc_import).uniq.flatten
206
+ end
207
+ end
208
+ doc_import.each do |f|
209
+ if @opt.f_pth[:lng]
210
+ FileUtils::cp_r(
211
+ "#{@env.path.pwd}/#{@opt.f_pth[:lng]}/#{f}",
212
+ @git_path[:doc]
213
+ )
214
+ else
215
+ FileUtils::cp_r(
216
+ "#{@env.path.pwd}/#{f}",
217
+ @git_path[:doc]
218
+ )
219
+ end
220
+ end
221
+ end
222
+ def locate_parse_file
223
+ composite_src=@opt.fns=~/\.ssm$/ ? true : false
224
+ if composite_src \
225
+ and not @opt.act[:ao][:set]==:on
226
+ ##SiSU_Assemble::Composite.new(@opt).read
227
+ #SiSU_AO::Source.new(@opt).read # -m
228
+ @env.processing_path.composite_file \
229
+ + '/' \
230
+ + @opt.fnb \
231
+ + '.ssm.sst'
232
+ elsif composite_src
233
+ @env.processing_path.composite_file \
234
+ + '/' \
235
+ + @opt.fnb \
236
+ + '.ssm.sst'
237
+ else
238
+ @env.path.pwd
239
+ + '/' \
240
+ + @opt.fns
241
+ end
242
+ end
243
+ def read_composite
244
+ #print __FILE__ + ':'
245
+ #p __LINE__
246
+ end
247
+ def sisuyaml_rc
248
+ sisurc=@env.path.sisurc_path
249
+ if FileTest.file?(sisurc)
250
+ FileUtils::cp_r(sisurc,@git_path[:conf])
251
+ end
252
+ end
253
+ def read_src
254
+ print __FILE__ + ':'
255
+ p __LINE__
256
+ end
257
+ def composite_src?
258
+ @opt.fns=~/\.ssm$/ ? true : false
259
+ end
260
+ def sisusrc_files
261
+ populate.copy_src_head
262
+ if composite_src?
263
+ populate.copy_related_sst_ssi
264
+ end
265
+ #parse_file_name=locate_parse_file
266
+ #parse_file=IO.readlines(parse_file_name,'')
267
+ populate.sisuyaml_rc #(parse_file)
268
+ #populate.extract_composite_source
269
+ #populate.read_composite # or read_each_composite
270
+ populate.identify_language_versions
271
+ end
272
+ self
273
+ end
274
+ end
275
+ end
276
+ __END__
277
+ @file.output_path.sisugit