Commit Graph

87 Commits

Author SHA1 Message Date
Thomas Wood 66c4ff8800 Add a where_exp filter for filtering by expression
This commit introduces a where_exp filter, which can be used as follows:
  `{{ array | where_exp: "item", "item == 10" }}`
  `{{ array | where_exp: "item", "item.field > 10" }}`
  `{{ site.posts | where_exp: "post", "post contains 'field'" }}`
  `{{ site.posts | where_exp: "post", "post.array contains 'giraffes'" }}`

This permits a variety of use cases, such as reported in: jekyll#4467,
jekyll#4385, jekyll#2787.
2016-04-12 18:52:58 +01:00
jekyllbot 6ee728efcb Merge pull request #4537 from Crunch09/fix-warnings
Merge pull request 4537
2016-03-31 18:37:32 -07:00
Florian Thomas d213981a24 Fix warnings
This removes the following warnings:

- /lib/jekyll/configuration.rb:151: warning: instance variable @default_config_file not initialized
- /lib/jekyll/converter.rb:12: warning: instance variable @highlighter_prefix not initialized
- /lib/jekyll/converter.rb:24: warning: instance variable @highlighter_suffix not initialized
- /lib/jekyll/converters/markdown.rb:9: warning: instance variable @setup not initialized
- /lib/jekyll/converters/markdown/kramdown_parser.rb:60: warning: instance variable @highlighter not initialized
- /lib/jekyll/frontmatter_defaults.rb:97: warning: shadowing outer local variable - path
- /lib/jekyll/plugin.rb:66: warning: instance variable @safe not initialized
- /lib/jekyll/regenerator.rb:147: warning: instance variable @disabled not initialized
- /test/test_convertible.rb:40: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_filters.rb:154: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_new_command.rb:84: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_site.rb:234: warning: assigned but unused variable - site
- /test/test_site.rb:240: warning: assigned but unused variable - site
- /test/test_site.rb:522: warning: assigned but unused variable - source
- /test/test_tags.rb:153: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_tags.rb:425: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_tags.rb:449: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_tags.rb:496: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_tags.rb:496: warning: instance variable @result not initialized
- /test/test_tags.rb:511: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_tags.rb:773: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_tags.rb:773: warning: instance variable @result not initialized
- /test/test_tags.rb:788: warning: ambiguous first argument; put parentheses or a space even after `/' operator
- /test/test_url.rb:66: warning: shadowing outer local variable - doc
- /lib/jekyll/url.rb:119:in `escape_path': warning: URI.escape is obsolete
2016-03-25 22:03:17 +01:00
Pat Hawks aeecbd741f
Add test to inspect strings 2016-03-21 15:45:29 -07:00
jekyllbot 9e0ed00a59 Merge pull request #4555 from timwis/patch-1
Merge pull request 4555
2016-03-08 16:25:15 -08:00
timwis e130a0841f add test to ensure where doesn't match substrings 2016-03-03 15:56:54 -05:00
Parker Moore de8f67c4a2 Fix link issues in the site found by HTML Proofer. 2016-03-01 19:43:22 -08:00
jekyllbot c16a2f4d6a Merge pull request #4590 from tonyg/pr4582
Merge pull request 4590
2016-02-29 16:12:06 -08:00
Tony Garnock-Jones fa1eb68941 Fix for issue #4582, plus simple test 2016-02-26 11:06:03 -05:00
timwis 3fbca47b1a add test for group_by size property 2016-02-25 10:41:23 -05:00
timwis f5f8548eb8 add tests for where arrays 2016-02-25 10:24:47 -05:00
Parker Moore d929242e2b Permalinks which end in a slash should always output HTML
Duplicates #4493 for 3.1.1.

/cc @jekyll/core
2016-02-19 15:02:13 -08:00
jekyllbot 735554007c Merge pull request #4314 from jekyll/allow-custom-php-extensions
Merge pull request 4314
2016-01-09 18:11:47 -08:00
Pat Hawks ddf640e6bd
Test all the things 2016-01-08 17:10:36 -08:00
Pat Hawks acb2263f51
Add smartify filter 2016-01-07 02:36:24 -08:00
Parker Moore b6c283a4ae wip: allow custom extensions 2016-01-04 17:42:06 -08:00
Parker Moore 2e91d094e5 filters#sample: n == 1, return item; n > 1, return array 2015-12-04 10:25:13 -08:00
Parker Moore 86195655d7 filters: allow sample(n) instead of just sample(1) 2015-12-04 09:40:57 -08:00
Parker Moore 96bc62c666 Add 'sample' Liquid filter
Equivalent to Array#sample functionality
2015-12-04 09:33:33 -08:00
Parker Moore 4169075dd1 filters: `where` should compare stringified versions of input & comparator
Non-string input was being missed as a result of poor comparison.
Converting inputs to strings ensure numerical and boolean values are
properly compared.

Fixes #3911.
2015-08-25 23:00:58 -07:00
Martin Jorn Rogalla 92a9582733 Corrected error message as suggested by @parkr.
Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
2015-03-01 11:16:08 +01:00
Martin Jorn Rogalla 78af3c5018 Improved clarity of sort nil input error message.
Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
2015-03-01 09:51:59 +01:00
Martin Jorn Rogalla 0565308ce6 Added test to check on nil input for sort filter.
- Added a test to check if the sort filter will raise the correct
   exception on given nil input.
 - Improved error message and used "nil" consistently.

Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
2015-03-01 09:40:32 +01:00
Parker Moore 7ad0597bff Make our own Minitest::Test subclass for further subclassing 2015-02-21 00:33:47 -08:00
Parker Moore 4b59eb4175 Fix the test inheritance for the tests. 2015-02-20 13:35:02 -08:00
Parker Moore c1da91cf5c Start removing mentions of Textile. 2015-01-17 16:51:28 -08:00
Parker Moore 10659e1eef Merge branch 'nitoyon-slugify-new-param'
* nitoyon-slugify-new-param:
  Remove superfluous Sass declarations.
  Move the slugify options out to their own section so as to fix the formatting.
  Document the mode parameter of slugify Liquid filter
  Add tests for mode parameters of slugify Liquid filter
  Add mode parameter to slugify Liquid filter

Conflicts:
	lib/jekyll/utils.rb

        ---> Hadn't added UTF-8 support in nitoyon's PR.
2015-01-17 16:06:10 -08:00
Ryan Burnette 588bba39ad Add test for Date object in filters.rb 2015-01-13 13:51:36 -05:00
Parker Moore 9109da32f9 Update test for the date() Liquid filter. 2014-12-29 20:44:10 -05:00
Aidan Feldman 229303bbc8 compare resulting data in jsonify test 2014-11-27 04:01:31 -06:00
Aidan Feldman 0662d31bf6 fix jsonify filter when used with boolean values 2014-11-26 02:40:41 -06:00
Parker Moore 18930b01f6 Fix up the assertions. 2014-11-05 11:39:15 -08:00
Parker Moore b29fd6d380 Add tests.
Need to fix up the assertions to match the output.
2014-11-05 11:37:51 -08:00
Parker Moore 3fb1356593 The jsonify filter should deep-convert to Liquid when given an Array.
Fixes https://github.com/github/choosealicense.com/issues/225
2014-10-27 15:58:42 -07:00
nitoyon 3c5e9f5334 Add tests for mode parameters of slugify Liquid filter 2014-10-12 02:50:08 +09:00
Mike Kruk 56ac50c568 where filter - test return value when filtering a Hash 2014-10-08 17:02:36 -04:00
Mike Kruk f6ea8b4d50 Allow Enumerables to be used with "where" filter. 2014-10-08 16:19:55 -04:00
Parker Moore 196a56e3ec Add push, pop, shift, and unshift Liquid filters.
Fixes #2892.
2014-09-09 21:29:23 -07:00
Chris Frederick 77297744ce Add a test for the slugify Liquid filter 2014-09-07 16:49:14 +09:00
Shu Uesugi cfd17b2e7d Add inspect filter 2014-09-01 14:51:09 -07:00
Kevin 566d3718b0 added sassify and scssify filters fot converting sass and scss strings to css 2014-08-12 21:24:04 -06:00
Parker Moore 4147e92561 Merge pull request #2417 from jekyll/jekyll-env 2014-05-17 00:53:55 -04:00
Parker Moore 3413c96845 Add test for Jekyll.env 2014-05-17 00:47:03 -04:00
Parker Moore 04b0fe0160 Merge pull request #2377 from jekyll/numeric 2014-05-16 03:50:50 -04:00
Parker Moore 4d1c84aa2b date_to_xmlschema does some weird things with timezones, but whatever it's not important. 2014-05-16 03:42:35 -04:00
Anatol Broder 7cd95734df Fix coding for 1.9.3 2014-05-11 02:22:58 +02:00
Anatol Broder 06cebb0816 Add ascii+utf8 sort. Props @ixti 2014-05-11 01:34:09 +02:00
Anatol Broder b2f30f5bee Test Russian and Hebrew sort 2014-05-11 01:06:35 +02:00
Parker Moore af9f1e6f48 Accept Numeric values for dates. 2014-05-09 23:11:05 -04:00
Anatol Broder 7c1709fab4 Change nils argument to string 2014-05-06 21:36:13 +02:00