Class: Jekyll::RTLifyTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::RTLifyTag
- Defined in:
- lib/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.
4 5 6 7 8 9 10 11 |
# File 'lib/rtlify.rb', line 4 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
13 14 15 16 17 18 |
# File 'lib/rtlify.rb', line 13 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 |