diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..61799da --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +install: gem install github-pages +script: jekyll build --trace +sudo: false +rvm: 2.1 diff --git a/_config.yml b/_config.yml index 2f03e74..757437b 100644 --- a/_config.yml +++ b/_config.yml @@ -1,14 +1,10 @@ -# Site settings -title: Your awesome title -email: your-email@domain.com -description: > # this means to ignore newlines until "baseurl:" - Write an awesome description for your new site here. You can edit this - line in _config.yml. It will appear in your document head meta (for - Google search results) and in your feed.xml site description. -baseurl: "" # the subpath of your site, e.g. /blog/ -url: "http://yourdomain.com" # the base hostname & protocol for your site -twitter_username: jekyllrb -github_username: jekyll - # Build settings +baseurl: "" # the subpath of your site, e.g. /blog/ +url: "http://liquidmarkup.org" # the base hostname & protocol for your site markdown: kramdown +permalink: /:year/:month/:day/:basename:output_ext +collections: + - filters +exclude: + - README.md + - CNAME diff --git a/_data/site.yml b/_data/site.yml new file mode 100644 index 0000000..9c60ea9 --- /dev/null +++ b/_data/site.yml @@ -0,0 +1,6 @@ +# Site settings +title: Liquid Templating Engine +description: > # this means to ignore newlines until "baseurl:" + Liquid is a template language and accompanying rendering engine. + It is built for security, so is perfect for rendering custom + templates from your users. diff --git a/_filters/append.md b/_filters/append.md new file mode 100644 index 0000000..cfc7901 --- /dev/null +++ b/_filters/append.md @@ -0,0 +1,22 @@ +--- +title: append +--- + +`append` concatenates two strings and returns the concatenated value. + +{% highlight liquid %} +{% raw %} +{{ "/my/fancy/url" | append:".html" }} +{% endraw %} +# => "/my/fancy/url.html" +{% endhighlight %} + +It can also be used with variables: + +{% highlight liquid %} +{% raw %} +{% assign filename = "/index.html" %} +{{ product.url | append:filename }} +{% endraw %} +# => "#{product.url}/index.html" +{% endhighlight %} diff --git a/_filters/capitalize.md b/_filters/capitalize.md new file mode 100644 index 0000000..b8a3be3 --- /dev/null +++ b/_filters/capitalize.md @@ -0,0 +1,12 @@ +--- +title: capitalize +--- + +`capitalize` ensures the first character of your string is capitalized. + +| 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 new file mode 100644 index 0000000..13e4c2a --- /dev/null +++ b/_filters/ceil.md @@ -0,0 +1,14 @@ +--- +title: ceil +--- + +`ceil` rounds the input up to the nearest whole number. + +| 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/date.md b/_filters/date.md new file mode 100644 index 0000000..627368a --- /dev/null +++ b/_filters/date.md @@ -0,0 +1,12 @@ +--- +title: date +--- + +`date` converts a timestamp into another date format. + +| Input | Output | +|--------------------------------------------------------------------------:|:---------------------| +| {% raw %}`{{ article.published_at | date: "%a, %b %d, %y" }}`{% endraw %} | Tue, Apr 22, 14 | +| {% raw %}`{{ article.published_at | date: "%Y" }}`{% endraw %} | 2014 | + +The format for this syntax is the same as [`strftime`](http://strftime.net/). diff --git a/_filters/default.md b/_filters/default.md new file mode 100644 index 0000000..fa24f7a --- /dev/null +++ b/_filters/default.md @@ -0,0 +1,22 @@ +--- +title: default +--- + +`default` offers a means of having a fall-back value in case your value doesn't exist. + +{% highlight liquid %} +{% raw %} +{{ product_price | default:2.99 }} +// => outputs "2.99" + +{% assign product_price = 4.99 %} +{{ product_price | default:2.99 }} +// => outputs "4.99" + +{% assign product_price = "" %} +{{ product_price | default:2.99 }} +// => outputs "2.99" +{% endraw %} +{% endhighlight %} + +`default` will use its substitute if the left side is `nil`, `false`, or empty. 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/_filters/downcase.md b/_filters/downcase.md new file mode 100644 index 0000000..c00d281 --- /dev/null +++ b/_filters/downcase.md @@ -0,0 +1,11 @@ +--- +title: downcase +--- + +This filter makes the entire input string the lower case version of each character within. + +| Code | Output | +|-------------------------------------------------------:|:-----------------| +| {% raw %}`{{ "Peter Parker" | downcase }}`{% endraw %} | `"peter parker"` | + +It doesn't modify strings which are already entirely lowercase. It works with anything that has a `#to_s` method. diff --git a/_filters/escape.md b/_filters/escape.md new file mode 100644 index 0000000..800651b --- /dev/null +++ b/_filters/escape.md @@ -0,0 +1,12 @@ +--- +title: escape +--- + +Escapes a string by replacing characters with escape sequences (so that the string can be used in a URI). + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ "Need tips? Ask a friend!" | escape }}`{% endraw %} | `"Need%20tips%3F%Ask%20a%20friend%21"` | +| {% raw %}`{{ "Nope" | escape }}`{% endraw %} | `"Nope"` | + +It doesn't modify strings that have nothing to escape. diff --git a/_filters/escape_once.md b/_filters/escape_once.md new file mode 100644 index 0000000..0ae33be --- /dev/null +++ b/_filters/escape_once.md @@ -0,0 +1,13 @@ +--- +title: escape_once +--- + +Escapes a string without affecting existing escaped entities. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ "1 < 2 & 3" | escape_once }}`{% endraw %} | `"1 < 2 & 3"` | +| {% raw %}`{{ "<< Accept & Checkout" | escape_once }}`{% endraw %} | `"<< Accept & Checkout"` | +| {% raw %}`{{ "Nope" | escape_once }}`{% endraw %} | `"Nope"` | + +It doesn't modify strings that have nothing to escape. diff --git a/_filters/first.md b/_filters/first.md new file mode 100644 index 0000000..825949c --- /dev/null +++ b/_filters/first.md @@ -0,0 +1,11 @@ +--- +title: first +--- + +Return the first element of an array. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ product.tags | first }}`{% endraw %} | `"sale"` | + +In the sample above, assume that `product.tags` resolves to: `["sale", "mens", "womens", "awesome"]`. diff --git a/_filters/floor.md b/_filters/floor.md new file mode 100644 index 0000000..7d2aefa --- /dev/null +++ b/_filters/floor.md @@ -0,0 +1,14 @@ +--- +title: floor +--- + +`floor` rounds the input down to the nearest whole number. + +| Input | Output | +|-------------------------------------------:|:-------| +| {% raw %}`{{ 1.2 | floor }}` {% endraw %} | 1 | +| {% raw %}`{{ 1.7 | floor }}` {% endraw %} | 1 | +| {% raw %}`{{ 2.0 | floor }}` {% endraw %} | 2 | +| {% raw %}`{{ "18.3" | floor }}`{% endraw %} | 18 | + +It will attempt to cast any input to a number. diff --git a/_filters/h.md b/_filters/h.md new file mode 100644 index 0000000..835941e --- /dev/null +++ b/_filters/h.md @@ -0,0 +1,3 @@ +--- +title: h +--- diff --git a/_filters/join.md b/_filters/join.md new file mode 100644 index 0000000..c74c1b9 --- /dev/null +++ b/_filters/join.md @@ -0,0 +1,11 @@ +--- +title: join +--- + +`join` joins the elements of an array, using the character you provide. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ product.tags | join: ', ' }}`{% endraw %} | `"sale, mens, womens, awesome` | + +In the sample above, assume that `product.tags` resolves to: `["sale", "mens", "womens", "awesome"]`. diff --git a/_filters/last.md b/_filters/last.md new file mode 100644 index 0000000..1a311b0 --- /dev/null +++ b/_filters/last.md @@ -0,0 +1,11 @@ +--- +title: last +--- + +Return the last element of an array. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ product.tags | last }}`{% endraw %} | `"awesome"` | + +In the sample above, assume that `product.tags` resolves to: `["sale", "mens", "womens", "awesome"]`. diff --git a/_filters/lstrip.md b/_filters/lstrip.md new file mode 100644 index 0000000..3ab4fc0 --- /dev/null +++ b/_filters/lstrip.md @@ -0,0 +1,9 @@ +--- +title: lstrip +--- + +Strips all whitespace (tabs, spaces, and newlines) from the left side of a string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ ' too many spaces ' | lstrip }}`{% endraw %} | `"too many spaces "` | diff --git a/_filters/map.md b/_filters/map.md new file mode 100644 index 0000000..c6f82e6 --- /dev/null +++ b/_filters/map.md @@ -0,0 +1,11 @@ +--- +title: map +--- + +Collects an array of properties from a hash. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ product | map: 'tag' }}`{% endraw %} | `["sale", "mens", "womens", "awesome"]` | + +In the sample above, assume that `product` resolves to: `[{ tags: "sale"}, { tags: "mens"}, { tags: "womens"}, { tags: "awesome"}]`. diff --git a/_filters/minus.md b/_filters/minus.md new file mode 100644 index 0000000..890b1d4 --- /dev/null +++ b/_filters/minus.md @@ -0,0 +1,9 @@ +--- +title: minus +--- + +Subtracts two numbers. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 100 | minus: 10 }}`{% endraw %} | `90` | diff --git a/_filters/modulo.md b/_filters/modulo.md new file mode 100644 index 0000000..ccbe87a --- /dev/null +++ b/_filters/modulo.md @@ -0,0 +1,9 @@ +--- +title: modulo +--- + +Performs a modulo operation (eg., fetches the remainder). + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 2 | modulo: 2 }}`{% endraw %} | `1` | diff --git a/_filters/newline_to_br.md b/_filters/newline_to_br.md new file mode 100644 index 0000000..9084229 --- /dev/null +++ b/_filters/newline_to_br.md @@ -0,0 +1,9 @@ +--- +title: newline_to_br +--- + +Replace every newline (`n`) with an HTML break (`
`). + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ "hello\nthere" | newline_to_br }}`{% endraw %} | `hello
there` | diff --git a/_filters/plus.md b/_filters/plus.md new file mode 100644 index 0000000..d8aceee --- /dev/null +++ b/_filters/plus.md @@ -0,0 +1,9 @@ +--- +title: plus +--- + +Adds two numbers. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 100 | plus: 10 }}`{% endraw %} | `110` | diff --git a/_filters/prepend.md b/_filters/prepend.md new file mode 100644 index 0000000..cddfaac --- /dev/null +++ b/_filters/prepend.md @@ -0,0 +1,9 @@ +--- +title: prepend +--- + +Prepends a string onto another. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 'world' | prepend: 'hello ' }}`{% endraw %} | `hello world` | diff --git a/_filters/remove.md b/_filters/remove.md new file mode 100644 index 0000000..b0842e6 --- /dev/null +++ b/_filters/remove.md @@ -0,0 +1,9 @@ +--- +title: remove +--- + +Removes every occurrence of a given string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 'hello, hello world' | remove: 'hello' }}`{% endraw %} | `, world` | diff --git a/_filters/remove_first.md b/_filters/remove_first.md new file mode 100644 index 0000000..468b000 --- /dev/null +++ b/_filters/remove_first.md @@ -0,0 +1,9 @@ +--- +title: remove_first +--- + +Removes the first occurrence of a given string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 'hello, hello world' | remove_first: 'hello' }}`{% endraw %} | `, hello world` | diff --git a/_filters/replace.md b/_filters/replace.md new file mode 100644 index 0000000..e661be3 --- /dev/null +++ b/_filters/replace.md @@ -0,0 +1,9 @@ +--- +title: replace +--- + +Replaces every occurrence of a given string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 'hello, hello world' | replace: 'hello', 'goodbye' }}`{% endraw %} | `goodbye, goodbye world` | diff --git a/_filters/replace_first.md b/_filters/replace_first.md new file mode 100644 index 0000000..6eb958e --- /dev/null +++ b/_filters/replace_first.md @@ -0,0 +1,9 @@ +--- +title: replace_first +--- + +Replaces the first occurrence of a given string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 'hello, hello world' | replace_first: 'hello', 'goodbye' }}`{% endraw %} | `goodbye, hello world` | diff --git a/_filters/reverse.md b/_filters/reverse.md new file mode 100644 index 0000000..3d0fe8a --- /dev/null +++ b/_filters/reverse.md @@ -0,0 +1,3 @@ +--- +title: reverse +--- diff --git a/_filters/round.md b/_filters/round.md new file mode 100644 index 0000000..f449506 --- /dev/null +++ b/_filters/round.md @@ -0,0 +1,3 @@ +--- +title: round +--- diff --git a/_filters/rstrip.md b/_filters/rstrip.md new file mode 100644 index 0000000..22e18a0 --- /dev/null +++ b/_filters/rstrip.md @@ -0,0 +1,9 @@ +--- +title: rstrip +--- + +Strips all whitespace (tabs, spaces, and newlines) from the right side of a string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ ' too many spaces ' | rstrip }}`{% endraw %} | `"too many spaces "` | diff --git a/_filters/size.md b/_filters/size.md new file mode 100644 index 0000000..52d97ca --- /dev/null +++ b/_filters/size.md @@ -0,0 +1,3 @@ +--- +title: size +--- diff --git a/_filters/slice.md b/_filters/slice.md new file mode 100644 index 0000000..e2d3ddf --- /dev/null +++ b/_filters/slice.md @@ -0,0 +1,3 @@ +--- +title: slice +--- diff --git a/_filters/sort.md b/_filters/sort.md new file mode 100644 index 0000000..1e5011c --- /dev/null +++ b/_filters/sort.md @@ -0,0 +1,3 @@ +--- +title: sort +--- diff --git a/_filters/split.md b/_filters/split.md new file mode 100644 index 0000000..83b15cd --- /dev/null +++ b/_filters/split.md @@ -0,0 +1,3 @@ +--- +title: split +--- diff --git a/_filters/strip.md b/_filters/strip.md new file mode 100644 index 0000000..758d694 --- /dev/null +++ b/_filters/strip.md @@ -0,0 +1,9 @@ +--- +title: strip +--- + +Strips all whitespace (tabs, spaces, and newlines) from a string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ ' too many spaces ' | strip }}`{% endraw %} | `"too many spaces"` | diff --git a/_filters/strip_html.md b/_filters/strip_html.md new file mode 100644 index 0000000..1fdfb48 --- /dev/null +++ b/_filters/strip_html.md @@ -0,0 +1,3 @@ +--- +title: strip_html +--- diff --git a/_filters/strip_newlines.md b/_filters/strip_newlines.md new file mode 100644 index 0000000..9d3949d --- /dev/null +++ b/_filters/strip_newlines.md @@ -0,0 +1,3 @@ +--- +title: strip_newlines +--- diff --git a/_filters/times.md b/_filters/times.md new file mode 100644 index 0000000..9589b44 --- /dev/null +++ b/_filters/times.md @@ -0,0 +1,3 @@ +--- +title: times +--- diff --git a/_filters/truncate.md b/_filters/truncate.md new file mode 100644 index 0000000..29314aa --- /dev/null +++ b/_filters/truncate.md @@ -0,0 +1,3 @@ +--- +title: truncate +--- diff --git a/_filters/truncatewords.md b/_filters/truncatewords.md new file mode 100644 index 0000000..bc1aca3 --- /dev/null +++ b/_filters/truncatewords.md @@ -0,0 +1,3 @@ +--- +title: truncatewords +--- diff --git a/_filters/uniq.md b/_filters/uniq.md new file mode 100644 index 0000000..1730f1e --- /dev/null +++ b/_filters/uniq.md @@ -0,0 +1,3 @@ +--- +title: uniq +--- diff --git a/_filters/upcase.md b/_filters/upcase.md new file mode 100644 index 0000000..62ee820 --- /dev/null +++ b/_filters/upcase.md @@ -0,0 +1,3 @@ +--- +title: upcase +--- diff --git a/_filters/url_encode.md b/_filters/url_encode.md new file mode 100644 index 0000000..133ff80 --- /dev/null +++ b/_filters/url_encode.md @@ -0,0 +1,3 @@ +--- +title: url_encode +--- diff --git a/_includes/footer.html b/_includes/footer.html index 9944f68..f17a4e4 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -2,13 +2,12 @@
- + diff --git a/_includes/head.html b/_includes/head.html index df8b5a5..9a126ca 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -3,8 +3,8 @@ - {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} - + {% if page.title %}{{ page.title }} – {% endif %}{{ site.data.site.title }} + diff --git a/_layouts/default.html b/_layouts/default.html index ed90a1b..fca9d1b 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -8,15 +8,16 @@

Liquid