Module: Liquid::ParserSwitching
Instance Method Summary collapse
- #parse_with_selected_parser(markup) ⇒ Object
- #rigid_mode? ⇒ Boolean
-
#strict_parse_with_error_mode_fallback(markup) ⇒ Object
deprecated
Deprecated.
Use #parse_with_selected_parser instead.
Instance Method Details
#parse_with_selected_parser(markup) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/liquid/parser_switching.rb', line 29 def parse_with_selected_parser(markup) case parse_context.error_mode when :rigid then rigid_parse_with_error_context(markup) when :strict then strict_parse_with_error_context(markup) when :lax then lax_parse(markup) when :warn begin rigid_parse_with_error_context(markup) rescue SyntaxError => e parse_context.warnings << e lax_parse(markup) end end end |
#rigid_mode? ⇒ Boolean
44 45 46 |
# File 'lib/liquid/parser_switching.rb', line 44 def rigid_mode? parse_context.error_mode == :rigid end |
#strict_parse_with_error_mode_fallback(markup) ⇒ Object
Deprecated.
Use #parse_with_selected_parser instead.
Do not use this.
It’s basically doing the same thing the #parse_with_selected_parser, except this will try the strict parser regardless of the error mode, and fall back to the lax parser if the error mode is lax or warn, except when in rigid mode where it uses the rigid parser.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/liquid/parser_switching.rb', line 13 def strict_parse_with_error_mode_fallback(markup) return rigid_parse_with_error_context(markup) if rigid_mode? strict_parse_with_error_context(markup) rescue SyntaxError => e case parse_context.error_mode when :rigid raise when :strict raise when :warn parse_context.warnings << e end lax_parse(markup) end |