mirror of
https://github.com/kemko/liquid.git
synced 2026-01-03 08:45:42 +03:00
Uncomplicate the sidebar
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<header class="home--banner">
|
||||
<h1>Liquid</h1>
|
||||
<p>Ruby library for rendering safe templates which cannot affect the security of the server they are rendered on.</p>
|
||||
<p>Safe, customer facing template language for flexible web apps.</p>
|
||||
<p class="btn-row">
|
||||
<a href="https://github.com/Shopify/liquid/archive/master.zip" target="_blank" class="btn"><i class="icon fa fa-2x fa-arrow-circle-down"></i>Download</a>
|
||||
<a href="https://github.com/Shopify/liquid" target="_blank" class="btn"><i class="icon fa fa-2x fa-github"></i>View on Github</a>
|
||||
|
||||
@@ -2,25 +2,15 @@
|
||||
<div class="sidebar--logo">
|
||||
<a href="/">Liquid</a>
|
||||
</div>
|
||||
<nav class="sidebar--nav">
|
||||
|
||||
{% capture folders %}basics,tags,filters{% endcapture %}
|
||||
{% assign sections = folders | split: "," %}
|
||||
<nav class="sidebar--nav"> {% assign sections = "basics, tags, filters" | split: ", " %}
|
||||
|
||||
{% for section in sections %}
|
||||
<ul class="section">
|
||||
<li>
|
||||
<h3 class="section__header">{{ section | capitalize }}</h3>
|
||||
<ul class="section__links">
|
||||
{% for page in site.pages %}
|
||||
{% if page.path contains section/ %}
|
||||
{% unless page.path contains "index.html" %}
|
||||
<li><a href="{{ page.url | prepend: site.baseurl }}" class="section__link">{{ page.title }}</a></li>
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
<h3 class="section__header">{{ section | capitalize }}</h3>
|
||||
|
||||
<ul class="section__links">
|
||||
{% for page in site.pages %}{% if page.url contains section/ %}{% unless page.path contains "index" %}
|
||||
<li><a href="{{ page.url | prepend: site.baseurl }}" class="section__link">{{ page.title }}</a></li>
|
||||
{% endunless %}{% endif %}{% endfor %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
@@ -20,8 +20,11 @@
|
||||
|
||||
<div class="content__area">
|
||||
<div class="content__list">
|
||||
|
||||
<h1>{{ page.title }}</h1>
|
||||
|
||||
{{ content }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ $wrapper-width: 800px;
|
||||
|
||||
.section__links {
|
||||
margin-left: $spacing-unit / 2;
|
||||
margin-bottom: $spacing-unit;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: append
|
||||
---
|
||||
|
||||
`append` concatenates two strings and returns the concatenated value.
|
||||
Concatenates two strings and returns the concatenated value.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: capitalize
|
||||
---
|
||||
|
||||
`capitalize` makes the first character of your string capitalized.
|
||||
Makes the first character of a string capitalized.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: date
|
||||
---
|
||||
|
||||
`date` converts a timestamp into another date format. The format for this syntax is the same as [`strftime`](//strftime.net).
|
||||
Converts a timestamp into another date format. The format for this syntax is the same as [`strftime`](//strftime.net).
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: default
|
||||
---
|
||||
|
||||
`default` lets you specify a fallback in case a value doesn't exist. `default` will show its value if the left side is `nil`, `false`, or empty.
|
||||
Allows you to specify a fallback in case a value doesn't exist. `default` will show its value if the left side is `nil`, `false`, or empty.
|
||||
|
||||
In this example, `product_price` is not defined, so the default value is used.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: divided_by
|
||||
---
|
||||
|
||||
`divided_by` divides its input (left side) by its argument (right side). It uses `to_number`, which converts to a decimal value unless already a numeric.
|
||||
Divides a number by its argument.
|
||||
|
||||
The result is rounded down to the nearest integer (that is, the [floor](/filters/floor)).
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: downcase
|
||||
---
|
||||
|
||||
`downcase` makes each character in a string lowercase. It has no effect on strings which are already all lowercase.
|
||||
Makes each character in a string lowercase. It has no effect on strings which are already all lowercase.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: escape
|
||||
---
|
||||
|
||||
Escapes a string by replacing some characters with escape sequences (so that the string can be used in a URL, for example). It doesn't change strings that have nothing to escape.
|
||||
Escapes a string by replacing characters with escape sequences (so that the string can be used in a URL, for example). It doesn't change strings that don't have anything to escape.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: escape_once
|
||||
---
|
||||
|
||||
Escapes a string without changing existing escaped entities. It doesn't change strings that have nothing to escape.
|
||||
Escapes a string without changing existing escaped entities. It doesn't change strings that don't have anything to escape.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: first
|
||||
---
|
||||
|
||||
`first` returns the first element of an array without sorting the array.
|
||||
Returns the first item of an array.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: floor
|
||||
---
|
||||
|
||||
`floor` rounds the input down to the nearest whole number.
|
||||
Rounds a number down to the nearest whole number.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: join
|
||||
---
|
||||
|
||||
`join` combines the elements of an array into a single string using the string you provide as a separator.
|
||||
Combines the items in an array into a single string using the argument as a separator.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: last
|
||||
---
|
||||
|
||||
`last` returns the last element of an array without sorting the array.
|
||||
Returns the last item of an array.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: lstrip
|
||||
---
|
||||
|
||||
`lstrip` removes all whitespace (tabs, spaces, and newlines) from the left side of a string.
|
||||
Removes all whitespaces (tabs, spaces, and newlines) from a string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: minus
|
||||
---
|
||||
|
||||
`minus` subtracts the number passed in from the input number.
|
||||
Subtracts a number from another number.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: modulo
|
||||
---
|
||||
|
||||
`modulo` returns the remainder when the input is divided by the passed-in parameter.
|
||||
Returns the remainder of a division operation.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: newline_to_br
|
||||
---
|
||||
|
||||
Replace every newline (`\n`) with an HTML line break (`<br>`).
|
||||
Replaces every newline (`\n`) with an HTML line break (`<br>`).
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: plus
|
||||
---
|
||||
|
||||
`plus` adds the number passed in to the input number.
|
||||
Adds a number with another number.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: prepend
|
||||
---
|
||||
|
||||
`prepend` adds a string to the beginning of the input string.
|
||||
Concatenates a string to the beginning of a string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: remove
|
||||
---
|
||||
|
||||
`remove` removes every occurrence of of the passed-in substring from the input string.
|
||||
Removes every occurrence of an argument from a string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: remove_first
|
||||
---
|
||||
|
||||
`remove` removes the first occurrence of of the passed-in substring from the input string.
|
||||
Removes only the first occurrence of an argument from a string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: replace
|
||||
---
|
||||
|
||||
`replace` replaces every occurrence of the first passed-in string in the input string with the second passed-in string.
|
||||
Replaces every occurrence of an argument in a string with the second argument.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: replace_first
|
||||
---
|
||||
|
||||
`replace_first` replaces the first occurrence of the first passed-in string in the input string with the second passed-in string.
|
||||
Replaces only the first occurrence of an argument in a string with the second argument.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: reverse
|
||||
---
|
||||
|
||||
`reverse` reverses the order of the items in an array. `reverse` cannot reverse a string.
|
||||
Reverses the order of the items in an array. `reverse` cannot reverse a string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: round
|
||||
---
|
||||
|
||||
`round` rounds an input number to the nearest integer or, if a number is specified as a parameter, to that number of decimal places.
|
||||
Rounds an input number to the nearest integer or, if a number is specified as an argument, to that number of decimal places.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: rstrip
|
||||
---
|
||||
|
||||
`rstrip` removes all whitespace (tabs, spaces, and newlines) from the right side of a string.
|
||||
Removes all whitespace (tabs, spaces, and newlines) from the right side of a string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: size
|
||||
---
|
||||
|
||||
`size` returns the number of characters in a string or the number of items in an array. `size` can also be used with dot notation (for example, `{% raw %}{{ my_string.size }}{% endraw %}`). This allows you to use `size` inside other tags like conditionals.
|
||||
Returns the number of characters in a string or the number of items in an array. `size` can also be used with dot notation (for example, `{% raw %}{{ my_string.size }}{% endraw %}`). This allows you to use `size` inside tags such as conditionals.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: slice
|
||||
---
|
||||
|
||||
`slice` returns a substring of 1 character beginning at the index specified by the parameter passed in. An optional second parameter specifies the length of the substring to be returned.
|
||||
Returns a substring of 1 character beginning at the index specified by the argument passed in. An optional second argument specifies the length of the substring to be returned.
|
||||
|
||||
String indices are numbered starting from 0.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: split
|
||||
---
|
||||
|
||||
`split` divides an input string into an array using the passed-in substring as a separator. `split` is commonly used to convert comma-separated items from a string to an array.
|
||||
Divides an input string into an array using the argument as a separator. `split` is commonly used to convert comma-separated items from a string to an array.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: strip
|
||||
---
|
||||
|
||||
`strip` removes all whitespace (tabs, spaces, and newlines) from both the left and right sides of a string. It does not affect spaces between words.
|
||||
Removes all whitespace (tabs, spaces, and newlines) from both the left and right side of a string. It does not affect spaces between words.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: strip_html
|
||||
---
|
||||
|
||||
`strip_html` removes any HTML tags from a string.
|
||||
Removes any HTML tags from a string.
|
||||
|
||||
|
||||
```liquid
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: strip_newlines
|
||||
---
|
||||
|
||||
`strip_newlines` removes any newline characters (line breaks) from a string.
|
||||
Removes any newline characters (line breaks) from a string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: times
|
||||
---
|
||||
|
||||
`times` multiplies its input by its argument.
|
||||
Multiplies a number by another number.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: truncatewords
|
||||
---
|
||||
|
||||
`truncate` shortens a string down to the number of words passed as a parameter. If the number of words specified is less than the number of words in the string, an ellipsis (...) is appended to the string.
|
||||
Shortens a string down to the number of words passed as the argument. If the number of words specified is less than the number of words in the string, an ellipsis (...) is appended to the string.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: uniq
|
||||
---
|
||||
|
||||
`uniq` removes any duplicate elements in an array.
|
||||
Removes any duplicate elements in an array.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: upcase
|
||||
---
|
||||
|
||||
`upcase` makes each character in a string uppercase. It has no effect on strings which are already all uppercase.
|
||||
Makes each character in a string uppercase. It has no effect on strings which are already all uppercase.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: url_encode
|
||||
---
|
||||
|
||||
`url_encode` converts any URL-unsafe characters in a string into percent-encoded characters.
|
||||
Converts any URL-unsafe characters in a string into percent-encoded characters.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
|
||||
2
index.md
2
index.md
@@ -8,7 +8,7 @@ Liquid is an open-source template language created by [Shopify](https://www.shop
|
||||
|
||||
Liquid has been in production use since June 2006 and is now used by many other hosted web applications.
|
||||
|
||||
It was developed for usage in Ruby on Rails web applications and integrates seamlessly as a plugin but it also works well as a stand alone library.
|
||||
It was developed for usage in Ruby on Rails web applications and integrates seamlessly as a plugin but it also works well as a stand-alone library.
|
||||
|
||||
## Introduction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user