[#604] Port hello_world macro to liquid
This commit is contained in:
parent
29fe856916
commit
7778ff2f83
|
@ -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)
|
||||
|
|
|
@ -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
|
|
@ -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 = ''
|
||||
|
|
Loading…
Reference in New Issue