Project

General

Profile

Feature #4372 ยป include-macro-version.patch

Oskar Nordquist, 2009-12-16 13:05

View differences:

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
        title = args.first.to_s
111
        if title =~ %r{^([^@]+)@(.*)$}
112
          title, version = $1, $2
113
        end
114
        page = Wiki.find_page(title, :project => @project)
111 115
        raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)
112 116
        @included_wiki_pages ||= []
113 117
        raise 'Circular inclusion detected' if @included_wiki_pages.include?(page.title)
114 118
        @included_wiki_pages << page.title
115
        out = textilizable(page.content, :text, :attachments => page.attachments)
119
        content = version ? page.content_for_version(version) : page.content
120
        out = textilizable(content, :text, :attachments => page.attachments)
116 121
        @included_wiki_pages.pop
117 122
        out
118 123
      end
    (1-1/1)