Skip to content

liquid.filters

package

liquid.filters

Provides shopify filters

Provides standard liquid filters

Classes
Functions
  • append(base, suffix) Append a suffix to a string</>
  • attr(base, prop) Similar as __getattr__() but also works like `getitem()</>
  • ceil(base) Get the ceil of a number</>
  • compact(base) Remove empties from a list</>
  • default(base, deft, allow_false) Return the deft value if base is not set.Otherwise, return base </>
  • divided_by(base, dvdby) Implementation of / or //</>
  • escape_once(base) Escapse html characters only once of the string</>
  • floor(base) Get the floor of a number</>
  • liquid_date(base, fmt) Format a date/datetime</>
  • liquid_map(base, prop) Map a property to a list of objects</>
  • liquid_slice(base, start, length) Slice a list</>
  • minus(base, sep) Implementation of -</>
  • modulo(base, sep) Implementation of %</>
  • newline_to_br(base) Replace newline with <br /></>
  • plus(base, sep) Implementation of +</>
  • prepend(base, prefix) Prepend a prefix to a string</>
  • regex_replace(base, regex, replace, case_sensitive, count) (str) Replace matching regex pattern</>
  • remove(base, string) Remove a substring from a string</>
  • remove_first(base, string) Remove the first substring from a string</>
  • replace_first(base, old, new) Replace the first substring with new string</>
  • sort(base) Get the sorted list</>
  • sort_natural(base) Get the sorted list in a case-insensitive manner</>
  • split(base, sep) Split a string into a listIf the sep is empty, return the list of characters </>
  • strip_html(base) Strip html tags from a string</>
  • strip_newlines(base) Strip newlines from a string</>
  • times(base, sep) Implementation of *</>
  • truncate(base, length, ellipsis) Truncate a string</>
  • truncatewords(base, length, ellipsis) Truncate a string by words</>
  • uniq(base) Get the unique elements from a list</>
  • url_decode(base) Url-decode a string</>
  • url_encode(base) Url-encode a string</>
  • where(base, prop, value) Query a list of objects with a given property value</>

Provides jekyll filtersSee: https://jekyllrb.com/docs/liquid/filters/

Functions
  • absolute_url(env, value) Get absolute url based on site.baseurl</>
  • array_to_sentence_string(array, connector) (str) Join an array of things into a string by separating with commas and theword "and" for the last one. </>
  • cgi_escape(input) (str) CGI escape a string for use in a URL. Replaces any special characterswith appropriate %XX replacements. </>
  • date_to_xmlschema(env, value) Convert date to xml schema format</>
  • find(value, attr, query) Find elements from array using attribute value</>
  • find_exp(env, value, item, expr) Find elements using expression</>
  • group_by_expr(env, value, item, expr) Group by data using expression</>
  • jekyll_slugify(input, mode) (str) Slugify a string</>
  • jekyll_sort(array, prop, none_pos) Sort an array in a reverse way by default.</>
  • jsonify(input) (str) Convert the input into json string</>
  • markdownify(value) Markdownify a string</>
  • normalize_whitespace(value) Replace multiple spaces into one</>
  • number_of_words(input, mode) (int) Count the number of words in the input string.</>
  • relative_url(env, value) Get relative url based on site.baseurl</>
  • sample(value, n) Sample elements from array</>
  • uri_escape(input) (str) URI escape a string.</>
  • where_exp(env, value, item, expr) Where using expression</>
  • xml_escape(input) (str) Convert an object into its String representation</>

Provides filter manager

Classes

Provides some wild filters

Functions
  • call(fn, *args, **kwargs) (any) Call a function with passed arguments</>
  • ifelse(env, value, test, test_args, true, true_args, false, false_args) (any) An if-else filter, implementing a tenary-like filter.</>