Class: Sliq::Interpolation
- Inherits:
-
Slim::Interpolation
- Object
- Slim::Interpolation
- Sliq::Interpolation
- Defined in:
- lib/sliq.rb
Instance Method Summary collapse
Instance Method Details
#on_slim_attrvalue(escape, code) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/sliq.rb', line 47 def on_slim_attrvalue(escape, code) if code =~ /\A\{\{.*\}\}\Z/ [:static, code] else [:slim, :attrvalue, escape, code] end end |
#on_slim_interpolate(string) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/sliq.rb', line 55 def on_slim_interpolate(string) block = [:multi] begin case string when /\A\\{\{/ # Escaped interpolation block << [:static, '{{'] string = $' when /\A\{{2}((?>[^{}]|(\{{2}(?>[^{}]|\g<1>)*\}{2}))*)\}{2}/ # Interpolation string, code = $', $1 escape = code !~ /\A\{.*\}\Z/ block << [:slim, :output, escape, escape ? code : code[1..-2], [:multi]] # TODO: make reg exp for liquid static text when /\A([#\\]?[^#\\]*([#\\][^\\#\{][^#\\]*)*)/ # Static text block << [:static, $&] string = $' end end until string.empty? block end |