aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/dal_syntax.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/dal_syntax.rb')
-rw-r--r--lib/sisu/v0/dal_syntax.rb261
1 files changed, 141 insertions, 120 deletions
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb
index 22ec72b0..c3bd8a7d 100644
--- a/lib/sisu/v0/dal_syntax.rb
+++ b/lib/sisu/v0/dal_syntax.rb
@@ -58,7 +58,7 @@
** Description: Syntax for markup, input markup syntaxes, determined here
=end
-module Syntax
+module SiSU_Syntax
class Words
def initialize(line,md,mkp)
@line,@md,@mkp=line,md,mkp
@@ -71,11 +71,11 @@ module Syntax
@data_new=[]
url_and_stub=SiSU_Env::Info_env.new.url
@output_url="#{url_and_stub.remote}"
- @http_m='\{.+?\}(?:https?|file)://\S+|(?:https?|file):\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^0~.+|<:(?:code|group|alt|verse)(?:-end)?>|<:br>'
+ @http_m=%r{\{.+?\}(?:https?|file)://\S+|(?:https?|file):\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
@manmkp_ital='[i/]\\{.+?\\}[i/]'
tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
- tail_m_bold=%q{(?:(?:<\/i>)?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%q{^!_\s.+?(?:<br>|\n|$)}
+ tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
+ bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)}
@line_scan_ital=if defined? @md.make_italic[:str] \
and defined? @vz.markup_make_italic[:str]
/#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|(?:#{@md.make_italic[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/
@@ -114,6 +114,8 @@ module Syntax
end
def pre(line)
line=line.dup
+ line.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
+ line.gsub!(/^@(\S+?):/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}")
if line =~/\{(?:t|table)(?:~h)?\s*c?[\d; ]*\}/; line.gsub!(/(\n)/,';;\1') #markup for alternative tables
end
line
@@ -124,7 +126,7 @@ module Syntax
and @md.make_italic[:str]) \
or (defined? @vz.markup_make_italic[:str] \
and @vz.markup_make_italic[:str])
- line= if line !~/^(?:0~|%{1,4}\s|<:code)/ #!~/^(?:[0-6]~|!_|%+\s)/
+ line= if line !~/^(?:#{Rx[:meta]}|#{Mx[:gr_o]}code)/ #!~/^(?:[0-6]~|!_|%+\s)/
word=line.scan(@line_scan_ital)
word.flatten!
word.compact! #reinstated
@@ -133,10 +135,10 @@ module Syntax
unless /#@manmkp_ital|#@http_m/.match(w)
if defined? @md.make_italic[:regx] \
and @md.make_italic[:regx]
- w.gsub!(@md.make_italic[:regx],'<i>\1</i>')
+ w.gsub!(@md.make_italic[:regx],"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
elsif defined? @vz.markup_make_italic \
and @vz.markup_make_italic
- w.gsub!(@vz.markup_make_italic,'<i>\1</i>')
+ w.gsub!(@vz.markup_make_italic,"#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")
end
end
line_array << w
@@ -148,10 +150,10 @@ module Syntax
line
end
def embolden(given)
- given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)(<br>)/,'<b>\1</b>\2')
- given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s+((?:[*]~\S+\s*)+)/,'<b>\1</b> \2')
- given.gsub!(/(?:^!_|^[7-9]~)\s+(.+?)\s*([~-]#)$/,'<b>\1</b> \2')
- given.gsub!(/(?:^!_\s+|^[7-9]~\s+)(.*)?\s*$/,'<b>\1</b>')
+ given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(<br>)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
+ given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
+ given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
+ given.gsub!(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
end
def wordlist_bold(line)
line=line.dup
@@ -159,7 +161,7 @@ module Syntax
and @md.make_bold[:str]) \
or (defined? @vz.markup_make_bold[:str] \
and @vz.markup_make_bold[:str])
- line=if line !~/^(?:[0-9]~|%+\s|<:code)/
+ line=if line !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}|%+\s|#{Mx[:gr_o]}code)/
line_array=[]
word=line.scan(@line_scan_bold)
word.flatten!
@@ -168,13 +170,13 @@ module Syntax
unless /#@manmkp_bold|#@http_m/.match(w)
if defined? @md.make_bold[:regx] \
and @md.make_bold[:regx] #document header: 0~bold [bold word list]
- w.gsub!(@md.make_bold[:regx],'<b>\1</b>')
+ w.gsub!(@md.make_bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
elsif defined? @vz.markup_make_bold \
and @vz.markup_make_bold #defaults and skin adjusted bold word list
- w.gsub!(@vz.markup_make_bold,'<b>\1</b>')
+ w.gsub!(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")
end
else
- if w =~ /(?:^!_|^[7-9]~)\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
end
end
line_array << w
@@ -183,8 +185,8 @@ module Syntax
else line
end
else
- if line !~/^(?:[0-9]~|%+\s)/ \
- and line =~ /(?:^!_|^[7-9]~)\s+/
+ if line !~/^(?:#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|%+\s)/ \
+ and line =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
embolden(line)
end
end
@@ -218,107 +220,126 @@ module Syntax
# # #numbered (list) level 1
# _# #numbered (list) level 2
line=line.dup
- if line !~/^0~|<:codeline>|<:code-end>/
+ if line !~/^#{Mx[:meta_o]}|#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/
#special characters: ~ { } < > - _ / also used : ^ ! #
line_array=[]
line.gsub!(/^%{1,4} .+/mi,'') #remove comments
- word=line.scan(/\S+|\n/) unless line =~/^(?:0~\S|%+\s)/
+ word=line.scan(/\S+|\n/) unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit
if word
word.each do |w| # _ - / # | : ! ^ ~
- unless w =~/^[0-9]~|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table/
- w.gsub!(/\\~/,'&#126;') #escaped special character
- w.gsub!(/~/,'&#126;')
+ unless w =~/^#{Mx[:lv_o]}[0-9]:\S*?#{Mx[:lv_c]}|~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table/
+ w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
+ #w.gsub!(/~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")
end
- w.gsub!(/^\<$/,'&lt;') #escaped special character
- w.gsub!(/^\>$/,'&gt;') #escaped special character
+ w.gsub!(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
+ w.gsub!(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
line_array << w
end
line=line_array.join(' ')
line=line.strip
end
- line.gsub!(/^(1~\??) @title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 #{@md.title} - #{@md.subtitle},<br />\\2#{@md.dc_creator}")
+ line.gsub!(/~\{(.+?)\}~/m,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}")
+ line.gsub!(/~\[(.+?)\]~/m,"#{Mx[:en_b_o]}\\1#{Mx[:en_b_c]}")
+ line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 #{@md.title} - #{@md.subtitle},<br />\\2#{@md.dc_creator}")
line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") #
- line.gsub!(/^([23]~\??) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.dc_creator}") #
- line.gsub!(/<((?:https?|file):\/\/\S+?)>/,'< \1 >') #catch problem markup
- line.gsub!(/\}\.\.\/(\S+)/,"\}#@output_url/\\1") #means you are not supporting relative links (only relevant in html), converted to static here
+ line.gsub!(/^(#{Mx[:lv_o]}[23]:\??#{Mx[:lv_c]}) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.dc_creator}") #
+ line.gsub!(/<((?:https?|file):\/\/\S+?)>/,'< \1 >') #catch problem markup
+ line.gsub!(/\}\.\.\/(\S+)/,"\}#@output_url/\\1") #means you are not supporting relative links (only relevant in html), converted to static here
line.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30
line.gsub!(/<!(\S+)!>/,'<:\1>') #escaped special character
- line.gsub!(/\\~/,'&#126;') #escaped special character
- line.gsub!(/\\\{/,'&#123;') #escaped special character
- line.gsub!(/\\\}/,'&#125;') #escaped special character
- line.gsub!(/\\\<</,'&lt;&lt;') #escaped special character
- line.gsub!(/\\\>>/,'&gt;&gt;') #escaped special character
- line.gsub!(/\\\</,'&lt;') #escaped special character
- line.gsub!(/\\\>/,'&gt;') #escaped special character
- line.gsub!(/\\\_/,'&#095;') #escaped special character
- line.gsub!(/\\\-/,'&#045;') #escaped special character
- line.gsub!(/\\\+/,'&#043;') #escaped special character
- line.gsub!(/\\\//,'&#047;') #escaped special character
- line.gsub!(/\\\#/,'&#035;') #escaped special character
- line.gsub!(/\\\&/,'&#038;') #&amp; #escaped special character
- line.gsub!(/\\\|/,'&#124;') #not really a sisu special character but made available as possibility
- line.gsub!(/\\\:/,'&#058;') #not really a sisu special character but made available as possibility
- line.gsub!(/\\\!/,'&#033;') #not really a sisu special character but made available as possibility
- line.gsub!(/\\\^/,'&#094;') #not really a sisu special character but made available as possibility
- line.gsub!(/\\\,/,'&#044;') #not really a sisu special character but made available as possibility
+ line.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}") #&amp; #escaped special character
+ line.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
+ line.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
+ line.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
+ line.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
+ line.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}") #not really a sisu special character but made available as possibility
#ADD -->
- line.gsub!(/\\\\/,'&#092;') #escaped special character
- line.gsub!(/\\\*/,'&#042;') #escaped special character
- line.gsub!(/\\\!/,'&#033;') #escaped special character
- line.gsub!(/(?:^| )\*~([a-z0-9._-]+)/i,' <:name#\1>') #html name marker <a name="\\1"></a>
- line.gsub!(/^([56]~)(\S+)(.+)/,'\1\2 \3 <:name#\2>') #html name marker <a name="\\1"></a>, however at present takes you to correct position within sub-toc, will nneed to clean from sub-toc leaving in main body only
- line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s[^~]|$))/,'\1{ \2 }\3\4 ~{ \3 }~ ') #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url ~{ http://url }~ [plus adjustment for commas] #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde..
- line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s+~\{(.+?)\}~/,'\1{ \2 }\3 ~{ \3 \4 }~') # watch
- line.gsub!(/<:?br>/,'<br />') #xml requires
- # depreciated -->
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)e\{(.+?)\}e/,'\1<b>\2</b>') #emphasis
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)b\{(.+?)\}b/,'\1<b>\2</b>') #bold
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)u\{(.+?)\}u/,'\1<u>\2</u>') #underscore
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)c\{(.+?)\}c/,'\1<cite>\2</cite>') #cite /blockquote?
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)i\{(.+?)\}i/,'\1<i>\2</i>') #italics
+ line.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character
+ line.gsub!(/(?:^| )\*~([a-z0-9._-]+)/i," #{Mx[:mk_o]}:name#\\1#{Mx[:mk_c]}") #html name marker <a name="\\1"></a>
+ line.gsub!(/^(#{Mx[:lv_o]}[56]:(\S+?)#{Mx[:lv_c]})\s*(.+)/,"\\1 \\3 #{Mx[:mk_o]}:name#\\2#{Mx[:mk_c]}") #html name marker <a name="\\1"></a>, however at present takes you to correct position within sub-toc, will nneed to clean from sub-toc leaving in main body only
+ line.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
+ if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m
+ line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,"\\1{ \\2 }\\3 #{Mx[:en_a_o]} \\3 \\4 #{Mx[:en_a_c]}") # watch
+ end
+ if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m
+ line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m,"\\1{ \\2 }\\3\\4 #{Mx[:en_a_o]} \\3 #{Mx[:en_a_c]} ")
+ #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url #{Mx[:en_a_o]} http://url #{Mx[:en_a_c]} [plus adjustment for commas]
+ #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde..
+ end
+ #line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s+~\{(.+?)\}~/,'\1{ \2 }\3 ~{ \3 \4 }~') # watch
+ line.gsub!(/<:?p([nb])>/,"#{Mx[:fa_o]}p\\1#{Mx[:fa_c]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
+ # depreciated -->#{Mx[:fa_c]}
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
# depreciated ^
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)!\{(.+?)\}!/,'\1<em>\2</em>') #emphasis
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)\*\{(.+?)\}\*/,'\1<b>\2</b>') #bold
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[\{]|\>)_\{(.+?)\}_/,'\1<u>\2</u>') #underscore
- line.gsub!(/(^|\s+|['"]|&nbsp;|[\(\[]|\(|\>)\/\{(.+?)\}\//,'\1<i>\2</i>') #italics
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)\"\{(.+?)\}\"/,'\1<cite>\2</cite>') #cite /blockquote?
- line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,'\1<sup>\2</sup>') #superscript
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>|\S)9\{(.+?)\}9/,'\1<sup>\2</sup>') #superscript
- line.gsub!(/(^|[^\\]),\{(.+?)\},/,'\1<sub>\2</sub>') #subscript
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)6\{(.+?)\}6/,'\1<sub>\2</sub>') #subscript
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)\+\{(.+?)\}\+/,'\1<ins>\2</ins>') #inserted text
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)v\{(.+?)\}v/,'\1<ins>\2</ins>') #inserted text
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)-\{(.+?)\}-/,'\1<del>\2</del>') #strikethrough - deleted text
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)x\{(.+?)\}x/,'\1<del>\2</del>') #deleted text
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)\*(\S+?)\*/,'\1<b>\2</b>') #bold single word, watch
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)\!(\S+?)\!/,'\1<b>\2</b>') #bold single word, watch
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,'\1<i>\2</i>\3') #italics single word, watch
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,'\1<u>\2</u>\3') #underscore single word, watch (made more complicated by url decoration escape tag (_url))
- line.gsub!(/(^|\s+)-([^{]\S+?)-( |$)/,'\1<del>\2</del>\3') #underscore single word, watch
- line.gsub!(/(^|\s+|['"]|&nbsp;|\(|\>|\d+)\^(\S+?)\^/,'\1<sup>\2</sup>') #superscript single word, watch digit added
- line.gsub!(/<[:e]\s+(.+?)!?>/,'~{ \1 }~') # not tested
- line.gsub!(/^\s*_([1-9])(\*+)\s*/,'<:i\1> _* ') #bullets, shortcut
- line.gsub!(/^\s*_([1-9])\s+/,'<:i\1> ') #indent
- line.gsub!(/(?:<br>|<br \/>)\s*_[12]\s+/,'<br> ') #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
- line.gsub!(/<:?br>/,'<br />') #adjustment 2004w41, from # line.gsub!(/<br>/,'<br />')
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote?
+ line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|\(|\>|\S)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript
+ line.gsub!(/(^|[^\\]),\{(.+?)\},/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url))
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|&nbsp;|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added
+ line.gsub!(/<[:e]\s+(.+?)!?>/,"#{Mx[:en_a_o]} \\1 #{Mx[:en_a_c]}") #not tested
+ line.gsub!(/^\s*_\*\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut
+ #line.gsub!(/^\s*_(\*+)\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut
+ line.gsub!(/^\s*_([1-9])\*\s*/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut
+ #line.gsub!(/^\s*_([1-9])(\*+)\s*/,"#{Mx[:fa_o]}:i\\1#{Mx[:fa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut
+ line.gsub!(/^\s*_([1-9])\s+/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent
+ line.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
##added
#line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?([~-]#)$/i,'<b>\1</b> \2') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?\s*$/i,'<b>\1</b>') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- #line.gsub!(/(?:(?:^| )!_ |^[7-9]~ |<:b>)(.*)\n/mi,'<b>\1</b> ') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ #line.gsub!(/(?:^!_\s+|^[7-9]~\s+|<:b>)(.*)?\s*$/i,'<b>\1</b>') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ #line.gsub!(/(?:(?:^| )!_ |^[7-9]~ |<:b>)(.*)\n/mi,'<b>\1</b> ') #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
#line.gsub!(/^_" (.*)\n/i,'<blockquote>\1</blockquote> ') #blockquotes #introduce KEEP
- line.gsub!(/<:hi>/,'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200)
- line.gsub!(/<:\/hi>/,'</span>')
- line.gsub!(/(<:verse>.+)/m,"\\1\n")
+ line.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)
+ line.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'</span>')
+ #line.gsub!(/<:hi>/,
+ #line.gsub!(/<:\/hi>/,'</span>')
+ line.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n")
line.gsub!(/[ ]+($)/,'\1')
- if line =~/(<:(?:verse|group)>)/; line.gsub!(/(<:(?:verse|group)>)/i,"\\1\n") #cosmetic
- else line.gsub!(/(<br \/>)/i,"\\1\n")
+ #line.gsub!(/\{(.+?)\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image)
+ #line.gsub!(/\{(.+?)\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image
+ ##semantic
+ #line.gsub!(/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m,"\\1#{Mx[:sm_set_o]}\\2#{Mx[:sm_set_c]}\\1")
+ #line.gsub!(/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/,"#{Mx[:sm_subset_o]}\\1#{Mx[:sm_subset_c]}\\2")
+ if line =~/(#{Mx[:gr_o]}(?:verse|group)#{Mx[:gr_c]})/; line.gsub!(/(#{Mx[:gr_o]}(?:verse|group)#{Mx[:gr_c]})/i,"\\1\n") #cosmetic
+ else line.gsub!(/<br \/>/i,"#{Mx[:br_line]}\n")
end
- elsif line =~/^<:code(?:-end)?>|<:codeline>/ # /^<:code>/ #should be enough # underscore used as escape for angle brackets
+ elsif line =~/^#{Mx[:gr_o]}code(?:-end)?#{Mx[:gr_c]}|#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/ # /^<:code>/ #should be enough # underscore used as escape for angle brackets
line.gsub!(/([<>])/,'_\1')
line.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy
line.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert <br> <br /> back, clumsy
- line.gsub!(/(^|\s)&lt;(br(?: \/)?)&gt;([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy
- line.gsub!(/<:codeline>/,"\n&nbsp;&nbsp;") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
+ line.gsub!(/(^|#{Mx[:gl_c]}|\s)&lt;(br(?: \/)?)&gt;([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy
+ line.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n&nbsp;&nbsp;") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n")
else # 0~
end
line
@@ -341,32 +362,32 @@ module Syntax
# +2 <!i2!>
puts 'tech'
@data.each do |line|
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)e\{(.+?)\}e/,'\1<b>\2</b>') #emphasis
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)b\{(.+?)\}b/,'\1<b>\2</b>') #bold
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)u\{(.+?)\}u/,'\1<u>\2</u>') #underscore
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)c\{(.+?)\}c/,'\1<cite>\2</cite>') #cite
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)i\{(.+?)\}i/,'\1<i>\2</i>') #italics
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)!\{(.+?)\}!/,'\1<em>\2</em>') #emphasis
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)\*\{(.+?)\}\*/,'\1<b>\2</b>') #bold
- line.gsub!(/(^|\s+|['"]|[\(\[]|\>)_\{(.+?)\}_/,'\1<u>\2</u>') #underscore
- line.gsub!(/(^|\s+|['"]|[\(\[]|\(|\>)\/\{(.+?)\}\//,'\1<i>\2</i>') #italics
- line.gsub!(/(^|\s+|['"]|\(|\>)\"\{(.+?)\}\"/,'\1<cite>\2</cite>')
- line.gsub!(/(^|\s+|['"]|\(|\>|\S)\^\{(.+?)\}\^/,'\1<sup>\2</sup>')
- line.gsub!(/(^|\s+|['"]|\(|\>|\S)9\{(.+?)\}9/,'\1<sup>\2</sup>')
- line.gsub!(/(^|\s+|['"]|\(|\>),\{(.+?)\},/,'\1<sub>\2</sub>')
- line.gsub!(/(^|\s+|['"]|\(|\>)6\{(.+?)\}6/,'\1<sub>\2</sub>')
- line.gsub!(/(^|\s+|['"]|\(|\>)\+\{(.+?)\}\+/,'\1<ins>\2</ins>')
- line.gsub!(/(^|\s+|['"]|\(|\>)v\{(.+?)\}v/,'\1<ins>\2</ins>')
- line.gsub!(/(^|\s+|['"]|\(|\>)-\{(.+?)\}-/,'\1<del>\2</del>')
- line.gsub!(/(^|\s+|['"]|\(|\>)x\{(.+?)\}x/,'\1<del>\2</del>')
- line.gsub!(/(^|\s+|['"]|\(|\>)\*(\S+?)\*/,'\1<b>\2</b>') #bold single word, watch
- line.gsub!(/(^|\s+|['"]|\(|\>)\!(\S+?)\!/,'\1<b>\2</b>') #bold single word, watch
- line.gsub!(/(^|\s+|['"]|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,'\1<i>\2</i>\3') #italics single word, watch
- line.gsub!(/(^|\s+|['"]|\(|\>)_(\S+?)_/,'\1<u>\2</u>') #underscore single word, watch
- line.gsub!(/(^|\s+|['"]|\(|\>|\d+)\^(\S+?)\^/,'\1<sup>\2</sup>') #superscript single word, watch digit added
- line.gsub!(/^\s*_([1-9])(\*+)\s*/,'<:i\1> _* ') # bullets, shortcut
- line.gsub!(/^\s*_([1-9])\s+/,'<:i\1> ')
- line.gsub!(/<:?br>/,'<br />')
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}")
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore single word, watch
+ line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #check #superscript single word, watch digit added
+ line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") # bullets, shortcut
+ line.gsub!(/^\s*_\([1-9]\)\s+/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}")
+ line.gsub!(/(?:<:?br>|<br \/>)\s*_[12]\s+/,"#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')
end
@data
end