我创建了以下自定义 Jekyll 液体标签
# my_tag.rb
module Jekyll
class MyTag < Liquid::Tag
def initialize(tag_name, markup, tokens)
super
@title = markup['title']
@step = markup['step']
end
def render(context)
output = "<div>"
output += "<h1>#{@title} #{@step}</h1>"
output += "<p>#{super}</p>"
output += "</div>"
output
end
end
end
Liquid::Template.register_tag('my_tag', Jekyll::MyTag)
我在降价帖子中按照以下方式使用它
{% my_tag title="hello" step="world" %}
This is the data
{% endmy_tag %}
但它给出了错误
Liquid Exception: Liquid syntax error (line 351): Unknown tag 'endmy_tag'