Sha256: 99e40b7a5cd7d2c170a7f9a1b6bd4326b43b62b14e81d89c6fbd5ff979817c2c
Contents?: true
Size: 740 Bytes
Versions: 5
Compression:
Stored size: 740 Bytes
Contents
module Jekyll module LanguagePlugin module Tags class LanguageNameTag < Liquid::Tag def initialize(tag_name, markup, tokens) super @markup = markup end def render(context) p = Liquid::Parser.new(@markup) name = Liquid::Expression.parse(exp = p.expression) key = context.evaluate(name) raise Liquid::SyntaxError.new("Invalid language key expression: #{exp}") if key.nil? # get language name string from evaluated key Jekyll::LanguagePlugin::LiquidContext.get_language_string(context, "lang.#{key}") end end end end end Liquid::Template.register_tag('tl', Jekyll::LanguagePlugin::Tags::LanguageNameTag)
Version data entries
5 entries across 5 versions & 1 rubygems