Sha256: 90653437904810b78c4731e62867b5904fd33178c8456f65640fa02be4c4c58a
Contents?: true
Size: 849 Bytes
Versions: 4
Compression:
Stored size: 849 Bytes
Contents
# usage: {% lang text[0] text[1] text[2] %} # usage: {% lang ko 바이 괕 모 iced jelly dish %} # text[0] = language code # text[1] = the text, in latin script or not # text[2] = the translation into english module Jekyll module Tags class DefineLanguageTag < Liquid::Tag require "shellwords" def initialize(tag_name, text, tokens) super @text = text.shellsplit end def render(context) "<abbr class=\"gloss\" title=\"#{@text[0]}\">#{@text[0]}</abbr>: <strong>#{@text[1]}</strong> <em>#{@text[2]}</em>" end end end end # The register_tag method takes two arguments: the user-facing name of the tag [lang], and the class that implements it [DefineLanguageTag]. Liquid::Template.register_tag('lang', Jekyll::Tags::DefineLanguageTag)
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jekyll-theme-paperwiki-0.1.3 | _plugins/lang.rb |
jekyll-theme-paperwiki-0.1.2 | _plugins/lang.rb |
jekyll-theme-paperwiki-0.1.1 | _plugins/lang.rb |
jekyll-theme-paperwiki-0.1.0 | _plugins/lang.rb |