added html export of wiki page

git-svn-id: http://redmine.rubyforge.org/svn/branches/work@297 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2007-03-04 16:28:11 +00:00
1 parent f14e2db66b
commit eb018727ef
6 files changed
+28 -2

No files matched your search

+5 -2
View File
@@ -92,9 +92,12 @@ module ApplicationHelper
html
end
def textilizable(text)
# textilize text according to system settings and RedCloth availability
# options:
# - basename: if set to true, generates local wiki links (used for html exports)
def textilizable(text, options = {})
# turn wiki links in textile links: "text":url
text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":/wiki/#{@project.id}/#{Wiki.titleize($1)}" } if @project
text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + (options[:wiki_basename] ? Wiki.titleize($1) : "/wiki/#{@project.id}/#{Wiki.titleize($1)}") } if @project
text = (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") ? auto_link(RedCloth.new(text, [:filter_html]).to_html) : simple_format(auto_link(h(text)))
# turn "#id" patterns into links to issues
text = text.gsub(/#(\d+)([^;\d])/, "<a href='/issues/show/\\1'>#\\1</a>\\2")