From da4acc732746fef2af1759e64574c9e376966057 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 31 Oct 2011 21:59:00 -0400 Subject: v3: header, bold & italic pattern matching, ignore case (possibility reinstated) * (bold & italic pattern matching) @make: :bold: :italic: /[regex]/i --- data/doc/sisu/CHANGELOG_v3 | 3 +++ lib/sisu/v3/dal_syntax.rb | 12 ++++++------ lib/sisu/v3/param.rb | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index bbc88529..8aca9fbe 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -24,6 +24,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.2.orig.tar.xz * sysenv, skins, a fix [return to, identify sisupod more definitively] + * header, @make: :bold: :italic: (bold & italic pattern matching) possibility + to ignore case (reinstated) + * markup-samples, Free as in Freedom 2.0 * made use of old book index, better than none diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index a412ef3d..3a943b75 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -97,11 +97,11 @@ module SiSU_Syntax ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} @line_scan_ital=if defined? @md.make.italics[:str] \ and defined? @vz.markup_make_italic[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|(?:#{@md.make.italics[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/ + /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|(?:#{@md.make.italics[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/i elsif defined? @md.make.italics[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.make.italics[:str]}#{tail_m_ital}|\S+|\n/ + /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.make.italics[:str]}#{tail_m_ital}|\S+|\n/i elsif defined? @vz.markup_make_italic[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/ + /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i end @manmkp_bold=emph_italics \ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' @@ -110,13 +110,13 @@ module SiSU_Syntax and @md.make.bold[:str]) \ and (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/ + /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i elsif defined? @md.make.bold[:str] \ and @md.make.bold[:str] - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]})#{tail_m_bold}|\S+|\n/ + /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]})#{tail_m_bold}|\S+|\n/i elsif defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str] - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/ + /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i end end def songsheet diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 674b8cba..37ffeea7 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -774,26 +774,26 @@ module SiSU_Param end def bold m=@h['bold'] - x=(m=~/\/i$/)? 'i' : '' + i=(m=~/\/i$/)? 'i' : '' z=if m - m.gsub!(/^\/(.+?)\/i?/,'\1') - m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + x=m.gsub(/^\/(.+?)\/i?/,'\1') + x.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided rgx='\b(' + m + ')\b' - y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) - { str: '\b(?:' + m + ')\b', regx: y } + y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) + { str: '\b(?:' + m + ')\b', regx: y, i: i } else nil end z end def italics m=@h['italics'] - x=((m=~/\/i$/) ? 'i' : '') + i=((m=~/\/i$/) ? 'i' : '') z=if m - m.gsub!(/^\/(.+?)\/i?/,'\1') - m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + x=m.gsub(/^\/(.+?)\/i?/,'\1') + x.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided rgx='\b(' + m + ')\b' - y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) - { str: '\b(?:' + m + ')\b', regx: y } + y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) + { str: '\b(?:' + m + ')\b', regx: y, i: i } else nil end z -- cgit v1.2.3