【发布时间】:2020-01-22 01:19:32
【问题描述】:
我非常喜欢通过jekyll-liquify 插件在 Jekyll frontmatter 中使用 Liquid 变量的可能性:
module LiquidFilter
def liquify(input)
Liquid::Template.parse(input).render(@context)
end
end
Liquid::Template.register_filter(LiquidFilter)
效果很好,但我想更进一步,使用插件jekyll-image-size 从在frontmatter 中作为液体变量给出的图像中读取图像大小
image: '{{ page.myimage }}'
...所以我需要在 jekyll-image-size 插件中实现上述解析器
...
class ImageSizeTag < Liquid::Tag
def initialize(tagName, content, tokens)
super
@content = content.strip
@tokens = tokens
end
...
我不知道 ruby,所以我不知道该怎么做,但我想它不应该太复杂。感谢您的帮助!
【问题讨论】:
标签: jekyll liquid jekyll-extensions