2009-08-11 14:30:35 +02:00
|
|
|
class Wikilink < WikiCloth::WikiLinkHandler
|
|
|
|
|
2009-08-12 18:41:25 +02:00
|
|
|
def url_for(page, parent = nil)
|
|
|
|
if parent
|
|
|
|
"/pages/new?title=#{page}&parent=#{parent}"
|
|
|
|
else
|
|
|
|
"/wiki/#{page}"
|
|
|
|
end
|
2009-08-11 14:30:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def link_attributes_for(page)
|
|
|
|
permalink = Page.permalink(page)
|
|
|
|
if Page.exists?(:permalink => permalink)
|
|
|
|
{ :href => url_for(permalink) }
|
|
|
|
else
|
2009-08-12 18:41:25 +02:00
|
|
|
{ :href => url_for(page, params[:referer]), :class => "new_wiki_link"}
|
2009-08-11 14:30:35 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def section_link(section)
|
|
|
|
""
|
|
|
|
end
|
|
|
|
end
|