diff --git a/lib/chili_project/liquid/tags.rb b/lib/chili_project/liquid/tags.rb index 56dc342d..9438213d 100644 --- a/lib/chili_project/liquid/tags.rb +++ b/lib/chili_project/liquid/tags.rb @@ -27,7 +27,8 @@ module ChiliProject::Liquid # child_pages register_tag('hello_world', HelloWorld) # include - # macro_list + register_tag('tag_list', TagList, :html => true) + register_tag('variable_list', VariableList, :html => true) end end diff --git a/lib/chili_project/liquid/tags/tag_list.rb b/lib/chili_project/liquid/tags/tag_list.rb new file mode 100644 index 00000000..e409e8ca --- /dev/null +++ b/lib/chili_project/liquid/tags/tag_list.rb @@ -0,0 +1,14 @@ +module ChiliProject::Liquid::Tags + class TagList < Tag + include ActionView::Helpers::TagHelper + + def render(context) + content_tag('p', "Tags:") + + content_tag('ul', + ::Liquid::Template.tags.keys.sort.collect {|tag_name| + content_tag('li', content_tag('code', h(tag_name))) + }.join('') + ) + end + end +end \ No newline at end of file diff --git a/lib/chili_project/liquid/tags/variable_list.rb b/lib/chili_project/liquid/tags/variable_list.rb new file mode 100644 index 00000000..51b85a48 --- /dev/null +++ b/lib/chili_project/liquid/tags/variable_list.rb @@ -0,0 +1,15 @@ +module ChiliProject::Liquid::Tags + class VariableList < Tag + include ActionView::Helpers::TagHelper + + def render(context) + out = '' + context.environments.first.keys.sort.each do |liquid_variable| + next if liquid_variable == 'text' # internal variable + out << content_tag('li', content_tag('code', h(liquid_variable))) + end if context.environments.present? + + content_tag('p', "Variables:") + content_tag('ul', out) + end + end +end diff --git a/lib/chili_project/liquid/variables.rb b/lib/chili_project/liquid/variables.rb index 28766ec6..ad23da38 100644 --- a/lib/chili_project/liquid/variables.rb +++ b/lib/chili_project/liquid/variables.rb @@ -6,6 +6,7 @@ module ChiliProject # Variables are used in liquid like {{var}} def self.macro_backwards_compatibility { + 'macro_list' => "Use the '{% variable_list %}' tag to see all Liquid variables and '{% tag_list %}' to see all of the Liquid tags." } end end diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb index df03ce59..8b4468a5 100644 --- a/lib/redmine/wiki_formatting/macros.rb +++ b/lib/redmine/wiki_formatting/macros.rb @@ -68,16 +68,6 @@ module Redmine end # Builtin macros - desc "Displays a list of all available macros, including description if available." - macro :macro_list do - out = '' - @@available_macros.keys.collect(&:to_s).sort.each do |macro| - out << content_tag('dt', content_tag('code', macro)) - out << content_tag('dd', textilizable(@@available_macros[macro.to_sym])) - end - content_tag('dl', out) - end - desc "Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:\n\n" + " !{{child_pages}} -- can be used from a wiki page only\n" + " !{{child_pages(Foo)}} -- lists all children of page Foo\n" +