Commit Graph
70 Commits
Author SHA1 Message Date
Dylan Thacker-Smith ad3748af21 Include template name with line numbers in render errors. 2015-06-04 13:44:01 -04:00
Florian Weingarten 5919626da4 Rename 'has_key?' and 'has_interrupt?' 2015-06-04 13:14:46 -04:00
Dylan Thacker-Smith 8d5e71f856 Allow the exception handler to convert exceptions to hide error messages. 2015-05-27 18:59:51 -04:00
Dylan Thacker-Smith 36200ff704 Make liquid error rendering optional.
Although the author of the liquid template wants to see these errors, they
probably don't want the visitor to see the liquid errors.  Probably the
best fallback when rendering the page for visitors is to render the empty
string for tags with errors.
2015-05-25 11:24:53 -04:00
Florian Weingarten 3372ca8136 Rubocop 2015-05-14 14:37:18 +00:00
Dylan Thacker-Smith 950f062041 Allow filters to redefine Object methods to make them invokable. 2015-02-03 13:51:33 -05:00
Justin Li 1593b784a7 Simplify interface for setting template resource limits 2014-12-04 16:18:21 -05:00
Justin Li db00ec8b32 Move resource limit tracking to its own class 2014-12-04 16:18:09 -05:00
Dylan Thacker-Smith f5faa4858c Remove parsed expression cache. 2014-10-18 15:03:40 -04:00
Dylan Thacker-Smith cf5ccede50 Avoid modifying the default resources limits hash. 2014-10-01 18:51:06 -05:00
Dylan Thacker-Smith eae29f8c48 Make it easy to set default resource limits. 2014-09-11 13:54:30 -04:00
Florian Weingarten aabbd8f1a1 remove unnecessary method 2014-09-05 14:12:30 +00:00
Florian Weingarten 17cc8fdbb3 put line number in parentheses 2014-09-05 14:12:30 +00:00
Florian Weingarten 5eff375094 Optional line numbers for liquid errors 2014-09-05 14:12:29 +00:00
Florian Weingarten 1678c07548 Call to_liquid in Context invoke 2014-08-12 19:54:12 +00:00
Dylan Thacker-Smith 2aa9bbbac2 Separate expression parsing and rendering from Context#resolve. 2014-08-11 14:15:58 -07:00
Tom Burns 794ca9f604 make the conditions around stack creation easier to read 2014-07-30 15:42:24 +00:00
Tom Burns 15f6cabf83 avoid a hash comparison 2014-07-30 15:12:22 +00:00
Tom Burns e53d102a2c use 'unless' instead of 'if !' for simple conditional 2014-07-30 14:59:56 +00:00
Tom Burns 6b56bdd74f remove variables used for counting empty stacks 2014-07-28 14:23:16 +00:00
Tom Burns ba6e3e3da6 lazily create stacks 2014-07-28 14:12:11 +00:00
Jason Hiltz-Laforge 052ef9fcb8 Reorder constructor to avoid referencing uninitialized variable when environment contains a self-referencing proc 2014-07-24 18:58:23 +00:00
Florian Weingarten 6c6350f18b Exception handling for humans
Ability to pass exception_handler as a block to #render
and provide whatever behavior you want on handling exceptions

https://github.com/Shopify/liquid/pull/254
2014-07-24 14:44:02 +00:00
Jason Hiltz-Laforge bc3b066ba8 Remove block in favour of for loop to reduce temporary object allocation during variable context resolution 2014-07-22 14:54:50 +00:00
Jason Hiltz-Laforge 0df3f1c372 Cache parsed markup parts to avoid repeated calls during template render 2014-07-21 15:55:06 +00:00
Jason Hiltz-Laforge fd8c30070a Adding tests, spy dependency 2014-07-16 15:05:45 +00:00
Jason Hiltz-Laforge 4cfc05e32a Optimize checking for interrupts by replacing any? with NOT empty? 2014-07-15 18:31:40 +00:00
Florian Weingarten 0ac3ec7834 Revert "Merge pull request #352 from gaiottino/master"
This reverts commit 553b0926ae, reversing
changes made to 628ab3dc6a.
2014-07-08 14:48:19 +00:00
Arthur Neves 553b0926ae Merge pull request #352 from gaiottino/master
Add error messages for missing variables when :strict

Conflicts:
	History.md
2014-05-06 10:16:45 -04:00
Daniel Gaiottino 2bac6267f9 Add error messages for missing variables when :strict 2014-05-06 16:12:46 +02:00
Thierry Joyal ad1152853a render! will properly force rethrow of errors if context is passed as an argument 2014-05-01 16:44:00 +00:00
Florian Weingarten 2a12f253bf Fix broken rendering of variables which are equal to false (closes #345) 2014-04-29 14:33:30 -04:00
Florian Weingarten 3dbb35d823 Merge branch 'freeze_all_the_things'
Conflicts:
	History.md
	lib/liquid/tags/assign.rb
	lib/liquid/tags/capture.rb
	lib/liquid/tags/decrement.rb
	lib/liquid/tags/if.rb
2014-03-24 12:39:34 -04:00
Dylan Thacker-Smith 3b14e27f55 Allow newlines in tags and variables. 2014-03-20 17:27:03 -04:00
Dylan Thacker-Smith 503d924274 Use start and end of string rather than line matching in regexes. 2014-03-13 17:56:42 -04:00
Dylan Thacker-Smith 3c06d837b5 Speed up Context#increment_used_resources 2014-02-24 23:56:39 -05:00
Florian Weingarten 0a7de51e2b Revert some freezes on non-literals 2014-01-27 14:56:07 -05:00
Florian Weingarten c6e0c1e490 Fix resource counting bug with respond_to?(:length) 2014-01-08 13:00:53 -05:00
Florian Weingarten 43ac8d560b Freeze all the things 2014-01-07 12:35:16 -05:00
James Tucker 9b2d5b7dd3 Add a class cache to avoid runtime extend calls
* Strainer has a class cache that creates Strainer subclasses for each filter
   set that is used on .create calls.
 * Context now creates a list of filters and passes this to Strainer.create to
   utilize the class cache in almost all use cases.
 * If add_filter was called after a render, then the method cache may still be
   invalidated.

Conflicts:

	lib/liquid/strainer.rb
2013-08-31 18:56:35 +00:00
Jonas Schubert Erlandsson f91233450f Changes not empty? to any? 2013-07-01 16:12:58 +02:00
Florian Weingarten f4fb2f159c Merge pull request #157 from stomar/avoid_warnings
Avoid warnings in Ruby 1.9.3
2013-06-05 09:10:41 -07:00
Florian Weingarten 8760b5e8c4 Add optional resource usage limitations to number of rendering calls, length of rendering output and/or number of variable/capture assignments 2013-05-30 17:04:26 -04:00
Dylan Smith 38b4543bf1 Use sets to check if methods are invokable without symbolizing. 2013-02-05 14:45:08 -05:00
Jason Roelofs 1300210f05 Convert Strainer to white-list method protection
After moving the method existence check from Context into Strainer,
updated Strainer to only accept invokation methods that were added via
filter Modules, and done in a way that respond_to? is never called,
preventing unconstrained Symbol table growth.
2013-01-16 11:14:01 -05:00
Marcus Stollsteimer afc3944a4a Fix assignment with no effect outside of iterator 2012-11-18 10:21:03 +01:00
Jon Daniel 9c183bea83 added interrupt class for continue/break statements
When a continue or break statement is executed it pushes an interrupt to a
stack in context. If any non-handled interrupts are present blocks will cease
to execute. The for loop can handle the most recent interrupt in the stack.
2012-08-21 13:14:27 -04:00
Dennis Theisen 0e3b522fe2 Fix conditions using negative number comparisons 2012-03-12 16:38:34 -04:00
Steven Soroka 59a63e0fe5 fix failing test "recursively_included_template_does_not_produce_endless_loop", push needs to come before exception raise since pop is in ensure block and always happens. 2011-04-24 01:09:56 -05:00
thedarkoneandTobias Lütke a65c4f51bc These are strings already. 2011-01-28 21:16:22 -05:00