diff --git a/app/models/chunks/nowiki.rb b/app/models/chunks/nowiki.rb index 99eeb8bf..664beb70 100755 --- a/app/models/chunks/nowiki.rb +++ b/app/models/chunks/nowiki.rb @@ -27,5 +27,5 @@ class NoWiki < Chunk::Abstract # The nowiki content is not unmasked. This means the chunk will be reverted # using the plain text. def unmask(content) nil end - def revert(content) content.sub!( Regexp.new(mask(content)), plain_text ) end + def revert(content) content.sub!(mask(content), plain_text) end end diff --git a/app/models/chunks/uri.rb b/app/models/chunks/uri.rb index c8f8a632..8f131e61 100755 --- a/app/models/chunks/uri.rb +++ b/app/models/chunks/uri.rb @@ -116,7 +116,7 @@ class URIChunk < Chunk::Abstract # content. def unmask(content) return nil if escaped_text - return self if content.sub!( Regexp.new(mask(content)), "#{link_text}" ) + return self if content.sub!(mask(content), "#{link_text}") end # If there is no hostname in the URI, do not render it diff --git a/app/models/chunks/wiki.rb b/app/models/chunks/wiki.rb index bb83c219..82042acd 100755 --- a/app/models/chunks/wiki.rb +++ b/app/models/chunks/wiki.rb @@ -64,7 +64,9 @@ module WikiChunk class Link < WikiLink def self.pattern() /\[\[([^\]]+)\]\]/ end - ALIASED_LINK_PATTERN = Regexp.new('^(.*)?\|(.*)$', 0, "utf-8") unless defined? ALIASED_LINK_PATTERN + unless defined? ALIASED_LINK_PATTERN + ALIASED_LINK_PATTERN = Regexp.new('^(.*)?\|(.*)$', 0, 'utf-8') + end attr_reader :page_name, :link_text