Brings back the _include macros

This commit is contained in:
Christoph Dwertmann 2013-05-10 21:42:51 +10:00
parent 575407b3af
commit 939bd46c0f
1 changed files with 14 additions and 0 deletions

14
init.rb
View File

@ -25,6 +25,20 @@ Redmine::Plugin.register :wiki_external_filter do
m = WikiExternalFilterHelper::Macro.new(self, args, text, obj.respond_to?('page') ? obj.page.attachments : nil, name, info)
m.render.html_safe
end
# code borrowed from wiki latex plugin
# code borrowed from wiki template macro
desc info['description']
macro (name + "_include").to_sym do |obj, args, text|
page = Wiki.find_page(args.to_s, :project => @project)
raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
@included_wiki_pages ||= []
raise 'Circular inclusion detected' if @included_wiki_pages.include?(page.title)
@included_wiki_pages << page.title
m = WikiExternalFilterHelper::Macro.new(self, args, page.content.text, page.attachments, name, info)
@included_wiki_pages.pop
m.render_block(args.to_s)
end
end
end
end