Patch #11332 ยป file.diff
lib/redmine/wiki_formatting/macros.rb (working copy) | ||
---|---|---|
107 | 107 |
|
108 | 108 |
desc "Include a wiki page. Example:\n\n !{{include(Foo)}}\n\nor to include a page of a specific project wiki:\n\n !{{include(projectname:Foo)}}" |
109 | 109 |
macro :include do |obj, args| |
110 |
page = Wiki.find_page(args.first.to_s, :project => @project) |
|
110 |
parts = args.first.to_s.split('?') |
|
111 |
version = parts[1] ? parts[1].scan(/\d+/)[0].to_i : nil |
|
112 |
page = Wiki.find_page(parts[0], :project => @project) |
|
111 | 113 |
raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project) |
112 | 114 |
@included_wiki_pages ||= [] |
113 | 115 |
raise 'Circular inclusion detected' if @included_wiki_pages.include?(page.title) |
114 | 116 |
@included_wiki_pages << page.title |
115 |
out = textilizable(page.content, :text, :attachments => page.attachments, :headings => false) |
|
117 |
out = textilizable(page.content_for_version(version), :text, :attachments => page.attachments, :headings => false)
|
|
116 | 118 |
@included_wiki_pages.pop |
117 | 119 |
out |
118 | 120 |
end |