Guest User

Untitled

a guest
Apr 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. CamelCase = Regexp.new( '\b((?:[A-Z]\w+){2,})' )
  2.  
  3. def index
  4. @page = Page.find_by_name(params[:name] || 'FrontPage')
  5. @page.content.gsub!( CamelCase, '<a href="/wiki/\1">\1</a>' )
  6.  
  7. if @page.nil?
  8. redirect_to( :action => 'edit', :name => params[:name] )
  9. else
  10. @page.content.gsub!( CamelCase, '<a href="/wiki/\1">\1</a>' )
  11. end
  12. end
Add Comment
Please, Sign In to add comment