Commit Graph

98 Commits

Author SHA1 Message Date
Jordon Bedwell 1e74c7a547
Globalize Jekyll's Filters.
As it stands Jekyll does not globalize it's filters.  So anybody wishing to go
into Jekyll's context to process their own Liquid (say in a plugin) may be taken
aback when they find out that Jekyll's filters are not available.
See: jekyll/jekyll-assets#252.
2016-04-14 20:36:22 -05:00
Thomas Wood e470cae6da Fix rubocop warning. 2016-04-12 19:11:59 +01:00
Thomas Wood 1ef7653fed Fix minor code style recommendations and typos. 2016-04-12 18:59:56 +01:00
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
Pat Hawks b06af5a44f
Use encode for xml_escape filter 2016-03-21 11:07:46 -07:00
Mike Linksvayer 4948b5a3b3 change smartify doc from copy/paste of mardownify doc 2016-03-11 11:09:03 -08:00
jekyllbot 9e0ed00a59 Merge pull request #4555 from timwis/patch-1
Merge pull request 4555
2016-03-08 16:25:15 -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 6245ddb14d where filter uses array for everything 2016-02-25 10:18:03 -05:00
Tim Wisniewski 7542ab51b7 Add size property to group_by result 2016-02-20 20:30:38 -05:00
Tim Wisniewski 64ad293b89 add array support to where filter 2016-02-20 19:46:48 -05:00
Pat Hawks acb2263f51
Add smartify filter 2016-01-07 02:36:24 -08:00
Pat Hawks c1c8b6dbf7
Rubocop: Style/SpaceInsideHashLiteralBraces 2016-01-04 12:07:34 -08:00
Pat Hawks 6711234d5f
Rubocop: Style/BlockDelimiters
- Avoid using {...} for multi-line blocks
2016-01-04 12:05:54 -08:00
Pat Hawks 78e9f3389e
Rubocop: Style/IndentationWidth 2016-01-04 11:42:17 -08:00
Pat Hawks 663a2d3279
Rubocop: Style/SpaceBeforeBlockBraces
Rubocop: Style/SpaceInsideBlockBraces
2016-01-03 15:58:02 -08:00
Pat Hawks 2530a8cdfc
Rubocop: Style/HashSyntax
- Use hash rockets syntax
2016-01-03 15:49:22 -08:00
Pat Hawks 0eae36aec2
Rubocop: Style/LineEndConcatenation
- Use \ instead of + or << to concatenate those strings
2016-01-03 14:41:49 -08:00
Parker Moore 47d2a2459d filters: refactor #sample to leave off the arg 2015-12-04 13:48:09 -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
rebornix 6a98ab2a15 Make `:title` cased for backwards compability and add `:slug` for uncased usage. 2015-11-18 10:43:13 +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
Martin Jorn Rogalla 531d0fb261 Sort will now raise error on nil object array input.
Sort will now throw an error when a nil object array is given as input.
See issue #3491 for more information.

Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
2015-02-26 22:12:06 +01: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 80465efff7 Require date in filters.rb 2015-01-13 13:51:47 -05:00
Ryan Burnette 936c737a32 Address #3298 2015-01-13 02:21:28 -05:00
Parker Moore 7bcf8d689e Always call Time#localtime to translate to TZ'd time. 2014-12-29 20:12:35 -05:00
Parker Moore 0c0aea3ad7 Improve Site#getConverterImpl and call it Site#find_converter_instance 2014-12-28 14:12:09 -05:00
Aidan Feldman 383a0d0aa7 modify as_liquid to use case statement 2014-12-09 07:42:14 -05:00
Aidan Feldman 4776b27ff3 reduce nesting of #as_liquid 2014-11-27 04:20:05 -06:00
Aidan Feldman 87d08ec827 refactor #as_liquid 2014-11-27 04:16:29 -06:00
Aidan Feldman 0662d31bf6 fix jsonify filter when used with boolean values 2014-11-26 02:40:41 -06:00
Parker Moore 9a15a09028 Add {{ | jsonify }} support for hashes. 2014-11-05 11:37:34 -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 46e76bde3f Add mode parameter to slugify Liquid filter 2014-10-12 02:44:58 +09:00
Mike Kruk f6ea8b4d50 Allow Enumerables to be used with "where" filter. 2014-10-08 16:19:55 -04:00
Parker Moore 94a1330d61 Revert "Allow Enumerables to be used with "where" filter" 2014-10-08 12:47:17 -07:00
Mike Kruk 1db62cca9e allow Enumerables to be used with "where" filter
Enumerable module responds to `select` so this shouldn't be a problem here. Typical use case would be an object from a plugin being passed through a where filter.
2014-10-07 23:05:23 -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 394eab4a3a Add the slugify Liquid filter 2014-09-07 16:48:57 +09:00
Shu Uesugi cfd17b2e7d Add inspect filter 2014-09-01 14:51:09 -07:00
Faruk AYDIN d395183ee2 refactored where filter comment 2014-08-28 22:46:53 +03:00
Kevin 566d3718b0 added sassify and scssify filters fot converting sass and scss strings to css 2014-08-12 21:24:04 -06:00