From adff96b4cf9179fd3a6d1f107400a6a0f1e384f3 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 13 Mar 2015 16:29:00 -0700 Subject: [PATCH] Document `divided_by` & make liquid raw --- _filters/capitalize.md | 8 ++++---- _filters/ceil.md | 12 ++++++------ _filters/divided_by.md | 12 ++++++++++++ _layouts/default.html | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 _filters/divided_by.md diff --git a/_filters/capitalize.md b/_filters/capitalize.md index 91c5d73..b8a3be3 100644 --- a/_filters/capitalize.md +++ b/_filters/capitalize.md @@ -4,9 +4,9 @@ title: capitalize `capitalize` ensures the first character of your string is capitalized. -| Input | Output | -|--------------------------------------:|:-----------------| -| `{{ "title" | capitalize }}` | "Title" | -| `{{ "my great title" | capitalize }}` | "My great title" | +| Input | Output | +|-----------------------------------------------------------:|:-----------------| +| {% raw %}`{{ "title" | capitalize }}` {% endraw %} | "Title" | +| {% raw %}`{{ "my great title" | capitalize }}`{% endraw %} | "My great title" | It only capitalizes the first character, so subsequent words will not be capitalized as well. diff --git a/_filters/ceil.md b/_filters/ceil.md index 672eb8f..13e4c2a 100644 --- a/_filters/ceil.md +++ b/_filters/ceil.md @@ -4,11 +4,11 @@ title: ceil `ceil` rounds the input up to the nearest whole number. -| Input | Output | -|----------------------:|:-------| -| `{{ 1.2 | ceil }}` | 2 | -| `{{ 1.7 | ceil }}` | 2 | -| `{{ 2.0 | ceil }}` | 2 | -| `{{ "18.3" | ceil }}` | 19 | +| Input | Output | +|-------------------------------------------:|:-------| +| {% raw %}`{{ 1.2 | ceil }}` {% endraw %} | 2 | +| {% raw %}`{{ 1.7 | ceil }}` {% endraw %} | 2 | +| {% raw %}`{{ 2.0 | ceil }}` {% endraw %} | 2 | +| {% raw %}`{{ "18.3" | ceil }}`{% endraw %} | 19 | It will attempt to cast any input to a number. \ No newline at end of file diff --git a/_filters/divided_by.md b/_filters/divided_by.md new file mode 100644 index 0000000..bfbefaf --- /dev/null +++ b/_filters/divided_by.md @@ -0,0 +1,12 @@ +--- +title: divided_by +--- + +This filter divides its input by its parameter. + +| Code | Output | +|--------------------------------------------------:|:-------| +| {% raw %}`{{ 4 | divided_by: 2 }}` {% endraw %} | 2 | +| {% raw %}`{{ "16" | divided_by: 4 }}`{% endraw %} | 4 | + +It uses `to_number`, which converts to a decimal value unless already a numeric. diff --git a/_layouts/default.html b/_layouts/default.html index 1adbaab..fca9d1b 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -17,7 +17,7 @@ {% endfor %} -
  • Nav Item 2
  • +
  • Source on GitHub
  • Nav Item 3
  • Nav Item 4