Permalink
Browse files

simplify a couple of regexps

  • Loading branch information...
1 parent 6a66447 commit 2928040e236cebc0c845211d074eadfbf019258c @fxn fxn committed Feb 8, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 railties/guides/rails_guides/textile_extensions.rb
View
4 railties/guides/rails_guides/textile_extensions.rb
@@ -1,7 +1,7 @@
module RailsGuides
module TextileExtensions
def notestuff(body)
- body.gsub!(/^(IMPORTANT|CAUTION|WARNING|NOTE|INFO)(?:\.|\:)(.*)$/) do |m|
+ body.gsub!(/^(IMPORTANT|CAUTION|WARNING|NOTE|INFO)[.:](.*)$/) do |m|
css_class = $1.downcase
css_class = 'warning' if ['caution', 'important'].include?(css_class)
@@ -13,7 +13,7 @@ def notestuff(body)
end
def tip(body)
- body.gsub!(/^TIP(?:\.|\:)(.*)$/) do |m|
+ body.gsub!(/^TIP[.:](.*)$/) do |m|
result = "<div class='info'><p>"
result << $1.strip
result << '</p></div>'

0 comments on commit 2928040

Please sign in to comment.