sisu 7.1.7 → 7.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/data/sisu/version.yml +3 -3
  3. data/lib/sisu/air.rb +10 -12
  4. data/lib/sisu/ao.rb +10 -12
  5. data/lib/sisu/ao_appendices.rb +10 -12
  6. data/lib/sisu/ao_character_check.rb +10 -12
  7. data/lib/sisu/ao_composite.rb +10 -12
  8. data/lib/sisu/ao_doc_objects.rb +10 -12
  9. data/lib/sisu/ao_doc_str.rb +10 -12
  10. data/lib/sisu/ao_endnotes.rb +10 -12
  11. data/lib/sisu/ao_expand_insertions.rb +10 -12
  12. data/lib/sisu/ao_hash_digest.rb +10 -12
  13. data/lib/sisu/ao_idx.rb +10 -12
  14. data/lib/sisu/ao_images.rb +10 -12
  15. data/lib/sisu/ao_metadata.rb +10 -12
  16. data/lib/sisu/ao_misc_arrange.rb +10 -12
  17. data/lib/sisu/ao_numbering.rb +10 -12
  18. data/lib/sisu/ao_persist.rb +10 -12
  19. data/lib/sisu/ao_syntax.rb +10 -12
  20. data/lib/sisu/cgi.rb +10 -12
  21. data/lib/sisu/cgi_pgsql.rb +10 -12
  22. data/lib/sisu/cgi_sql_common.rb +16 -18
  23. data/lib/sisu/cgi_sqlite.rb +10 -12
  24. data/lib/sisu/conf.rb +10 -12
  25. data/lib/sisu/constants.rb +12 -13
  26. data/lib/sisu/css.rb +10 -12
  27. data/lib/sisu/db_columns.rb +10 -12
  28. data/lib/sisu/db_create.rb +10 -12
  29. data/lib/sisu/db_dbi.rb +10 -12
  30. data/lib/sisu/db_drop.rb +10 -12
  31. data/lib/sisu/db_import.rb +10 -12
  32. data/lib/sisu/db_indexes.rb +10 -12
  33. data/lib/sisu/db_load_tuple.rb +10 -12
  34. data/lib/sisu/db_remove.rb +10 -12
  35. data/lib/sisu/db_select.rb +10 -12
  36. data/lib/sisu/db_sqltxt.rb +10 -12
  37. data/lib/sisu/db_tests.rb +10 -12
  38. data/lib/sisu/dbi.rb +10 -12
  39. data/lib/sisu/dbi_discrete.rb +10 -12
  40. data/lib/sisu/digests.rb +10 -12
  41. data/lib/sisu/dp.rb +15 -14
  42. data/lib/sisu/dp_identify_markup.rb +10 -12
  43. data/lib/sisu/dp_make.rb +11 -13
  44. data/lib/sisu/embedded.rb +10 -12
  45. data/lib/sisu/errors.rb +10 -12
  46. data/lib/sisu/generic_parts.rb +10 -12
  47. data/lib/sisu/git.rb +10 -12
  48. data/lib/sisu/html.rb +10 -12
  49. data/lib/sisu/html_concordance.rb +10 -12
  50. data/lib/sisu/html_format.rb +10 -12
  51. data/lib/sisu/html_harvest.rb +10 -12
  52. data/lib/sisu/html_harvest_author_format.rb +10 -12
  53. data/lib/sisu/html_harvest_authors.rb +10 -12
  54. data/lib/sisu/html_harvest_topics.rb +10 -12
  55. data/lib/sisu/html_lite_shared.rb +10 -12
  56. data/lib/sisu/html_manifest.rb +10 -12
  57. data/lib/sisu/html_minitoc.rb +10 -12
  58. data/lib/sisu/html_parts.rb +10 -12
  59. data/lib/sisu/html_persist.rb +10 -12
  60. data/lib/sisu/html_promo.rb +10 -12
  61. data/lib/sisu/html_scroll.rb +10 -12
  62. data/lib/sisu/html_segments.rb +10 -12
  63. data/lib/sisu/html_shared.rb +10 -12
  64. data/lib/sisu/html_table.rb +10 -12
  65. data/lib/sisu/html_tune.rb +10 -12
  66. data/lib/sisu/hub.rb +12 -13
  67. data/lib/sisu/hub_actions.rb +26 -12
  68. data/lib/sisu/hub_loop_markup_files.rb +10 -12
  69. data/lib/sisu/hub_options.rb +19 -12
  70. data/lib/sisu/i18n.rb +10 -12
  71. data/lib/sisu/json.rb +415 -0
  72. data/lib/sisu/json_format.rb +478 -0
  73. data/lib/sisu/json_parts.rb +88 -0
  74. data/lib/sisu/json_persist.rb +124 -0
  75. data/lib/sisu/json_shared.rb +681 -0
  76. data/lib/sisu/manpage.rb +11 -13
  77. data/lib/sisu/manpage_format.rb +10 -12
  78. data/lib/sisu/object_munge.rb +10 -12
  79. data/lib/sisu/prog_text_translation.rb +10 -12
  80. data/lib/sisu/qrcode.rb +10 -12
  81. data/lib/sisu/relaxng.rb +16 -18
  82. data/lib/sisu/remote.rb +10 -12
  83. data/lib/sisu/rexml.rb +10 -12
  84. data/lib/sisu/se.rb +10 -12
  85. data/lib/sisu/se_cleanoutput.rb +10 -12
  86. data/lib/sisu/se_clear.rb +10 -12
  87. data/lib/sisu/se_createsite.rb +10 -12
  88. data/lib/sisu/se_css.rb +10 -12
  89. data/lib/sisu/se_date.rb +10 -12
  90. data/lib/sisu/se_db.rb +10 -12
  91. data/lib/sisu/se_envcall.rb +10 -12
  92. data/lib/sisu/se_file_op.rb +69 -12
  93. data/lib/sisu/se_filemap.rb +10 -12
  94. data/lib/sisu/se_get_init.rb +10 -12
  95. data/lib/sisu/se_hub_particulars.rb +10 -12
  96. data/lib/sisu/se_info_env.rb +10 -12
  97. data/lib/sisu/se_info_port.rb +10 -12
  98. data/lib/sisu/se_info_system.rb +10 -12
  99. data/lib/sisu/se_load.rb +10 -12
  100. data/lib/sisu/se_processing.rb +10 -12
  101. data/lib/sisu/se_programs.rb +10 -12
  102. data/lib/sisu/se_remotes.rb +10 -12
  103. data/lib/sisu/se_standardise_lang.rb +10 -12
  104. data/lib/sisu/se_version.rb +10 -12
  105. data/lib/sisu/shared_images.rb +10 -12
  106. data/lib/sisu/shared_markup_alt.rb +10 -12
  107. data/lib/sisu/shared_metadata.rb +22 -12
  108. data/lib/sisu/shared_sem.rb +10 -12
  109. data/lib/sisu/sitemaps.rb +10 -12
  110. data/lib/sisu/src_kdissert_share.rb +10 -12
  111. data/lib/sisu/src_po4a_share.rb +10 -12
  112. data/lib/sisu/src_po4a_shelf.rb +10 -12
  113. data/lib/sisu/src_po4a_shelf_set.rb +10 -12
  114. data/lib/sisu/src_po4a_sst_ao_sst.rb +10 -12
  115. data/lib/sisu/src_po4a_sst_ao_sst_set.rb +10 -12
  116. data/lib/sisu/src_po4a_sstm.rb +10 -12
  117. data/lib/sisu/src_shared.rb +10 -12
  118. data/lib/sisu/src_sisupod_make.rb +10 -12
  119. data/lib/sisu/src_sisupod_sstm.rb +10 -12
  120. data/lib/sisu/sst_convert_markup.rb +10 -12
  121. data/lib/sisu/sst_do_inline_footnotes.rb +10 -12
  122. data/lib/sisu/sst_from_xml.rb +10 -12
  123. data/lib/sisu/sst_identify_markup.rb +10 -12
  124. data/lib/sisu/sst_to_s_xml_sax.rb +10 -12
  125. data/lib/sisu/termsheet.rb +10 -12
  126. data/lib/sisu/texinfo.rb +10 -12
  127. data/lib/sisu/texinfo_format.rb +10 -12
  128. data/lib/sisu/texpdf.rb +10 -12
  129. data/lib/sisu/texpdf_format.rb +10 -12
  130. data/lib/sisu/texpdf_parts.rb +10 -12
  131. data/lib/sisu/txt_asciidoc.rb +10 -12
  132. data/lib/sisu/txt_asciidoc_decorate.rb +10 -12
  133. data/lib/sisu/txt_markdown.rb +10 -12
  134. data/lib/sisu/txt_markdown_decorate.rb +10 -12
  135. data/lib/sisu/txt_orgmode.rb +36 -22
  136. data/lib/sisu/txt_orgmode_decorate.rb +10 -12
  137. data/lib/sisu/txt_output.rb +10 -12
  138. data/lib/sisu/txt_plain.rb +10 -12
  139. data/lib/sisu/txt_plain_decorate.rb +10 -12
  140. data/lib/sisu/txt_read.rb +10 -12
  141. data/lib/sisu/txt_rst.rb +10 -12
  142. data/lib/sisu/txt_rst_decorate.rb +10 -12
  143. data/lib/sisu/txt_shared.rb +10 -12
  144. data/lib/sisu/txt_textile.rb +10 -12
  145. data/lib/sisu/txt_textile_decorate.rb +10 -12
  146. data/lib/sisu/update.rb +10 -12
  147. data/lib/sisu/urls.rb +23 -12
  148. data/lib/sisu/utils.rb +10 -11
  149. data/lib/sisu/utils_composite.rb +10 -12
  150. data/lib/sisu/utils_response.rb +10 -12
  151. data/lib/sisu/utils_screen_text_color.rb +10 -12
  152. data/lib/sisu/utils_spell.rb +10 -12
  153. data/lib/sisu/webrick.rb +10 -12
  154. data/lib/sisu/wikispeak.rb +10 -12
  155. data/lib/sisu/xhtml.rb +10 -12
  156. data/lib/sisu/xhtml_epub2.rb +10 -12
  157. data/lib/sisu/xhtml_epub2_concordance.rb +10 -12
  158. data/lib/sisu/xhtml_epub2_format.rb +10 -12
  159. data/lib/sisu/xhtml_epub2_persist.rb +10 -12
  160. data/lib/sisu/xhtml_epub2_segments.rb +10 -12
  161. data/lib/sisu/xhtml_epub2_tune.rb +10 -12
  162. data/lib/sisu/xhtml_parts.rb +10 -12
  163. data/lib/sisu/xhtml_shared.rb +10 -12
  164. data/lib/sisu/xhtml_table.rb +10 -12
  165. data/lib/sisu/xml_docbook5.rb +10 -12
  166. data/lib/sisu/xml_dom.rb +10 -12
  167. data/lib/sisu/xml_fictionbook2.rb +10 -12
  168. data/lib/sisu/xml_format.rb +10 -12
  169. data/lib/sisu/xml_md_oai_pmh_dc.rb +10 -12
  170. data/lib/sisu/xml_odf_odt.rb +10 -12
  171. data/lib/sisu/xml_odf_odt_format.rb +10 -12
  172. data/lib/sisu/xml_parts.rb +10 -12
  173. data/lib/sisu/xml_persist.rb +10 -12
  174. data/lib/sisu/xml_sax.rb +10 -12
  175. data/lib/sisu/xml_scaffold_structure_collapsed.rb +10 -12
  176. data/lib/sisu/xml_scaffold_structure_sisu.rb +10 -12
  177. data/lib/sisu/xml_shared.rb +10 -12
  178. data/lib/sisu/xml_tables.rb +10 -12
  179. data/lib/sisu/zap.rb +10 -12
  180. metadata +9 -4
@@ -0,0 +1,88 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** shared xml parts
8
+
9
+ ** Author: Ralph Amissah
10
+ [ralph@amissah.com]
11
+ [ralph.amissah@gmail.com]
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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
+ ** SiSU uses:
42
+ * Standard SiSU markup syntax,
43
+ * Standard SiSU meta-markup syntax, and the
44
+ * Standard SiSU object citation numbering and system
45
+
46
+ ** Hompages:
47
+ [http://www.jus.uio.no/sisu]
48
+ [http://www.sisudoc.org]
49
+
50
+ ** Git
51
+ [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary]
52
+ [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/json_parts.rb;hb=HEAD]
53
+
54
+ =end
55
+ module SiSU_Parts_JSON
56
+ require_relative 'generic_parts' # generic_parts.rb
57
+ include SiSU_Parts_Generic
58
+ def the_line_break
59
+ '<br>'
60
+ end
61
+ def the_table_close
62
+ '</td></tr>
63
+ </table>'
64
+ end
65
+ def the_url_decoration
66
+ def xml_open #'&lt;'
67
+ Dx[:url_o]
68
+ end
69
+ def xml_close #'&gt;'
70
+ Dx[:url_c]
71
+ end
72
+ def txt_open
73
+ '['
74
+ end
75
+ def txt_close
76
+ ']'
77
+ end
78
+ self
79
+ end
80
+ end
81
+ module SiSU_Proj_XML
82
+ require_relative 'html_parts' # html_parts.rb
83
+ require_relative 'se' # se.rb
84
+ include SiSU_Env
85
+ class Bits < SiSU_Proj_HTML::Bits
86
+ end
87
+ end
88
+ __END__
@@ -0,0 +1,124 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** html segment generation, processing
8
+
9
+ ** Author: Ralph Amissah
10
+ [ralph@amissah.com]
11
+ [ralph.amissah@gmail.com]
12
+
13
+ ** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
14
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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
+ ** SiSU uses:
42
+ * Standard SiSU markup syntax,
43
+ * Standard SiSU meta-markup syntax, and the
44
+ * Standard SiSU object citation numbering and system
45
+
46
+ ** Hompages:
47
+ [http://www.jus.uio.no/sisu]
48
+ [http://www.sisudoc.org]
49
+
50
+ ** Git
51
+ [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary]
52
+ [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/json_persist.rb;hb=HEAD]
53
+
54
+ =end
55
+ module SiSU_JSON_Persist
56
+ class Persist
57
+ @@persist=nil
58
+ attr_accessor :head,:toc,:body,:tail,:open,:close,:sc,:endnotes,:book_idx,:metadata
59
+ #attr_accessor :head,:body,:tail,:open,:close,:sc
60
+ #@@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] }
61
+ def initialize(args=nil)
62
+ @@persist=args=(args ? args : (@@persist || persist_init_hash_values))
63
+ @head=args[:head]
64
+ @toc=args[:toc]
65
+ @body=args[:body]
66
+ @tail=args[:tail]
67
+ @open=args[:open]
68
+ @close=args[:close]
69
+ @sc=args[:sc]
70
+ @endnotes=args[:endnotes]
71
+ @book_idx=args[:book_idx]
72
+ @metadata=args[:metadata]
73
+ end
74
+ def head
75
+ @head
76
+ end
77
+ def toc
78
+ @toc
79
+ end
80
+ def body
81
+ @body
82
+ end
83
+ def tail
84
+ @tail
85
+ end
86
+ def open
87
+ @open
88
+ end
89
+ def close
90
+ @close
91
+ end
92
+ def sc
93
+ @sc
94
+ end
95
+ def endnotes
96
+ @endnotes
97
+ end
98
+ def book_idx
99
+ @book_idx
100
+ end
101
+ def metadata
102
+ @metadata
103
+ end
104
+ def persist_init_hash_values
105
+ {
106
+ head: [],
107
+ toc: [],
108
+ body: [],
109
+ tail: [],
110
+ open: [],
111
+ close: [],
112
+ sc: [],
113
+ endnotes: [],
114
+ book_idx: [],
115
+ metadata: [],
116
+ }
117
+ end
118
+ def persist_init
119
+ @@persist=nil
120
+ Persist.new(persist_init_hash_values)
121
+ end
122
+ end
123
+ end
124
+ __END__
@@ -0,0 +1,681 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** Description: json output logic, flow
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, 2016 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
+ ** SiSU uses:
42
+ * Standard SiSU markup syntax,
43
+ * Standard SiSU meta-markup syntax, and the
44
+ * Standard SiSU object citation numbering and system
45
+
46
+ ** Hompages:
47
+ [http://www.jus.uio.no/sisu]
48
+ [http://www.sisudoc.org]
49
+
50
+ ** Git
51
+ [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary]
52
+ [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/json_shared.rb;hb=HEAD]
53
+
54
+ =end
55
+ module SiSU_JSONutils
56
+ require_relative 'generic_parts' # generic_parts.rb
57
+ class Clean
58
+ def initialize(para='')
59
+ @para=para
60
+ #@para,@n_char_max,@n_indent,@post,=para,n_char_max,n_indent,post
61
+ #@n_char_max_extend = n_char_max
62
+ #@n_hang=n_hang ? n_hang : @n_indent
63
+ end
64
+ def line_json_clean
65
+ @para=@para.gsub(/<br>/,' \\ ').
66
+ gsub(/#{Mx[:br_nl]}/,"\n\n").
67
+ gsub(/"/,'\"').
68
+ gsub(/'/,"\\\\'")
69
+ @para
70
+ end
71
+ end
72
+ end
73
+ module SiSU_JSON_Munge
74
+ require_relative 'json_parts' # json_parts.rb
75
+ class Trans
76
+ include SiSU_Parts_JSON
77
+ def initialize(md)
78
+ @md=md
79
+ @sys=SiSU_Env::SystemCall.new
80
+ @dir=SiSU_Env::InfoEnv.new(@md.fns)
81
+ if @md.sem_tag
82
+ @ab ||=semantic_tags.default
83
+ end
84
+ end
85
+ def semantic_tags
86
+ def default
87
+ {
88
+ pub: 'publication',
89
+ conv: 'convention',
90
+ vol: 'volume',
91
+ pg: 'page',
92
+ cty: 'city',
93
+ org: 'organization',
94
+ uni: 'university',
95
+ dept: 'department',
96
+ fac: 'faculty',
97
+ inst: 'institute',
98
+ co: 'company',
99
+ com: 'company',
100
+ conv: 'convention',
101
+ dt: 'date',
102
+ y: 'year',
103
+ m: 'month',
104
+ d: 'day',
105
+ ti: 'title',
106
+ au: 'author',
107
+ ed: 'editor', #editor?
108
+ v: 'version', #edition
109
+ n: 'name',
110
+ fn: 'firstname',
111
+ mn: 'middlename',
112
+ ln: 'lastname',
113
+ in: 'initials',
114
+ qt: 'quote',
115
+ ct: 'cite',
116
+ ref: 'reference',
117
+ ab: 'abreviation',
118
+ def: 'define',
119
+ desc: 'description',
120
+ trans: 'translate',
121
+ }
122
+ end
123
+ self
124
+ end
125
+ def char_enc #character encode
126
+ def utf8(dob='')
127
+ if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
128
+ str=if defined? dob.obj then dob.obj
129
+ elsif dob.is_a?(String) then dob
130
+ end
131
+ if str
132
+ #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
133
+ #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
134
+ str=str.gsub(/</um,'&#60;'). # '&lt;' # &#060;
135
+ gsub(/>/um,'&#62;'). # '&gt;' # &#062;
136
+ gsub(/¢/um,'&#162;'). # '&cent;' # &#162;
137
+ gsub(/£/um,'&#163;'). # '&pound;' # &#163;
138
+ gsub(/¥/um,'&#165;'). # '&yen;' # &#165;
139
+ gsub(/§/um,'&#167;'). # '&sect;' # &#167;
140
+ gsub(/©/um,'&#169;'). # '&copy;' # &#169;
141
+ gsub(/ª/um,'&#170;'). # '&ordf;' # &#170;
142
+ gsub(/«/um,'&#171;'). # '&laquo;' # &#171;
143
+ gsub(/®/um,'&#174;'). # '&reg;' # &#174;
144
+ gsub(/°/um,'&#176;'). # '&deg;' # &#176;
145
+ gsub(/±/um,'&#177;'). # '&plusmn;' # &#177;
146
+ gsub(/²/um,'&#178;'). # '&sup2;' # &#178;
147
+ gsub(/³/um,'&#179;'). # '&sup3;' # &#179;
148
+ gsub(/µ/um,'&#181;'). # '&micro;' # &#181;
149
+ gsub(/¶/um,'&#182;'). # '&para;' # &#182;
150
+ gsub(/¹/um,'&#185;'). # '&sup1;' # &#185;
151
+ gsub(/º/um,'&#186;'). # '&ordm;' # &#186;
152
+ gsub(/»/um,'&#187;'). # '&raquo;' # &#187;
153
+ gsub(/¼/um,'&#188;'). # '&frac14;' # &#188;
154
+ gsub(/½/um,'&#189;'). # '&frac12;' # &#189;
155
+ gsub(/¾/um,'&#190;'). # '&frac34;' # &#190;
156
+ gsub(/×/um,'&#215;'). # '&times;' # &#215;
157
+ gsub(/÷/um,'&#247;'). # '&divide;' # &#247;
158
+ gsub(/¿/um,'&#191;'). # '&iquest;' # &#191;
159
+ gsub(/À/um,'&#192;'). # '&Agrave;' # &#192;
160
+ gsub(/Á/um,'&#193;'). # '&Aacute;' # &#193;
161
+ gsub(/Â/um,'&#194;'). # '&Acirc;' # &#194;
162
+ gsub(/Ã/um,'&#195;'). # '&Atilde;' # &#195;
163
+ gsub(/Ä/um,'&#196;'). # '&Auml;' # &#196;
164
+ gsub(/Å/um,'&#197;'). # '&Aring;' # &#197;
165
+ gsub(/Æ/um,'&#198;'). # '&AElig;' # &#198;
166
+ gsub(/Ç/um,'&#199;'). # '&Ccedil;' # &#199;
167
+ gsub(/È/um,'&#200;'). # '&Egrave;' # &#200;
168
+ gsub(/É/um,'&#201;'). # '&Eacute;' # &#201;
169
+ gsub(/Ê/um,'&#202;'). # '&Ecirc;' # &#202;
170
+ gsub(/Ë/um,'&#203;'). # '&Euml;' # &#203;
171
+ gsub(/Ì/um,'&#204;'). # '&Igrave;' # &#204;
172
+ gsub(/Í/um,'&#205;'). # '&Iacute;' # &#205;
173
+ gsub(/Î/um,'&#206;'). # '&Icirc;' # &#206;
174
+ gsub(/Ï/um,'&#207;'). # '&Iuml;' # &#207;
175
+ gsub(/Ð/um,'&#208;'). # '&ETH;' # &#208;
176
+ gsub(/Ñ/um,'&#209;'). # '&Ntilde;' # &#209;
177
+ gsub(/Ò/um,'&#210;'). # '&Ograve;' # &#210;
178
+ gsub(/Ó/um,'&#211;'). # '&Oacute;' # &#211;
179
+ gsub(/Ô/um,'&#212;'). # '&Ocirc;' # &#212;
180
+ gsub(/Õ/um,'&#213;'). # '&Otilde;' # &#213;
181
+ gsub(/Ö/um,'&#214;'). # '&Ouml;' # &#214;
182
+ gsub(/Ø/um,'&#216;'). # '&Oslash;' # &#216;
183
+ gsub(/Ù/um,'&#217;'). # '&Ugrave;' # &#217;
184
+ gsub(/Ú/um,'&#218;'). # '&Uacute;' # &#218;
185
+ gsub(/Û/um,'&#219;'). # '&Ucirc;' # &#219;
186
+ gsub(/Ü/um,'&#220;'). # '&Uuml;' # &#220;
187
+ gsub(/Ý/um,'&#221;'). # '&Yacute;' # &#221;
188
+ gsub(/Þ/um,'&#222;'). # '&THORN;' # &#222;
189
+ gsub(/ß/um,'&#223;'). # '&szlig;' # &#223;
190
+ gsub(/à/um,'&#224;'). # '&agrave;' # &#224;
191
+ gsub(/á/um,'&#225;'). # '&aacute;' # &#225;
192
+ gsub(/â/um,'&#226;'). # '&acirc;' # &#226;
193
+ gsub(/ã/um,'&#227;'). # '&atilde;' # &#227;
194
+ gsub(/ä/um,'&#228;'). # '&auml;' # &#228;
195
+ gsub(/å/um,'&#229;'). # '&aring;' # &#229;
196
+ gsub(/æ/um,'&#230;'). # '&aelig;' # &#230;
197
+ gsub(/ç/um,'&#231;'). # '&ccedil;' # &#231;
198
+ gsub(/è/um,'&#232;'). # '&egrave;' # &#232;
199
+ gsub(/é/um,'&#233;'). # '&acute;' # &#233;
200
+ gsub(/ê/um,'&#234;'). # '&circ;' # &#234;
201
+ gsub(/ë/um,'&#235;'). # '&euml;' # &#235;
202
+ gsub(/ì/um,'&#236;'). # '&igrave;' # &#236;
203
+ gsub(/í/um,'&#237;'). # '&acute;' # &#237;
204
+ gsub(/î/um,'&#238;'). # '&icirc;' # &#238;
205
+ gsub(/ï/um,'&#239;'). # '&iuml;' # &#239;
206
+ gsub(/ð/um,'&#240;'). # '&eth;' # &#240;
207
+ gsub(/ñ/um,'&#241;'). # '&ntilde;' # &#241;
208
+ gsub(/ò/um,'&#242;'). # '&ograve;' # &#242;
209
+ gsub(/ó/um,'&#243;'). # '&oacute;' # &#243;
210
+ gsub(/ô/um,'&#244;'). # '&ocirc;' # &#244;
211
+ gsub(/õ/um,'&#245;'). # '&otilde;' # &#245;
212
+ gsub(/ö/um,'&#246;'). # '&ouml;' # &#246;
213
+ gsub(/ø/um,'&#248;'). # '&oslash;' # &#248;
214
+ gsub(/ù/um,'&#250;'). # '&ugrave;' # &#250;
215
+ gsub(/ú/um,'&#251;'). # '&uacute;' # &#251;
216
+ gsub(/û/um,'&#252;'). # '&ucirc;' # &#252;
217
+ gsub(/ü/um,'&#253;'). # '&uuml;' # &#253;
218
+ gsub(/þ/um,'&#254;'). # '&thorn;' # &#254;
219
+ gsub(/ÿ/um,'&#255;'). # '&yuml;' # &#255;
220
+ gsub(/‘/um,'&#8216;'). # '&lsquo;' # &#8216;
221
+ gsub(/’/um,'&#8217;'). # '&rsquo;' # &#8217;
222
+ gsub(/“/um,'&#8220;'). # &ldquo; # &#8220;
223
+ gsub(/”/um,'&#8221;'). # &rdquo; # &#8221;
224
+ gsub(/–/um,'&#8211;'). # &ndash; # &#8211;
225
+ gsub(/—/um,'&#8212;'). # &mdash; # &#8212;
226
+ gsub(/∝/um,'&#8733;'). # &prop; # &#8733;
227
+ gsub(/∞/um,'&#8734;'). # &infin; # &#8734;
228
+ gsub(/™/um,'&#8482;'). # &trade; # &#8482;
229
+ gsub(/✠/um,'&#10016;'). # &cross; # &#10016;
230
+ gsub(/ /um,' '). # space identify
231
+ gsub(/ /um,' ') # space identify
232
+ end
233
+ dob=if defined? dob.obj
234
+ dob.obj=str
235
+ dob
236
+ elsif dob.is_a?(String)
237
+ str
238
+ end
239
+ dob
240
+ end
241
+ end
242
+ def html(dob='')
243
+ if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
244
+ dob.obj=dob.obj.gsub(/ /u,' '). # space identify
245
+ gsub(/ /u,' ') # space identify
246
+ end
247
+ end
248
+ self
249
+ end
250
+ def tidywords(wordlist)
251
+ wordlist_new=[]
252
+ wordlist.each do |x|
253
+ #imperfect solution will not catch all possible cases
254
+ x=x.gsub(/&/,'&amp;') unless x =~/&\S+;/
255
+ x=x.gsub(/&([A-Z])/,'&amp;\1')
256
+ wordlist_new << x
257
+ end
258
+ wordlist_new
259
+ end
260
+ def markup(dob='')
261
+ wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
262
+ dob.obj=tidywords(wordlist).join(' ').strip
263
+ unless dob.is==:table
264
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/u,'<br>').
265
+ gsub(/#{Mx[:br_paragraph]}/u,'<br>').
266
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>')
267
+ end
268
+ dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'').
269
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
270
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;').
271
+ gsub(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1&lt; ').gsub(/\s+>(\s+|$)/,' &gt;\1').
272
+ #gsub(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>'). #reinstate
273
+ gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>').
274
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>').
275
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
276
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
277
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
278
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
279
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
280
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
281
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>').
282
+ gsub(/<:pb>\s*/,''). #Fix
283
+ gsub(/<+[-~]#>+/,'')
284
+ if dob.is !=:code
285
+ #embeds a red-bullet image -->
286
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
287
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
288
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
289
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>')
290
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>') unless dob.is==:table
291
+ dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,'').
292
+ gsub(/#{Mx[:br_page_new]}\s*/,'').
293
+ gsub(/#{Mx[:br_page_line]}\s*/,'').
294
+ gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,'').
295
+ gsub(/<[-~]#>/,'').
296
+ gsub(/href="#{Xx[:segment]}/m,'href="').
297
+ gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/,
298
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>').
299
+ gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/,
300
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="../\2">\1</link>').
301
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/,
302
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="#\2">\1</link>').
303
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
304
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
305
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
306
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
307
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
308
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}).
309
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/,
310
+ %{<image xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:actuate="onLoad" xl:show="embed" xl:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}).
311
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
312
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>'). #watch, compare html_tune
313
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
314
+ %{#{the_url_decoration.xml_open}<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\\1">\\1</link>#{the_url_decoration.xml_close}}).
315
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
316
+ '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\1">\1</link>') #escaped urls not linked, deal with later
317
+ else
318
+ dob.obj=dob.obj.gsub(/</m,'&lt;').gsub(/>/m,'&gt;')
319
+ end
320
+ if dob.of==:block
321
+ dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')
322
+ end
323
+ dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
324
+ %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}).
325
+ gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}").
326
+ gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}").
327
+ gsub(/&nbsp;|#{Mx[:nbsp]}/m,'&#160;').
328
+ gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\1') # pattern not to match
329
+ dob
330
+ end
331
+ def markup_light(dob='')
332
+ dob.obj=dob.obj.gsub(/\/\{(.+?)\}\//,'<i>\1</i>').
333
+ gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>').
334
+ gsub(/_\{(.+?)\}_/,'<u>\1</u>').
335
+ gsub(/-\{(.+?)\}-/,'<del>\1</del>').
336
+ gsub(/<br(\s*\/)?>/,'<br>').
337
+ gsub(/<:pb>\s*/,'').
338
+ gsub(/<[-~]#>/,'').
339
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
340
+ gsub(/&([^;]{1,5})/,'&amp;\1'). #sort, rough estimate, revisit #WATCH found in node not sax
341
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
342
+ "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>").
343
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;').
344
+ gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\1') # pattern not to match
345
+ wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
346
+ dob.obj=tidywords(wordlist).join(' ').strip
347
+ dob
348
+ end
349
+ def clean(str)
350
+ str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;').
351
+ gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;')
352
+ end
353
+ def markup_fictionbook(str='',is='')
354
+ str=str.gsub(/#{Mx[:en_a_o]}([\d+*]+).+?#{Mx[:en_a_c]}/m,'<a xl:href="#footnote\1" type="note">[\1]</a>').
355
+ gsub(/&/,'&amp;'). #sort
356
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
357
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
358
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
359
+ str=str.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>') unless is==:table
360
+ str=str.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
361
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
362
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
363
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
364
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
365
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
366
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
367
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
368
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
369
+ gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,'<image xl:href="#\1" />').
370
+ gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}").
371
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
372
+ gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
373
+ gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
374
+ gsub(/<(p|br)>/,'<\1 />')
375
+ clean(str)
376
+ end
377
+ def markup_docbook(dob='') # work on, initially a copy of fictionbook!
378
+ if dob.is !=:code
379
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s*(.+?)#{Mx[:en_a_c]}/m,'<footnote><para><!-- fn\1 -->\2</para></footnote>').
380
+ gsub(/\\\\/,'</para><para>').
381
+ gsub(/&/,'&amp;'). #sort
382
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
383
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
384
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
385
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>') unless dob.is==:table
386
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
387
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
388
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
389
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
390
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
391
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
392
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
393
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
394
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
395
+ gsub(/#{Mx[:lnk_o]}\s*(\S+?)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,
396
+ %{#{Xx[:split]}:spaces0:<figure id="fig-\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="../../_sisu/image/\\1.\\2" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). # common image location, else use ./images
397
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,
398
+ '<ulink url="\2">\1</ulink>').
399
+ gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,
400
+ '<ulink url="\1">\1</ulink>').
401
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
402
+ gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
403
+ gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
404
+ gsub(/<(p|br)>/,'<\1 />')
405
+ dob.obj=clean(dob.obj)
406
+ elsif dob.is == :code
407
+ dob.obj=dob.obj.gsub(/&/m,'&amp;'). #sort
408
+ gsub(/</,'&lt;').gsub(/>/,'&gt;')
409
+ else # p dob.is ??
410
+ end
411
+ dob
412
+ end
413
+ def markup_group(dob='')
414
+ dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
415
+ gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br>').
416
+ gsub(/&lt;(link xmlns:xl=".+?")&gt;/,'<\1>').
417
+ gsub(/&lt;(\/link)&gt;/,'<\1>').
418
+ gsub(/&lt;(\/?en)&gt;/,'<\1>')
419
+ dob
420
+ end
421
+ def markup_block(dob='')
422
+ dob.obj=dob.obj.gsub(/</,'&lt;').gsub(/>/,'&gt;').
423
+ gsub(/&lt;:?br(?:\s+\/)?&gt;/,'<br>').
424
+ gsub(/&lt;(link xmlns:xl=".+?")&gt;/,'<\1>').
425
+ gsub(/&lt;(\/link)&gt;/,'<\1>').
426
+ gsub(/&lt;(\/?en)&gt;/,'<\1>')
427
+ dob
428
+ end
429
+ def xml_sem_block_paired(matched) # colon depth: many, recurs
430
+ matched=matched.gsub(/\b(au):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}).
431
+ gsub(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}).
432
+ gsub(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}).
433
+ gsub(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}).
434
+ gsub(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}).
435
+ gsub(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}).
436
+ gsub(/\b(ct):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}).
437
+ gsub(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}).
438
+ gsub(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}).
439
+ gsub(/\b(dt):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}).
440
+ gsub(/\b(n):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}).
441
+ gsub(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>')
442
+ end
443
+ def xml_semantic_tags(dob)
444
+ if @md.sem_tag
445
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
446
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
447
+ dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }
448
+ dob.obj=dob.obj.gsub(/:\{(.+?)\}:au\b/m, %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}).
449
+ gsub(/:\{(.+?)\}:n\b/m, %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}).
450
+ gsub(/:\{(.+?)\}:ti\b/m, %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}).
451
+ gsub(/:\{(.+?)\}:ref\b/m, %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}).
452
+ gsub(/:\{(.+?)\}:desc\b/m, %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}).
453
+ gsub(/:\{(.+?)\}:cty\b/m, %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}).
454
+ gsub(/:\{(.+?)\}:org\b/m, %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}).
455
+ gsub(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>').
456
+ gsub(/;\{([^}]+(?![;]))\};ti\b/m, %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}).
457
+ gsub(/;\{([^}]+(?![;]))\};qt\b/m, %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}).
458
+ gsub(/;\{([^}]+(?![;]))\};ref\b/m, %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}).
459
+ gsub(/;\{([^}]+(?![;]))\};ed\b/m, %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}).
460
+ gsub(/;\{([^}]+(?![;]))\};v\b/m, %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}).
461
+ gsub(/;\{([^}]+(?![;]))\};desc\b/m, %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}).
462
+ gsub(/;\{([^}]+(?![;]))\};def\b/m, %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}).
463
+ gsub(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}).
464
+ gsub(/;\{([^}]+(?![;]))\};y\b/m, %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}).
465
+ gsub(/;\{([^}]+(?![;]))\};ab\b/m, %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}).
466
+ gsub(/;\{([^}]+(?![;]))\};pg\b/m, %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}).
467
+ gsub(/;\{([^}]+(?![;]))\};fn?\b/m, %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}).
468
+ gsub(/;\{([^}]+(?![;]))\};mn?\b/m, %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}).
469
+ gsub(/;\{([^}]+(?![;]))\};ln?\b/m, %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}).
470
+ gsub(/;\{([^}]+(?![;]))\};in\b/m, %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}).
471
+ gsub(/;\{([^}]+(?![;]))\};uni\b/m, %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}).
472
+ gsub(/;\{([^}]+(?![;]))\};fac\b/m, %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}).
473
+ gsub(/;\{([^}]+(?![;]))\};inst\b/m, %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}).
474
+ gsub(/;\{([^}]+(?![;]))\};dept\b/m, %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}).
475
+ gsub(/;\{([^}]+(?![;]))\};org\b/m, %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}).
476
+ gsub(/;\{([^}]+(?![;]))\};com?\b/m, %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}).
477
+ gsub(/;\{([^}]+(?![;]))\};cty\b/m, %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}).
478
+ gsub(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>')
479
+ end
480
+ dob
481
+ end
482
+ end
483
+ end
484
+ module SiSU_XML_Tags #Format
485
+ require_relative 'dp' # dp.rb
486
+ include SiSU_Param
487
+ class RDF
488
+ include SiSU_Parts_JSON
489
+ def initialize(md='',seg_name=[],tracker=0)
490
+ @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords=''
491
+ @md=md
492
+ @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n}
493
+ if defined? @md.title.full \
494
+ and @md.title.full # DublinCore 1 - title
495
+ @rdf_title=%{ dc.title="#{seg_name}#{@md.title.full}"\n}
496
+ @full_title=%{ <meta name="dc.title" content="#{@md.title.full}" />\n}
497
+ end
498
+ if defined? @md.creator.author \
499
+ and @md.creator.author=~/\S+/ # DublinCore 2 - creator/author (author)
500
+ @rdf_author=%{ dc.author="#{@md.creator.author}"\n}
501
+ content=meta_content_clean(@md.creator.author)
502
+ @author=%{ <meta name="dc.author" content="#{content}" />\n}
503
+ end
504
+ if defined? @md.publisher \
505
+ and @md.publisher # DublinCore 5 - publisher (current copy published by)
506
+ @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n}
507
+ content=meta_content_clean(@md.publisher)
508
+ @publisher=%{ <meta name="dc.publisher" content="#{content}" />\n}
509
+ end
510
+ if defined? @md.creator.contributor \
511
+ and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor
512
+ @rdf_contributor=%{ dc.contributor="#{@md.creator.contributor}"\n}
513
+ content=meta_content_clean(@md.creator.contributor)
514
+ @contributor=%{ <meta name="dc.contributor" content="#{content}" />\n}
515
+ end
516
+ if defined? @md.date.published \
517
+ and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd
518
+ @rdf_date=%{ dc.date="#{@md.date.published}"\n}
519
+ @date=%{ <meta name="dc.date" content="#{@md.date.published}" #{@md.date_scheme} />\n} # fix @md.date_scheme
520
+ end
521
+ if defined? @md.date.created \
522
+ and @md.date.created=~/\S+/ # DublinCore 7 - date.created year-mm-dd
523
+ @rdf_date_created=%{ dc.date.created="#{@md.date.created}"\n}
524
+ @date_created=%{ <meta name="dc.date.created" content="#{@md.date.created}" #{@md.date_scheme} />\n}
525
+ end
526
+ if defined? @md.date.issued \
527
+ and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued year-mm-dd
528
+ @rdf_date_issued=%{ dc.date.issued="#{@md.date.issued}"\n}
529
+ @date_issued=%{ <meta name="dc.date.issued" content="#{@md.date.issued}" #{@md.date_scheme} />\n}
530
+ end
531
+ if defined? @md.date.available \
532
+ and @md.date.available=~/\S+/ # DublinCore 7 - date.available year-mm-dd
533
+ @rdf_date_available=%{ dc.date.available="#{@md.date.available}"\n}
534
+ @date_available=%{ <meta name="dc.date.available" content="#{@md.date.available}" #{@md.date_scheme} />\n}
535
+ end
536
+ if defined? @md.date.valid \
537
+ and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid year-mm-dd
538
+ @rdf_date_valid=%{ dc.date.valid="#{@md.date.valid}"\n}
539
+ @date_valid=%{ <meta name="dc.date.valid" content="#{@md.date.valid}" #{@md.date_scheme} />\n}
540
+ end
541
+ if defined? @md.date.modified \
542
+ and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified year-mm-dd
543
+ @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n}
544
+ @date_modified=%{ <meta name="dc.date.modified" content="#{@md.date.modified}" #{@md.date_scheme} />\n}
545
+ end
546
+ if defined? @md.rights.all \
547
+ and @md.rights.all # DublinCore 15 - rights
548
+ @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n}
549
+ content=meta_content_clean(@md.rights.all)
550
+ @rights=%{ <meta name="dc.rights" content="#{content}" />\n}
551
+ end
552
+ if defined? @md.classify.subject \
553
+ and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???)
554
+ @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n}
555
+ content=meta_content_clean(@md.classify.subject)
556
+ @subject=%{ <meta name="dc.subject" content="#{content}" />\n}
557
+ end
558
+ if defined? @md.notes.description \
559
+ and @md.notes.description=~/\S+/ # DublinCore 4 - description
560
+ @rdf_description=%{ dc.description="#{@md.notes.description}"\n}
561
+ content=meta_content_clean(@md.notes.description)
562
+ @description=%{ <meta name="dc.description" content="#{content}" />\n}
563
+ end
564
+ if defined? @md.notes.coverage \
565
+ and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage
566
+ @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n}
567
+ content=meta_content_clean(@md.notes.coverage)
568
+ @coverage=%{ <meta name="dc.coverage" content="#{content}" />\n}
569
+ end
570
+ if defined? @md.notes.relation \
571
+ and @md.notes.relation=~/\S+/ # DublinCore 13 - relation
572
+ @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n}
573
+ content=meta_content_clean(@md.notes.relation)
574
+ @relation=%{ <meta name="dc.relation" content="#{content}" />\n}
575
+ end
576
+ if defined? @md.notes.type \
577
+ and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc)
578
+ @rdf_type=%{ dc.type="#{@md.notes.type}"\n}
579
+ content=meta_content_clean(@md.notes.type)
580
+ @type=%{ <meta name="dc.type" content="#{content}" />\n}
581
+ end
582
+ if defined? @md.notes.format \
583
+ and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type)
584
+ @rdf_format=%{ dc.format="#{@md.notes.format}"\n}
585
+ content=meta_content_clean(@md.notes.format)
586
+ @format=%{ <meta name="dc.format" content="#{content}" />\n}
587
+ end
588
+ #if defined? @md.identifier.sisupod \
589
+ #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free)
590
+ # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n}
591
+ # content=meta_content_clean(@md.identifier.sisupod)
592
+ # @identifier=%{ <meta name="dc.identifier" content="#{content}" />\n}
593
+ #end
594
+ if defined? @md.original.source \
595
+ and @md.original.source=~/\S+/ # DublinCore 11 - source (document source)
596
+ @rdf_source=%{ dc.source="#{@md.original.source}"\n}
597
+ content=meta_content_clean(@md.original.source)
598
+ @source=%{ <meta name="dc.source" content="#{content}" />\n}
599
+ end
600
+ if defined? @md.title.language \
601
+ and @md.title.language=~/\S+/ # DublinCore 12 - language (English)
602
+ @rdf_language=%{ dc.language="#{@md.title.language}"\n}
603
+ @language=%{ <meta name="dc.language" content="#{@md.title.language}" />\n}
604
+ end
605
+ if defined? @md.original.language \
606
+ and @md.original.language=~/\S+/
607
+ @rdf_language_original=%{ dc.language="#{@md.original.language}"\n}
608
+ @language_original=%{ <meta name="dc.language" content="#{@md.original.language}" />\n}
609
+ end
610
+ content=meta_content_clean(@md.keywords)
611
+ @keywords=%{ <meta name="keywords" content="#{content}" />\n} if @md.keywords
612
+ end
613
+ def meta_content_clean(content='')
614
+ content=if not content.nil?
615
+ content=content.tr('"',"'").
616
+ gsub(/&/,'&amp;')
617
+ content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
618
+ else content
619
+ end
620
+ end
621
+ def rdfseg #segHead
622
+ rdftoc
623
+ end
624
+ def comment_xml(extra='')
625
+ generator="Generated by: #{@md.project_details.project} #{@md.project_details.version} of #{@md.project_details.date_stamp} (#{@md.project_details.date})" if @md.project_details.version
626
+ lastdone="Last Generated on: #{Time.now}"
627
+ rubyv="Ruby version: #{@md.ruby_version}"
628
+ sc=if @md.sc_info
629
+ "Source file: #{@md.sc_filename} version: #{@md.sc_number} of: #{@md.sc_date}"
630
+ else ''
631
+ end
632
+ if extra.empty?
633
+ <<WOK
634
+ <!-- Document processing information:
635
+ * #{generator}
636
+ * #{rubyv}
637
+ * #{sc}
638
+ * #{lastdone}
639
+ * SiSU http://www.jus.uio.no/sisu
640
+ -->
641
+ WOK
642
+ else
643
+ <<WOK
644
+ <!-- Document processing information:
645
+ * #{extra}
646
+ * #{generator}
647
+ * #{rubyv}
648
+ * #{sc}
649
+ * #{lastdone}
650
+ * SiSU http://www.jus.uio.no/sisu
651
+ -->
652
+ WOK
653
+ end
654
+ end
655
+ def comment_xml_sax
656
+ desc='SiSU XML, SAX type representation'
657
+ comment_xml(desc)
658
+ end
659
+ def comment_xml_node
660
+ desc='SiSU XML, Node type representation'
661
+ comment_xml(desc)
662
+ end
663
+ def comment_xml_dom
664
+ desc='SiSU XML, DOM type representation'
665
+ comment_xml(desc)
666
+ end
667
+ def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better
668
+ <<WOK
669
+ #{@full_title}#{@subtitle}#{@author}#{@subject}#{@description}#{@publisher}#{@contributor}#{@date}#{@date_created}#{@date_issued}#{@date_available}#{@date_valid}#{@date_modified}#{@type}#{@format}#{@identifier}#{@source}#{@language}#{@relation}#{@coverage}#{@rights}#{@copyright}#{@owner}
670
+ #{SiSU_Proj_XML::Bits.new.txt_generator}
671
+ #{the_png.ico}
672
+ WOK
673
+ end
674
+ end
675
+ end
676
+ module SiSU_JSON_Shared
677
+ require_relative 'xhtml_table' # xhtml_table.rb
678
+ class TableJSON < SiSU_XHTML_Table::TableXHTML
679
+ end
680
+ end
681
+ __END__