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,640 @@
1
+ # encoding: utf-8
2
+ =begin
3
+
4
+ * Name: SiSU
5
+
6
+ ** Description: documents, structuring, processing, publishing, search
7
+ *** Syntax for markup, input markup syntaxes, determined here
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/ao_syntax.rb;hb=HEAD>
55
+
56
+ =end
57
+ module SiSU_AO_Syntax
58
+ class Words
59
+ def initialize(line,md,mkp)
60
+ @line,@md,@mkp=line,md,mkp
61
+ end
62
+ end
63
+ class Markup
64
+ def initialize(md='',data='',biblio=[])
65
+ @md,@data,@bibliography=md,data,biblio
66
+ @data_new=[]
67
+ url_and_stub=SiSU_Env::InfoEnv.new.url
68
+ @output_url="#{url_and_stub.remote}"
69
+ @env=SiSU_Env::InfoEnv.new
70
+ emph_set=if defined? @md.emphasis_set_to \
71
+ and not @md.emphasis_set_to.nil?
72
+ @md.emphasis_set_to
73
+ else @env.markup_emphasis
74
+ end
75
+ @emph=case emph_set
76
+ when /bold/
77
+ emph_italics=false
78
+ { o: Mx[:fa_bold_o], c: Mx[:fa_bold_c] }
79
+ when /italics/
80
+ emph_italics=true
81
+ { o: Mx[:fa_italics_o], c: Mx[:fa_italics_c] }
82
+ when /underscore/
83
+ emph_italics=false
84
+ { o: Mx[:fa_underscore_o], c: Mx[:fa_underscore_c] }
85
+ else p __LINE__.to_s + '::' + __FILE__
86
+ end
87
+ @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
88
+ @manmkp_ital=emph_italics \
89
+ ? '[i/*]\\{.+?\\}[i/*]'
90
+ : '[i/]\\{.+?\\}[i/]'
91
+ tail_m_ital=%q{(?:\s|'s\b|[.,;:?!'")]|~\^|~\\\{\s|$)}
92
+ tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|'s\b|[.,;:?!'")]|~\^|~\\\{\s|$))?}
93
+ bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
94
+ #ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} #not implemented
95
+ @line_scan_ital=if defined? @md.italics_match_list[:str]
96
+ /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i
97
+ end
98
+ @manmkp_bold=emph_italics \
99
+ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]'
100
+ : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]'
101
+ @line_scan_bold=if defined? @md.bold_match_list[:str] \
102
+ and @md.bold_match_list[:str]
103
+ /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i
104
+ end
105
+ end
106
+ def songsheet
107
+ @data=@data.compact
108
+ @data.each do |dob|
109
+ dob=breaks(dob)
110
+ dob=if @md.sem_tag then sem(dob) else dob end #revisit
111
+ dob=line_actions(dob)
112
+ dob=paragraph_set(dob)
113
+ dob=substitutions(dob)
114
+ dob=wordlist_italics(dob)
115
+ dob=wordlist_bold(dob)
116
+ dob=bodymarkup(dob)
117
+ @data_new << dob unless dob.nil?
118
+ end
119
+ @data_new
120
+ end
121
+ def sem(dob) #revisit
122
+ dob=SiSU_Sem::Tags.new(dob,@md).rm.all
123
+ end
124
+ def breaks(dob)
125
+ if dob.is !=:meta \
126
+ && dob.is !=:comment \
127
+ && dob.is !=:code \
128
+ && dob.is !=:table
129
+ dob.obj=dob.obj.
130
+ gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}").
131
+ gsub(/^=\\\\=\s*$/,"#{Mx[:br_page_new]}").
132
+ gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}").
133
+ gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated
134
+ gsub(/(?:<:?pn>)/,"#{Mx[:br_page_new]}"). # depreciated
135
+ gsub(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}"). # depreciated
136
+ gsub(/(?:^-\.\.-\s*$)/,"#{Mx[:br_page_line]}")
137
+ end
138
+ dob
139
+ end
140
+ def wordlist_italics(dob)
141
+ dob=dob.dup
142
+ if (defined? @md.italics_match_list[:str] \
143
+ and @md.italics_match_list[:str])
144
+ dob.obj=if dob.is !=:meta \
145
+ && dob.is !=:heading \
146
+ && dob.is !=:heading_insert \
147
+ && dob.is !=:code \
148
+ && dob.is !=:layout \
149
+ && dob.is !=:comment
150
+ word=dob.obj.scan(@line_scan_ital)
151
+ word=word.flatten.compact
152
+ line_array=[]
153
+ word.each do |w|
154
+ unless /#{@manmkp_ital}|#{@http_m}/.match(w)
155
+ if defined? @md.italics_match_list[:regx] \
156
+ and @md.italics_match_list[:regx]
157
+ w=w.gsub(@md.italics_match_list[:regx],
158
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
159
+ else w
160
+ end
161
+ end
162
+ line_array << w
163
+ end
164
+ line_array.join(' ')
165
+ else dob.obj
166
+ end
167
+ end
168
+ dob
169
+ end
170
+ def embolden(given)
171
+ given=given.
172
+ gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
173
+ "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2").
174
+ gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/,
175
+ "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}").
176
+ gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
177
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
178
+ gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
179
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
180
+ gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,
181
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2").
182
+ gsub(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,
183
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
184
+ end
185
+ def italicise(given)
186
+ given=given.
187
+ gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/,
188
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
189
+ gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/,
190
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
191
+ gsub(/^\/_\s*(.+?)\s*([~-]#)$/,
192
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2").
193
+ gsub(/^\/_\s+(.*)?\s*$/,
194
+ "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
195
+ end
196
+ def line_actions(dob)
197
+ dob.obj=if (dob.is !=:heading \
198
+ && dob.is !=:heading_insert \
199
+ && dob.is !=:comment \
200
+ && dob.is !=:meta) \
201
+ and dob.obj =~ /^!_\s+/
202
+ embolden(dob.obj)
203
+ elsif dob.obj =~ /^\/_\s+/
204
+ italicise(dob.obj)
205
+ else dob.obj
206
+ end
207
+ dob
208
+ end
209
+ def paragraph_set(dob)
210
+ dob.obj=if dob.is !=:meta \
211
+ && dob.is !=:heading \
212
+ && dob.is !=:heading_insert \
213
+ && dob.is !=:code \
214
+ && dob.is !=:comment \
215
+ && dob.is !=:table
216
+ dob.obj.gsub(/\n/m,' ').
217
+ gsub(/ \s+/m,' ')
218
+ else dob.obj
219
+ end
220
+ dob
221
+ end
222
+ def substitutions(dob)
223
+ dob=dob.dup
224
+ dob=if @md.flag_auto_biblio \
225
+ and @bibliography.length > 0
226
+ dob=if dob.is !=:meta \
227
+ && dob.is !=:heading_insert \
228
+ && dob.is !=:code \
229
+ && dob.is !=:comment \
230
+ && dob.is !=:table
231
+ @bibliography.each do |c|
232
+ if c[:id] and not c[:id].nil? and not c[:id].empty?
233
+ dob.obj=dob.obj.gsub(/#{c[:id]}/mi,c[:short_name])
234
+ end
235
+ end
236
+ dob
237
+ else dob
238
+ end
239
+ dob
240
+ else dob
241
+ end
242
+ dob=if defined? @md.substitution_match_list[:match_and_replace] \
243
+ and @md.substitution_match_list[:match_and_replace].is_a?(Array)
244
+ dob=if dob.is !=:meta \
245
+ && dob.is !=:heading_insert \
246
+ && dob.is !=:code \
247
+ && dob.is !=:comment \
248
+ && dob.is !=:table
249
+ if dob.obj =~/#{@md.substitution_match_list[:matches]}/
250
+ @md.substitution_match_list[:match_and_replace].each do |x|
251
+ dob.obj=if x[:case_s]==:i
252
+ dob.obj.gsub(/#{x[:match]}/mi,x[:replace])
253
+ else
254
+ dob.obj.gsub(/#{x[:match]}/m,x[:replace])
255
+ end
256
+ end
257
+ end
258
+ dob
259
+ else dob
260
+ end
261
+ dob
262
+ else dob
263
+ end
264
+ end
265
+ def wordlist_bold(dob)
266
+ dob=dob.dup
267
+ if (defined? @md.bold_match_list[:str] \
268
+ and @md.bold_match_list[:str])
269
+ dob.obj=if dob.is !=:meta \
270
+ && dob.is !=:heading \
271
+ && dob.is !=:heading_insert \
272
+ && dob.is !=:code \
273
+ && dob.is !=:comment \
274
+ && dob.is !=:table
275
+ line_array=[]
276
+ word=dob.obj.scan(@line_scan_bold)
277
+ word=word.flatten.compact
278
+ word.each do |w|
279
+ unless /#{@manmkp_bold}|#{@http_m}/.match(w)
280
+ if defined? @md.bold_match_list[:regx] \
281
+ and @md.bold_match_list[:regx] #document header: @bold: [bold word list]
282
+ w=w.gsub(@md.bold_match_list[:regx],
283
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
284
+ end
285
+ else
286
+ w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
287
+ embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
288
+ elsif w =~/^\/_\s+/
289
+ italicise(w)
290
+ else w
291
+ end
292
+ end
293
+ line_array << w
294
+ end
295
+ line_array.join(' ')
296
+ else dob.obj
297
+ end
298
+ else
299
+ dob.obj=if dob.is==:heading \
300
+ and dob.ln.to_s =~/[7-9]/
301
+ embolden(dob.obj)
302
+ else dob.obj
303
+ end
304
+ end
305
+ dob
306
+ end
307
+ def fontface_lines(dob,leader)
308
+ while (dob.obj =~/#{Mx[:br_nl]}/ \
309
+ and dob.obj =~/(?:#{leader})([*!\/_#])\{(.+?)\}\1/m) \
310
+ and $2 =~/#{Mx[:br_nl]}/
311
+ dob=if dob.obj =~/#{Mx[:br_nl]}/ \
312
+ and dob.obj =~/(#{leader})([*!\/_#])\{(.+?)\}\2/m
313
+ lead,fce,txt=$1,$2,$3
314
+ dob=if txt =~/#{Mx[:br_nl]}/
315
+ lead_break=if dob.obj =~/^#{Mx[:br_nl]}/
316
+ dob.obj=dob.obj.sub(/^#{Mx[:br_nl]}/,'')
317
+ Mx[:br_nl]
318
+ else ''
319
+ end
320
+ txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}"
321
+ dob.obj=dob.obj.
322
+ sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,
323
+ "#{lead}#{txt}")
324
+ dob
325
+ else dob
326
+ end
327
+ end
328
+ dob
329
+ end
330
+ dob
331
+ end
332
+ def fontface(dob)
333
+ leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。「‹«¿¡]|\>/
334
+ dob=fontface_lines(dob,leader)
335
+ dob.obj=dob.obj.
336
+ gsub(/(#{leader})\*\{(.+?)\}\*/m,
337
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
338
+ gsub(/(#{leader})!\{(.+?)\}!/m,
339
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
340
+ gsub(/(#{leader})\/\{(.+?)\}\//m,
341
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
342
+ gsub(/(#{leader})_\{(.+?)\}_/m,
343
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
344
+ gsub(/(#{leader})#\{(.+?)\}#/m,
345
+ "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace
346
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}]|\(|\>)\"\{(.+?)\}\"/m,
347
+ "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote?
348
+ gsub(/(^|[^\\])\^\{(.+?)\}\^/m,
349
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #superscript
350
+ gsub(/(^|[^\\]),\{(.+?)\},/m,
351
+ "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). #subscript
352
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m,
353
+ "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). #inserted text
354
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m,
355
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). #strikethrough - deleted text
356
+ gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,
357
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
358
+ dob
359
+ end
360
+ def bodymarkup(dob)
361
+ # << http://www.jus.uio.no/sisu/sisu_markup_table/markup >>
362
+ # See: data/sisu/sample/document_samples_sisu_markup/
363
+ ## fontface
364
+ # *{emphasis}* e{emphasis}e <strong>emphasis</strong>
365
+ # !{bold text}! b{bold}b <b>bold text</b>
366
+ # _{underline}_ u{underline}u <u>underline</u>
367
+ # /{italics}/ i{italics}i <i>italics</i>
368
+ # "{citation}" c{citation}c <cite>citation</cite> #blockquote?
369
+ # ^{superscript}^ <sup>superscript</sup>
370
+ # ,{subscript}, <sub>subscript</sub>
371
+ # +{inserted text}+ <ins>inserted text</ins>
372
+ # -{deleted text}- <del>deleted text</del>
373
+ # #{monospace text}#
374
+ #
375
+ # {url address}:url
376
+ # {image.png}imageurl
377
+ # {image.png}png
378
+ # ~{endnote}~
379
+ # !_ #bold/emphasise paragraph
380
+ # _" #blockquote paragraph
381
+ # _1 <:i1> #indent paragraph 1 step
382
+ # _2 <:i2> #indent paragraph 2 steps
383
+ # _3 <:i3> #indent paragraph 3 steps
384
+ # _4 <:i4> #indent paragraph 4 steps
385
+ # _* #bullet (list) ●
386
+ # _1* #bullet (list) indented
387
+ # _1* #bullet (list) indented
388
+ # # #numbered (list) level 1
389
+ # _# #numbered (list) level 2
390
+ dob=dob.dup
391
+ if dob.is !=:meta \
392
+ && dob.is !=:comment \
393
+ && dob.is !=:code \
394
+ && dob.is !=:table
395
+ line_array=[]
396
+ word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
397
+ if word
398
+ word.each do |w| # _ - / # | : ! ^ ~
399
+ unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!!
400
+ w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
401
+ end
402
+ w=w.gsub(/^\<$/,
403
+ "#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
404
+ line_array << w
405
+ end
406
+ dob.obj=line_array.join(' ')
407
+ dob.obj=dob.obj.strip
408
+ end
409
+ dob.obj=dob.obj.
410
+ gsub(/^([*#.-]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators
411
+ gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]).
412
+ gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify
413
+ gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])
414
+ if dob.is ==:heading \
415
+ and dob.ln ==0
416
+ dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}")
417
+ dob.obj=if defined? @md.creator.author \
418
+ and @md.creator.author
419
+ dob.obj.gsub(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}")
420
+ else dob.obj.gsub(/\s+(?:@creator|@author)/,'')
421
+ end
422
+ end
423
+ if defined? @md.title \
424
+ and @md.title \
425
+ and defined? @md.title.full \
426
+ and defined? @md.creator \
427
+ and @md.creator
428
+ if dob.is ==:heading
429
+ dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/
430
+ dob.obj=if dob.lv =~/[23]/ \
431
+ and defined? @md.creator.author \
432
+ and @md.creator.author
433
+ dob.obj.
434
+ gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,
435
+ "\\1#{@md.creator.author}")
436
+ else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1')
437
+ end
438
+ end
439
+ end
440
+ dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup
441
+ gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image').
442
+ gsub(/<!(\S+)!>/,'<:\1>'). #escaped special character
443
+ gsub(/&nbsp;/,"#{Mx[:nbsp]}"). #escaped special character
444
+ gsub(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}"). #escaped special character
445
+ gsub(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}"). #escaped special character
446
+ gsub(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}"). #escaped special character
447
+ gsub(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
448
+ gsub(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
449
+ gsub(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character
450
+ gsub(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character
451
+ gsub(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}"). #escaped special character
452
+ gsub(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}"). #escaped special character
453
+ gsub(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}"). #escaped special character
454
+ gsub(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}"). #escaped special character
455
+ gsub(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}"). #escaped special character
456
+ gsub(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}"). #&amp; #escaped special character
457
+ gsub(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
458
+ gsub(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
459
+ gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
460
+ gsub(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
461
+ gsub(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}"). #not really a sisu special character but made available as possibility
462
+ gsub(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}"). #escaped special character
463
+ gsub(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}"). #escaped special character
464
+ gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character
465
+ if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m
466
+ if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m
467
+ dob.obj=dob.obj.
468
+ gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,
469
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch
470
+ end
471
+ if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m
472
+ dob.obj=dob.obj.
473
+ gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
474
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ")
475
+ end
476
+ dob.obj=dob.obj.
477
+ gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
478
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline)
479
+ gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
480
+ %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}).
481
+ gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
482
+ %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}).
483
+ gsub(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
484
+ %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}).
485
+ gsub(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
486
+ %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2})
487
+ end
488
+ if dob.obj=~/_(?:https?|ftp):\S+/m # _http://url #CHECK
489
+ dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,
490
+ %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3})
491
+ end
492
+ dob=fontface(dob)
493
+ dob.obj=dob.obj.
494
+ gsub(/<[:e]\s+(.+?)!?>/,
495
+ "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested
496
+ gsub(/(^|#{Mx[:br_nl]})\s*_\*\s*/,
497
+ "\\1#{Mx[:gl_bullet]}"). #bullets, shortcut
498
+ gsub(/=\{(.+?)\}/,
499
+ "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}").
500
+ gsub(/^\s*_([1-9])\*\s*/,
501
+ "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}"). #bullets, shortcut
502
+ gsub(/^\s*_([1-9])\s+/,
503
+ "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}"). #indent
504
+ gsub(/^\s*_([1-9])!\s+(.+?)\s*$/,
505
+ "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #indent bold
506
+ gsub(/^\s*__([1-9])\s+/,
507
+ "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}"). #hang
508
+ gsub(/^\s*__([1-9])!\s+(.+?)\s*$/,
509
+ "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} "). #hangdef
510
+ gsub(/^\s*_([0-9])_([0-9])\s+/,
511
+ "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}"). #hang
512
+ gsub(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/,
513
+ "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} "). #hangdef
514
+ gsub(/<:hi>/,"#{Mx[:fa_hilite_o]}"). #'<span style="background-color: rgb(255,240,196)">'). # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
515
+ gsub(/<:\/hi>/,"#{Mx[:fa_hilite_c]}"). #'</span>').
516
+ gsub(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n").
517
+ gsub(/[ ]+($)/,'\1').
518
+ gsub(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
519
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3"). #any remaining linked text or image
520
+ gsub(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/,
521
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image
522
+ gsub(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}").
523
+ gsub(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
524
+ "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4"). #any remaining linked text or image
525
+ gsub(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/,
526
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3"). #any remaining linked text or image, check need
527
+ gsub(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/,
528
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need
529
+ gsub(/\{\s*(.+?)\s*\}(image)/,
530
+ "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
531
+ elsif dob.is==:table
532
+ dob=fontface(dob)
533
+ elsif dob.is ==:code
534
+ dob.obj=dob.obj.
535
+ gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ').
536
+ gsub(/(^|#{Mx[:gl_c]}|\s)&lt;(?:br(?: \/)?)&gt;([\s,.]|$)/,'\1<br>\2') #convert <br> <br /> back, clumsy
537
+ if dob.number_
538
+ codeline=[]
539
+ ln=1
540
+ dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|<br(?: \/)?>|\n/).each_with_index do |cl,i|
541
+ unless i == 0
542
+ cl=cl.gsub(Mx[:br_nl],'')
543
+ w=3-ln.to_s.length
544
+ cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{cl}#{Mx[:br_nl]}"
545
+ ln +=1
546
+ end
547
+ codeline << cl
548
+ end
549
+ codeline= codeline.join("")
550
+ dob.obj=codeline
551
+ else
552
+ dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n")
553
+ end
554
+ dob
555
+ else # @\S+?:
556
+ end
557
+ dob
558
+ end
559
+ def tech #script markup planned to be more strict for technical documents
560
+ # *{emphasis}* e{emphasis}e <strong>emphasis</strong>
561
+ # !{bold text}! b{bold}b <b>bold text</b>
562
+ # _{underline}_ u{underline}u <u>underline</u>
563
+ # /{italics}/ i{italics}i <i>italics</i>
564
+ # "{citation}" c{citation}c <cite>citation</cite>
565
+ # ^{superscript}^ <sup>superscript</sup>
566
+ # ,{subscript}, <sub>subscript</sub>
567
+ # +{inserted text}+ <ins>inserted text</ins>
568
+ # -{deleted text}- <del>deleted text</del>
569
+ # #{monospace text}#
570
+ # {url address}:url
571
+ # {image.png}imageurl
572
+ # {image.png}png
573
+ # ~{endnote}~
574
+ # +1 <!i1!>
575
+ # +2 <!i2!>
576
+ puts 'tech'
577
+ @data.each do |line|
578
+ line=line.
579
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,
580
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
581
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/,
582
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
583
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/,
584
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
585
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/,
586
+ "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite
587
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/,
588
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
589
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/,
590
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
591
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/,
592
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
593
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/,
594
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
595
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,
596
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
597
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,
598
+ "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}").
599
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/,
600
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").
601
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/,
602
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").
603
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/,
604
+ "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}").
605
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,
606
+ "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}").
607
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,
608
+ "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}").
609
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,
610
+ "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}").
611
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,
612
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}").
613
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,
614
+ "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}").
615
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,
616
+ "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasise single word, watch
617
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,
618
+ "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold single word, watch
619
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,
620
+ "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3"). #italics single word, watch
621
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/,
622
+ "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore single word, watch
623
+ gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/,
624
+ "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). #check #superscript single word, watch digit added
625
+ gsub(/^\s*_\([1-9]\)\(\*\+\)\s*/,
626
+ "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}"). #bullets, shortcut
627
+ gsub(/^\s*_\([1-9]\)\s+/,
628
+ "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}"). #watch
629
+ gsub(/^\s*__\([1-9]\)\s+/,
630
+ "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}"). #watch
631
+ #line.gsub(/^\s*__\([1-9]\)!\s+/,
632
+ # "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}"). #watch
633
+ gsub(/#{Mx[:br_line]}\s*_[12]\s+/,
634
+ "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
635
+ end
636
+ @data
637
+ end
638
+ end
639
+ end
640
+ __END__