@@ -173,16 +173,16 module Redmine | |||||
173 | out = ''.html_safe |
|
173 | out = ''.html_safe | |
174 | @@available_macros.each do |macro, options| |
|
174 | @@available_macros.each do |macro, options| | |
175 | out << content_tag('dt', content_tag('code', macro.to_s)) |
|
175 | out << content_tag('dt', content_tag('code', macro.to_s)) | |
176 |
out << content_tag('dd', |
|
176 | out << content_tag('dd', content_tag('pre', options[:desc])) | |
177 | end |
|
177 | end | |
178 | content_tag('dl', out) |
|
178 | content_tag('dl', out) | |
179 | end |
|
179 | end | |
180 |
|
180 | |||
181 | desc "Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:\n\n" + |
|
181 | desc "Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:\n\n" + | |
182 |
" |
|
182 | "{{child_pages}} -- can be used from a wiki page only\n" + | |
183 |
" |
|
183 | "{{child_pages(depth=2)}} -- display 2 levels nesting only\n" + | |
184 |
" |
|
184 | "{{child_pages(Foo)}} -- lists all children of page Foo\n" + | |
185 |
" |
|
185 | "{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo" | |
186 | macro :child_pages do |obj, args| |
|
186 | macro :child_pages do |obj, args| | |
187 | args, options = extract_macro_options(args, :parent, :depth) |
|
187 | args, options = extract_macro_options(args, :parent, :depth) | |
188 | options[:depth] = options[:depth].to_i if options[:depth].present? |
|
188 | options[:depth] = options[:depth].to_i if options[:depth].present? | |
@@ -200,7 +200,9 module Redmine | |||||
200 | render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id) |
|
200 | render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id) | |
201 | end |
|
201 | end | |
202 |
|
202 | |||
203 | 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)}}" |
|
203 | desc "Includes a wiki page. Examples:\n\n" + | |
|
204 | "{{include(Foo)}}\n" + | |||
|
205 | "{{include(projectname:Foo)}} -- to include a page of a specific project wiki" | |||
204 | macro :include do |obj, args| |
|
206 | macro :include do |obj, args| | |
205 | page = Wiki.find_page(args.first.to_s, :project => @project) |
|
207 | page = Wiki.find_page(args.first.to_s, :project => @project) | |
206 | raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project) |
|
208 | raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project) | |
@@ -212,7 +214,9 module Redmine | |||||
212 | out |
|
214 | out | |
213 | end |
|
215 | end | |
214 |
|
216 | |||
215 | desc "Inserts of collapsed block of text. Example:\n\n {{collapse(View details...)\nThis is a block of text that is collapsed by default.\nIt can be expanded by clicking a link.\n}}" |
|
217 | desc "Inserts of collapsed block of text. Examples:\n\n" + | |
|
218 | "{{collapse\nThis is a block of text that is collapsed by default.\nIt can be expanded by clicking a link.\n}}\n\n" + | |||
|
219 | "{{collapse(View details...)\nWith custom link text.\n}}" | |||
216 | macro :collapse do |obj, args, text| |
|
220 | macro :collapse do |obj, args, text| | |
217 | html_id = "collapse-#{Redmine::Utils.random_hex(4)}" |
|
221 | html_id = "collapse-#{Redmine::Utils.random_hex(4)}" | |
218 | show_label = args[0] || l(:button_show) |
|
222 | show_label = args[0] || l(:button_show) | |
@@ -225,7 +229,9 module Redmine | |||||
225 | out |
|
229 | out | |
226 | end |
|
230 | end | |
227 |
|
231 | |||
228 |
desc "Displays a clickable thumbnail of an attached image. Examples:\n\n |
|
232 | desc "Displays a clickable thumbnail of an attached image. Examples:\n\n" + | |
|
233 | "{{thumbnail(image.png)}}\n" + | |||
|
234 | "{{thumbnail(image.png, size=300, title=Thumbnail)}} -- with custom title and size" | |||
229 | macro :thumbnail do |obj, args| |
|
235 | macro :thumbnail do |obj, args| | |
230 | args, options = extract_macro_options(args, :size, :title) |
|
236 | args, options = extract_macro_options(args, :size, :title) | |
231 | filename = args.first |
|
237 | filename = args.first |
General Comments 0
You need to be logged in to leave comments.
Login now