Revision 13955
Added by Jean-Philippe Lang over 10 years ago
trunk/lib/redmine/wiki_formatting/macros.rb | ||
---|---|---|
173 | 173 |
out = ''.html_safe |
174 | 174 |
@@available_macros.each do |macro, options| |
175 | 175 |
out << content_tag('dt', content_tag('code', macro.to_s)) |
176 |
out << content_tag('dd', textilizable(options[:desc]))
|
|
176 |
out << content_tag('dd', content_tag('pre', options[:desc]))
|
|
177 | 177 |
end |
178 | 178 |
content_tag('dl', out) |
179 | 179 |
end |
180 | 180 |
|
181 | 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 |
" !{{child_pages}} -- can be used from a wiki page only\n" +
|
|
183 |
" !{{child_pages(depth=2)}} -- display 2 levels nesting only\n"
|
|
184 |
" !{{child_pages(Foo)}} -- lists all children of page Foo\n" +
|
|
185 |
" !{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo"
|
|
182 |
"{{child_pages}} -- can be used from a wiki page only\n" + |
|
183 |
"{{child_pages(depth=2)}} -- display 2 levels nesting only\n" +
|
|
184 |
"{{child_pages(Foo)}} -- lists all children of page Foo\n" + |
|
185 |
"{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo" |
|
186 | 186 |
macro :child_pages do |obj, args| |
187 | 187 |
args, options = extract_macro_options(args, :parent, :depth) |
188 | 188 |
options[:depth] = options[:depth].to_i if options[:depth].present? |
... | ... | |
200 | 200 |
render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id) |
201 | 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 | 206 |
macro :include do |obj, args| |
205 | 207 |
page = Wiki.find_page(args.first.to_s, :project => @project) |
206 | 208 |
raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project) |
... | ... | |
212 | 214 |
out |
213 | 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 | 220 |
macro :collapse do |obj, args, text| |
217 | 221 |
html_id = "collapse-#{Redmine::Utils.random_hex(4)}" |
218 | 222 |
show_label = args[0] || l(:button_show) |
... | ... | |
225 | 229 |
out |
226 | 230 |
end |
227 | 231 |
|
228 |
desc "Displays a clickable thumbnail of an attached image. Examples:\n\n<pre>{{thumbnail(image.png)}}\n{{thumbnail(image.png, size=300, title=Thumbnail)}}</pre>" |
|
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 | 235 |
macro :thumbnail do |obj, args| |
230 | 236 |
args, options = extract_macro_options(args, :size, :title) |
231 | 237 |
filename = args.first |
Also available in: Unified diff
Don't process macro descriptions with text formatter (#18961).