unless block_given?
raise "Can not create a macro without a block!"
end
+
name = name.to_s.downcase.to_sym
available_macros[name] = {:desc => @@desc || ''}.merge(options)
@@desc = nil
raise t(:error_childpages_macro_no_argument)
end
raise t(:error_page_not_found) if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
+
pages = page.self_and_descendants(options[:depth]).group_by(&:parent_id)
render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id)
end
macro :include do |obj, args|
page = Wiki.find_page(args.first.to_s, :project => @project)
raise t(:error_page_not_found) if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
+
@included_wiki_pages ||= []
raise t(:error_circular_inclusion) if @included_wiki_pages.include?(page.id)
+
@included_wiki_pages << page.id
out = textilizable(page.content, :text, :attachments => page.attachments, :headings => false, :inline_attachments => @@inline_attachments)
@included_wiki_pages.pop
args, options = extract_macro_options(args, :size, :title)
filename = args.first
raise t(:error_filename_required) unless filename.present?
+
size = options[:size]
raise t(:error_invalid_size_parameter) unless size.nil? || /^\d+$/.match?(size)
+
size = size.to_i
size = 200 unless size > 0
if obj && obj.respond_to?(:attachments) && attachment = Attachment.latest_attach(obj.attachments, filename)