小编pip*_*ull的帖子

如何在转换器插件中访问页面属性(YAML前端内容)

我正在为Jekyll编写一个转换器插件,需要访问一些页眉(YAML前端)属性.只有内容传递给主转换器方法,似乎无法访问上下文.

例:

module Jekyll
  class UpcaseConverter < Converter
    safe true
    priority :low

    def matches(ext)
      ext =~ /^\.upcase$/i
    end

    def output_ext(ext)
      ".html"
    end

    def convert(content)

      ###########
      #
      # Its here that I need access to the content page header data 
      #
      # 
      ###########

      content.upcase
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

有关如何在转换器插件中访问页眉数据的任何想法?

ruby jekyll jekyll-extensions

6
推荐指数
1
解决办法
684
查看次数

标签 统计

jekyll ×1

jekyll-extensions ×1

ruby ×1