Commit Graph
64 Commits
Author SHA1 Message Date
Dylan Thacker-Smith 000d0c911b Merge pull request #519 from Shopify/remove-filter-method-blacklist
Allow filters to redefine Object methods to make them invokable.
2015-02-04 18:09:51 -05:00
Florian Weingarten 475ea51f1f Revert "Merge pull request #466 from Shopify/remove-expression-cache"
This reverts commit d9ae36ec40, reversing
changes made to 2da9d49478.
2014-11-07 01:48:51 +00: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
thedarkoneandTobias Lütke a24049906b Resolve literals faster. 2011-01-28 21:16:22 -05:00
thedarkoneandTobias Lütke aa678302d6 Fix comments. 2011-01-28 21:16:22 -05:00
thedarkoneandTobias Lütke 6d0bb3303c Clean-up Context#stack. 2011-01-28 21:16:22 -05:00
DBAandTobias Lütke 8304a046c9 Context
- Check arity of proc before calling, to prevent error when using ruby 1.9.1+

Code beautifer
  - context.rb
2010-08-23 01:30:03 +08:00
James MacAulay 0150067c40 Revert "Raise FilterNotFound on use of non-existent filter"
This reverts commit 01c25a11a3.

Conflicts:

	test/context_test.rb
2009-08-19 19:24:33 -04:00
James MacAulay 167825aa92 further differentiate between environments and only evaluate Procs once 2009-08-07 11:24:15 -04:00