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,62 @@
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/xhtml_shared.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_XHTML_Shared
58
+ require_relative 'xhtml_table' # xhtml_table.rb
59
+ class TableXHTML < SiSU_XHTML_Table::TableXHTML
60
+ end
61
+ end
62
+ __END__
@@ -0,0 +1,97 @@
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/xhtml_table.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_XHTML_Table
58
+ require_relative 'xhtml_parts' # xhtml_parts.rb
59
+ class TableXHTML
60
+ include SiSU_Parts_XHTML
61
+ @@tablefoot=[] #watch
62
+ def initialize(table)
63
+ @table_obj=table
64
+ end
65
+ def table
66
+ table_obj=@table_obj
67
+ if table_obj.obj !~/^<table\s/m
68
+ table_obj=table_rows_and_columns_array(table_obj)
69
+ else p __LINE__; p caller
70
+ end
71
+ table_obj
72
+ end
73
+ def table_rows_and_columns_array(table_obj) # provides basic (x)html table
74
+ table_rows,nr=[],0
75
+ table_obj.obj.split(Mx[:tc_c]).each do |table_row|
76
+ table_row_with_columns=table_row.split(Mx[:tc_p])
77
+ trc,nc=[],0
78
+ table_row_with_columns.each do |c|
79
+ c=c.gsub(/^~$/,''). # tilde / empty cell
80
+ gsub(/<:br>/,the_line_break)
81
+ trc <<= if table_obj.head_ and nr==0; %{<th width="#{table_obj.widths[nc]}%">#{c}</th>}
82
+ else %{<td width="#{table_obj.widths[nc]}%">#{c}</td>}
83
+ end
84
+ nc+=1
85
+ end
86
+ trc=(trc.is_a?(Array)) ? trc.flatten.join : trc
87
+ trc=" <tr>#{trc}</tr>\n"
88
+ nr+=1
89
+ table_rows << trc
90
+ end
91
+ table_rows=table_rows.flatten.join
92
+ table_obj.obj=%{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">\n#{table_rows} </table>}
93
+ table_obj
94
+ end
95
+ end
96
+ end
97
+ __END__
@@ -0,0 +1,376 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** Docbook book XML rendition
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_docbook_book.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_XML_Docbook_Book
58
+ require_relative 'se_hub_particulars' # se_hub_particulars.rb
59
+ include SiSU_Particulars
60
+ require_relative 'ao' # ao.rb
61
+ require_relative 'se' # se.rb
62
+ include SiSU_Env
63
+ require_relative 'txt_shared' # txt_shared.rb
64
+ include SiSU_TextUtils
65
+ require_relative 'xml_shared' # xml_shared.rb
66
+ include SiSU_XML_Munge
67
+ require_relative 'shared_metadata' # shared_metadata.rb
68
+ class Source
69
+ def initialize(opt)
70
+ @opt=opt
71
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
72
+ end
73
+ def read
74
+ begin
75
+ @md,@ao_array=@particulars.md,@particulars.ao_array
76
+ @env=@particulars.env
77
+ report
78
+ SiSU_XML_Docbook_Book::Source::Scroll.new(@ao_array,@md).songsheet
79
+ rescue
80
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
81
+ __LINE__.to_s + ':' + __FILE__
82
+ end
83
+ ensure
84
+ #SiSU_Env::CreateSite.new(@opt.selections.str).cp_css
85
+ #SiSU_Env::CreateSite.new(@opt.selections.str).cp_base_images
86
+ Dir.chdir(@opt.f_pth[:pth])
87
+ end
88
+ end
89
+ private
90
+ def report
91
+ unless @opt.act[:quiet][:set]==:on
92
+ tool=(@opt.act[:verbose][:set]==:on \
93
+ || @opt.act[:verbose_plus][:set]==:on \
94
+ || @opt.act[:maintenance][:set]==:on) \
95
+ ? "#{@env.program.docbook_viewer} #{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}"
96
+ : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
97
+ (@opt.act[:verbose][:set]==:on \
98
+ || @opt.act[:verbose_plus][:set]==:on \
99
+ || @opt.act[:maintenance][:set]==:on) \
100
+ ? SiSU_Screen::Ansi.new(
101
+ @opt.act[:color_state][:set],
102
+ 'DocBook',
103
+ tool
104
+ ).green_hi_blue
105
+ : SiSU_Screen::Ansi.new(
106
+ @opt.act[:color_state][:set],
107
+ 'DocBook',
108
+ tool
109
+ ).green_title_hi
110
+ if (@opt.act[:verbose_plus][:set]==:on \
111
+ || @opt.act[:maintenance][:set]==:on)
112
+ SiSU_Screen::Ansi.new(
113
+ @opt.act[:color_state][:set],
114
+ @opt.fns,
115
+ "#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}"
116
+ ).flow
117
+ end
118
+ end
119
+ end
120
+ class Scroll <Source
121
+ def initialize(data='',md='')
122
+ @data,@md=data,md
123
+ @trans=SiSU_XML_Munge::Trans.new(md)
124
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(md.opt)
125
+ @env=@particulars.env
126
+ @make ||=SiSU_Env::ProcessingSettings.new(md)
127
+ end
128
+ def songsheet
129
+ @t='sisu'
130
+ data=@data
131
+ if @md.opt.act[:verbose_plus][:set]==:on
132
+ structure_collapsed(data)
133
+ end
134
+ #head
135
+ #extract_endnotes
136
+ data=markup_text(data)
137
+ structure_build_collapsed(data)
138
+ document_images if @md.ec[:image] and @md.ec[:image].length > 0
139
+ #tail
140
+ end
141
+ def document_images
142
+ img_pth={
143
+ src: @md.opt.image_src_path,
144
+ dest: @md.env.path.webserv + '/_sisu/image',
145
+ }
146
+ unless FileTest.directory?(img_pth[:dest])
147
+ #mkdir?
148
+ end
149
+ if FileTest.directory?(img_pth[:dest])
150
+ @md.ec[:image].each do |x|
151
+ img={
152
+ src: "#{img_pth[:src]}/#{x}",
153
+ dest: "#{img_pth[:dest]}/#{x}",
154
+ }
155
+ if FileTest.file?(img[:src])
156
+ FileUtils::cp(img[:src],img[:dest])
157
+ else p "Not Found: #{img[:src]}/#{x}"
158
+ end
159
+ end
160
+ end
161
+ end
162
+ def spaces
163
+ Ax[:spaces]
164
+ end
165
+ def tags
166
+ # collapsed -->
167
+ def collapsed
168
+ %w[ 0 1 2 3 4 5 ]
169
+ end
170
+ def docbook_tag(lc,chlv='')
171
+ case lc
172
+ when 0 then 'book'
173
+ when 1 then lc==chlv ? 'chapter' : 'section'
174
+ when 2 then lc==chlv ? 'chapter' : 'section'
175
+ when 3 then lc==chlv ? 'chapter' : 'section'
176
+ when 4 then 'section'
177
+ when 5 then 'section'
178
+ when 6 then 'section'
179
+ end
180
+ end
181
+ self
182
+ end
183
+ def put(line)
184
+ #@file_docbook.puts line #look into and use perhaps
185
+ puts line if @md.opt.act[:verbose_plus][:set]==:on
186
+ end
187
+ def head
188
+ rdf=SiSU_XML_Tags::RDF.new(@md)
189
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_docbook').stylesheet
190
+ <<-WOK
191
+ <?xml version="1.0" encoding="utf-8"?>
192
+ #{stylesheet.css_head_xml}
193
+ #{rdf.comment_xml}
194
+ <book xmlns="http://docbook.org/ns/docbook"
195
+ xmlns:xl="http://www.w3.org/1999/xlink"
196
+ version="5.0">
197
+ WOK
198
+ end
199
+ def markup_text(data)
200
+ data.each_with_index do |o,i|
201
+ if o.is ==:heading \
202
+ || o.is ==:para \
203
+ || o.of ==:block \
204
+ || o.is ==:open_close_tags
205
+ o=@trans.markup_docbook(o) #unless o.obj==nil
206
+ end
207
+ end
208
+ data
209
+ end
210
+ def tail
211
+ tail=<<-WOK
212
+ </book>
213
+ WOK
214
+ put(tail)
215
+ end
216
+ def output(o,comment='')
217
+ puts o.lc == (0..6) \
218
+ ? "#{spaces*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
219
+ : "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
220
+ end
221
+ def structure_collapsed(data)
222
+ puts "\ncollapsed structure, heading outline --->\n\n"
223
+ data.each_with_index do |o,i|
224
+ if (o.is ==:heading || o.is ==:heading_insert)
225
+ output(o)
226
+ end
227
+ end
228
+ end
229
+ #def chapterlevel
230
+ #end
231
+ def xml_head
232
+ [
233
+ '<docinfo>',
234
+ SiSU_Metadata::Summary.new(@md).xml_docbook.metadata,
235
+ '</docinfo>'
236
+ ].flatten
237
+ end
238
+ def code_output(o,ocn,filename_docbook)
239
+ filename_docbook.puts o.obj.gsub(/\n?(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\n?/m,"\n")
240
+ end
241
+ def adjust_output(o,ocn,filename_docbook,splv)
242
+ if o.obj =~/#{Xx[:split]}/
243
+ outs=o.obj.split(/#{Xx[:split]}/)
244
+ outs.each do |out|
245
+ if out =~/<figure id=/m
246
+ out=out.gsub(/:spaces0:/m,
247
+ %{#{spaces*(splv)}#{spaces}}).
248
+ gsub(/:spaces1:/m,
249
+ %{#{spaces*(splv)}#{spaces*2}})
250
+ filename_docbook.puts out
251
+ filename_docbook.puts "#{spaces*3}#{ocn}"
252
+ else
253
+ unless out.empty?
254
+ filename_docbook.puts SiSU_TextUtils::Wrap.new(out,80,(splv*2+2),nil).line_wrap
255
+ filename_docbook.puts "#{spaces*3}#{ocn}"
256
+ end
257
+ end
258
+ end
259
+ else
260
+ filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(splv*2+2),nil,ocn).line_wrap
261
+ end
262
+ end
263
+ def structure_build_collapsed(data)
264
+ #output_file=@md.file.output_path.xml_docbook_book.dir + '/' + @md.file.base_filename.xml_docbook_book
265
+ file=SiSU_Env::FileOp.new(@md)
266
+ filename_docbook=file.write_file.xml_docbook_book
267
+ h=0
268
+ @chlv=chlv=0
269
+ doc_position=:head
270
+ filename_docbook.puts head
271
+ filename_docbook.puts xml_head
272
+ data.each_with_index do |o,i|
273
+ if (defined? o.ocn and not o.ocn.nil?)
274
+ ocn=(@make.build.ocn?) \
275
+ ? "<!-- o#{o.ocn} -->"
276
+ : ''
277
+ id=%{ id="o#{o.ocn}" }
278
+ else
279
+ ocn,id='',''
280
+ end
281
+ if (o.is ==:heading || o.is ==:heading_insert)
282
+ chlv=(o.lv.to_i == 1) \
283
+ ? @chlv=o.lc.to_i
284
+ : 0
285
+ @splv=o.lc
286
+ tag_id=o.tags[0] ? %{ id="#{o.tags[0]}" } : ''
287
+ if doc_position ==:head
288
+ filename_docbook.puts %{#{spaces*o.lc}<title#{id}>}
289
+ doc_position=:body_and_tail
290
+ else
291
+ filename_docbook.puts structure_build_tag_close(o.lc,h)
292
+ filename_docbook.puts %{#{spaces*(o.lc)}<#{tags.docbook_tag(o.lc,chlv)}#{tag_id}>
293
+ #{spaces*o.lc}<title#{id}>
294
+ }
295
+ end
296
+ adjust_output(o,ocn,filename_docbook,@splv)
297
+ filename_docbook.puts %{#{spaces*o.lc}</title>}
298
+ h=o.lc
299
+ elsif o.of ==:layout \
300
+ and o.is ==:open_close_tags
301
+ xml_tag=case o.sym
302
+ when :quote_open then '<blockquote>'
303
+ when :quote_close then '</blockquote>'
304
+ else ''
305
+ end
306
+ unless xml_tag.empty?
307
+ filename_docbook.puts "#{spaces*(@splv)}#{xml_tag}"
308
+ end
309
+ elsif o.of ==:block
310
+ if o.is ==:table
311
+ filename_docbook.puts SiSU_Tables::TableXMLdocbook.new(o,id).table.obj
312
+ elsif o.is ==:code
313
+ filename_docbook.puts "#{spaces*(@splv)}<para#{id}>"
314
+ filename_docbook.puts "#{spaces*(@splv+1)}<programlisting>"
315
+ code_output(o,ocn,filename_docbook)
316
+ filename_docbook.puts "#{spaces*(@splv+1)}</programlisting>"
317
+ filename_docbook.puts "#{spaces*(@splv)}</para>"
318
+ else
319
+ filename_docbook.puts "#{spaces*(@splv)}<para#{id}>"
320
+ adjust_output(o,ocn,filename_docbook,@splv)
321
+ filename_docbook.puts "#{spaces*(@splv)}</para>"
322
+ end
323
+ elsif o.of ==:para
324
+ filename_docbook.puts "#{spaces*(@splv)}<para#{id}>"
325
+ adjust_output(o,ocn,filename_docbook,@splv)
326
+ filename_docbook.puts "#{spaces*(@splv)}</para>"
327
+ end
328
+ end
329
+ filename_docbook.puts structure_build_tag_close(0,h)
330
+ filename_docbook.close
331
+ end
332
+ def structure_build_tag_close(lc,h)
333
+ x=[]
334
+ case h
335
+ when 0
336
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
337
+ when 1
338
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
339
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
340
+ when 2
341
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
342
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
343
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
344
+ when 3
345
+ x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
346
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
347
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
348
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
349
+ when 4
350
+ x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4)
351
+ x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
352
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
353
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
354
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
355
+ when 5
356
+ x << "#{spaces*5}</#{tags.docbook_tag(5)}>" if (lc <= 5)
357
+ x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4)
358
+ x << "#{spaces*5}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
359
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
360
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
361
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
362
+ when 6
363
+ x << "#{spaces*6}</#{tags.docbook_tag(6)}>" if (lc <= 6)
364
+ x << "#{spaces*5}</#{tags.docbook_tag(5)}>" if (lc <= 5)
365
+ x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4)
366
+ x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
367
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
368
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
369
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
370
+ end
371
+ x.join("\n")
372
+ end
373
+ end
374
+ end
375
+ end
376
+ __END__