[#604] Port hello_world macro to liquid

This commit is contained in:
Eric Davis 2011-04-26 14:30:30 -07:00 committed by Holger Just
parent 29fe856916
commit 7778ff2f83
3 changed files with 17 additions and 7 deletions

View File

@ -25,8 +25,12 @@ module ChiliProject::Liquid
# TODO: reimplement old macros as tags and register them here
# child_pages
# hello_world
register_tag('hello_world', HelloWorld)
# include
# macro_list
end
end
end
# FIXME: remove the deprecated syntax for 4.0, provide a way to migrate
# existing pages to the new syntax.
ChiliProject::Liquid::Legacy.add('hello_world', :tag)

View File

@ -0,0 +1,11 @@
module ChiliProject::Liquid::Tags
class HelloWorld < Tag
def initialize(tag_name, markup, tokens)
super
end
def render(context)
"Hello world!"
end
end
end

View File

@ -68,11 +68,6 @@ module Redmine
end
# Builtin macros
desc "Sample macro."
macro :hello_world do |obj, args|
"Hello world! Object: #{obj.class.name}, " + (args.empty? ? "Called with no argument." : "Arguments: #{args.join(', ')}")
end
desc "Displays a list of all available macros, including description if available."
macro :macro_list do
out = ''