Sha256: bc756948b17d3193d3b3077f28af511ace436219ee6118618f7c839d33ed7a52
Contents?: true
Size: 789 Bytes
Versions: 6
Compression:
Stored size: 789 Bytes
Contents
# Frozen-string-literal: true # Encoding: utf-8 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
6 entries across 6 versions & 1 rubygems