Change wiki-parser again. Now wikitext is used.

This commit is contained in:
Benjamin Meichsner 2009-06-11 22:40:56 +02:00
parent eddf20b063
commit 434fc4b2ff
6 changed files with 43 additions and 30 deletions

View file

@ -25,9 +25,13 @@ class Page < ActiveRecord::Base
before_validation_on_create :set_permalink
def self.permalink(title)
Wikitext::Parser.new.parse "[[#{title}]]"
end
def set_permalink
if self.permalink.blank?
self.permalink = Page.count == 0 ? "home" : "#{title.downcase.strip.gsub(/ |\.|@/, '-')}"
unless self.permalink.blank?
self.permalink = Page.count == 0 ? "Home" : Page.permalink(title)
end
end
end