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.rb37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb
index 513dc721..d0014ad6 100644
--- a/lib/sisu/v0/dal_syntax.rb
+++ b/lib/sisu/v0/dal_syntax.rb
@@ -61,7 +61,7 @@ module Syntax
@manmkp_ital='[i/]\\{.+?\\}[i/]'
tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
tail_m_bold=%q{(?:(?:<\/i>)?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?}
- bold_line=%q{^!_\s.+?(?:\n|$)}
+ bold_line=%q{^!_\s.+?(?:<br>|\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/
elsif defined? @md.make_italic[:str]
@@ -120,9 +120,10 @@ module Syntax
line
end
def embolden(given)
- given.gsub!(/(?:^!_|^[789]~)\s+(.+?)\s+((?:[*]~\S+\s*)+)/,'<b>\1</b> \2')
- given.gsub!(/(?:^!_|^[789]~)\s+(.+?)\s*([~-]#)$/,'<b>\1</b> \2')
- given.gsub!(/(?:^!_\s+|^[789]~\s+)(.*)?\s*$/,'<b>\1</b>')
+ 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>')
end
def wordlist_bold(line)
line=line.dup
@@ -140,7 +141,7 @@ module Syntax
w.gsub!(@vz.markup_make_bold,'<b>\1</b>')
end
else
- if w =~ /(?:^!_|^[789]~)\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ 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!
end
end
line_array << w
@@ -149,7 +150,7 @@ module Syntax
else line
end
else
- if line !~/^(?:[0-9]~|%+\s)/ and line =~ /(?:^!_|^[789]~)\s+/; embolden(line)
+ if line !~/^(?:[0-9]~|%+\s)/ and line =~ /(?:^!_|^[7-9]~)\s+/; embolden(line)
end
end
line
@@ -172,8 +173,10 @@ module Syntax
# ~{endnote}~ <!e endnote !>
# !_ #bold/emphasise paragraph
# _" #blockquote paragraph
- # _1 <!i1!> #indent paragraph 1 step
- # _2 <!i2!> #indent paragraph 2 steps
+ # _1 <:i1> #indent paragraph 1 step
+ # _2 <:i2> #indent paragraph 2 steps
+ # _3 <:i3> #indent paragraph 3 steps
+ # _4 <:i4> #indent paragraph 4 steps
# _* #bullet (list)
# _1* #bullet (list) indented
# _1* #bullet (list) indented
@@ -255,17 +258,15 @@ module Syntax
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*_([12])(\*+)\s*/,'<:i\1> _* ') #bullets, shortcut
- line.gsub!(/^\s*_([12])\s+/,'<:i\1> ') #indent
+ 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!(/^\s*_([12])\s+/,"<:i\\1> ")
- #line.gsu!b!(/^\s*_([12])\s+/,"<!i\\1!> ") #indent line
line.gsub!(/<:?br>/,'<br />') #adjustment 2004w41, from # line.gsub!(/<br>/,'<br />')
##added
- #line.gsub!(/(?:^!_\s+|^[78]~\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+|^[78]~\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!(/(?:(?:^| )!_ |^[78]~ |<: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!(/(?:^!_\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!(/^_" (.*)\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")
@@ -319,8 +320,8 @@ module Syntax
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*_([12])(\*+)\s*/,"<:i\\1> _* ") # bullets, shortcut
- line.gsub!(/^\s*_([12])\s+/,'<:i\1> ')
+ line.gsub!(/^\s*_([1-9])(\*+)\s*/,'<:i\1> _* ') # bullets, shortcut
+ line.gsub!(/^\s*_([1-9])\s+/,'<:i\1> ')
line.gsub!(/<:?br>/,'<br />')
end
@data