From 833558063f14471bf46512ae7bf69bf4e5de49c9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 26 Jun 2011 14:03:16 -0400 Subject: v2 v3: dal_syntax, linebreak in regular text object: ' \\ ' ('
' depreciated) * thanks to Jonas Stein for making me look at this (see bug: #617298 & comments in upstream CHANGELOG_v3) * testing required, downstream outputs affected --- data/doc/sisu/CHANGELOG_v2 | 3 +++ data/doc/sisu/CHANGELOG_v3 | 6 ++++++ lib/sisu/v2/dal_syntax.rb | 21 +++++++++++++-------- lib/sisu/v3/dal_syntax.rb | 21 +++++++++++++-------- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v2 b/data/doc/sisu/CHANGELOG_v2 index a4d7cc20..8df2759b 100644 --- a/data/doc/sisu/CHANGELOG_v2 +++ b/data/doc/sisu/CHANGELOG_v2 @@ -15,6 +15,9 @@ Reverse Chronological: %% 2.9.7.orig.tar.gz (2011-06-26:25/7) [see 3.0.13] http://git.sisudoc.org/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/3.0.13-1 + * dal_syntax, linebreak within regular objects is \\ (
depreciated) + [test, affects downstream outputs, there is the potential for breakage] + * vim * colors, added cursor line & column diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 94d8fcaf..1eb5b4bf 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -20,6 +20,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.13.orig.tar.gz sisu_3.0.13-1.dsc sisu_3.0.13-1.debian.tar.gz + * dal_syntax, linebreak within regular objects is \\ (
depreciated) + [test, affects downstream outputs, there is the potential for breakage] + [thanks to Jonas Stein for making me look at this, see bug: #617298,
+ was not documented because there has been no intention to keep it, but + there was no markup replacement until now] + * vim * colors, added cursor line & column diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index 76287464..35505d12 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.rb @@ -122,6 +122,7 @@ module SiSU_Syntax def songsheet @data.compact! @data.each do |dob| + dob=breaks(dob) dob=if @md.sem_tag then sem(dob) else dob end #revisit dob=wordlist_italics(dob) dob=wordlist_bold(dob) @@ -133,6 +134,13 @@ module SiSU_Syntax def sem(dob) #revisit dob=SiSU_sem::Tags.new(dob,@md).rm.all end + def breaks(dob) + if dob.is !~/^(?:meta|comment|code|table)/ + dob.obj.gsub!(/ \\\\(?: |$)/,"#{Mx[:br_line]}") + dob.obj.gsub!(/(?:<:?br>|
)/,"#{Mx[:br_line]}") # depreciated + end + dob + end def wordlist_italics(dob) dob=dob.dup if (defined? @md.make.italics[:str] \ @@ -166,11 +174,11 @@ module SiSU_Syntax dob end def embolden(given) - given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2") given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}") - given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{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") @@ -180,7 +188,7 @@ module SiSU_Syntax "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end def italicise(given) - given.gsub!(/^\/_\s*(.+?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given.gsub!(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") @@ -314,7 +322,7 @@ module SiSU_Syntax dob.obj.gsub!(/\s*@title\b/," #{@md.title.full}") if defined? @md.creator.author \ and @md.creator.author - dob.obj.gsub!(/\s+(?:@creator|@author)/,",
#{@md.creator.author}") + dob.obj.gsub!(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}") else dob.obj.gsub!(/\s+(?:@creator|@author)/,'') end end @@ -352,7 +360,6 @@ module SiSU_Syntax dob.obj.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character dob.obj.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/(?:<:?br>|
)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, @@ -388,8 +395,6 @@ module SiSU_Syntax "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut dob.obj.gsub!(/^\s*_([1-9])\s+/, "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent - dob.obj.gsub!(/(?:<:?br>|
)/, - "#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'') dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") @@ -507,7 +512,7 @@ module SiSU_Syntax "#{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>|
)\s*_[12]\s+/, + line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/, "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') end @data diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index 2f6353bc..4595d6e1 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -122,6 +122,7 @@ module SiSU_Syntax def songsheet @data.compact! @data.each do |dob| + dob=breaks(dob) dob=if @md.sem_tag then sem(dob) else dob end #revisit dob=wordlist_italics(dob) dob=wordlist_bold(dob) @@ -133,6 +134,13 @@ module SiSU_Syntax def sem(dob) #revisit dob=SiSU_sem::Tags.new(dob,@md).rm.all end + def breaks(dob) + if dob.is !~/^(?:meta|comment|code|table)/ + dob.obj.gsub!(/ \\\\(?: |$)/,"#{Mx[:br_line]}") + dob.obj.gsub!(/(?:<:?br>|
)/,"#{Mx[:br_line]}") # depreciated + end + dob + end def wordlist_italics(dob) dob=dob.dup if (defined? @md.make.italics[:str] \ @@ -166,11 +174,11 @@ module SiSU_Syntax dob end def embolden(given) - given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2") given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}") - given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{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") @@ -180,7 +188,7 @@ module SiSU_Syntax "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end def italicise(given) - given.gsub!(/^\/_\s*(.+?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given.gsub!(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") @@ -314,7 +322,7 @@ module SiSU_Syntax dob.obj.gsub!(/\s*@title\b/," #{@md.title.full}") if defined? @md.creator.author \ and @md.creator.author - dob.obj.gsub!(/\s+(?:@creator|@author)/,",
#{@md.creator.author}") + dob.obj.gsub!(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}") else dob.obj.gsub!(/\s+(?:@creator|@author)/,'') end end @@ -358,7 +366,6 @@ module SiSU_Syntax dob.obj.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}") #escaped special character dob.obj.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}") #escaped special character dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character - dob.obj.gsub!(/(?:<:?br>|
)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, @@ -394,8 +401,6 @@ module SiSU_Syntax "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut dob.obj.gsub!(/^\s*_([1-9])\s+/, "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent - dob.obj.gsub!(/(?:<:?br>|
)/, - "#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'') dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") @@ -513,7 +518,7 @@ module SiSU_Syntax "#{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>|
)\s*_[12]\s+/, + line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/, "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') end @data -- cgit v1.2.3