Class: Jekyll::RTLifyTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::RTLifyTag
- Defined in:
- lib/jekyll/rtlify.rb
Instance Method Summary collapse
-
#initialize(tag_name, variable, tokens) ⇒ RTLifyTag
constructor
A new instance of RTLifyTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, variable, tokens) ⇒ RTLifyTag
Returns a new instance of RTLifyTag.
6 7 8 9 10 11 12 13 |
# File 'lib/jekyll/rtlify.rb', line 6 def initialize(tag_name, variable, tokens) super if match = variable.match(/{{\s*(.*)\s*}}/) @variable, = match.captures else raise 'invalid variable' end end |
Instance Method Details
#render(context) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/jekyll/rtlify.rb', line 15 def render(context) html = context.find_variable(@variable) = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'ul'] .each { |tag| html = html.gsub(/<#{tag}/, "<#{tag} dir=\"auto\"")} html end |