diff --git a/lib/chili_project/liquid/tags.rb b/lib/chili_project/liquid/tags.rb index 04552bd2..626d85e9 100644 --- a/lib/chili_project/liquid/tags.rb +++ b/lib/chili_project/liquid/tags.rb @@ -40,8 +40,6 @@ module ChiliProject::Liquid register_tag('child_pages', ChildPages, :html => true) register_tag('hello_world', HelloWorld) register_tag('include', Include, :html => true) - register_tag('tag_list', TagList, :html => true) - register_tag('variable_list', VariableList, :html => true) # Output these tags again as they were typed # These are to be handled later diff --git a/lib/chili_project/liquid/tags/tag_list.rb b/lib/chili_project/liquid/tags/tag_list.rb deleted file mode 100644 index f279df7e..00000000 --- a/lib/chili_project/liquid/tags/tag_list.rb +++ /dev/null @@ -1,28 +0,0 @@ -#-- encoding: UTF-8 -#-- copyright -# ChiliProject is a project management system. -# -# Copyright (C) 2010-2011 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# See doc/COPYRIGHT.rdoc for more details. -#++ - -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 deleted file mode 100644 index c41c8d78..00000000 --- a/lib/chili_project/liquid/tags/variable_list.rb +++ /dev/null @@ -1,29 +0,0 @@ -#-- encoding: UTF-8 -#-- copyright -# ChiliProject is a project management system. -# -# Copyright (C) 2010-2011 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# See doc/COPYRIGHT.rdoc for more details. -#++ - -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 fc1c37bb..82ff42bf 100644 --- a/lib/chili_project/liquid/variables.rb +++ b/lib/chili_project/liquid/variables.rb @@ -38,9 +38,24 @@ module ChiliProject @variables ||= {} end + register "tags" do + ::Liquid::Template.tags.keys.sort + end + + register "variables" do |context| + vars = [] + + vars = context.environments.first.keys.reject do |var| + # internal variable + var == "text" + end if context.environments.present? + vars += context.scopes.collect(&:keys).flatten + vars.uniq.sort + end + # DEPRACATED: This is just a hint on how to use Liquid introspection register "macro_list", - "Use the '{% variable_list %}' tag to see all Liquid variables and '{% tag_list %}' to see all of the Liquid tags." + "Use '{{ variables | to_list: \"Variables:\" }}' to see all Liquid variables and '{{ tags | to_list: \"Tags:\" }}' to see all of the Liquid tags." end end end