File: liquid

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (141 lines) | stat: -rw-r--r-- 3,373 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{% raw %}
some {{raw}} liquid syntax

{% raw %}
{% endraw %}

Just regular text - what happens?

{% comment %}My lovely {{comment}} {% comment %}{% endcomment %}

{% comment %}
  My lovely {{comment}} that is split
  across multiple lines {% comment %}
{% endcomment %}

{% custom_tag param1: true param2 : nil %}
{% custom_block my="abc" c = var %}
  Just usual {{liquid}}.
{% endcustom_block %}

{% another_tag "my string param" %}

{{ variable | upcase }}
{{ var . field | textilize | markdownify }}
{{ var.field.property | textilize | markdownify }}
{{ -3.14 | abs }}
{{ 'string' | truncate: 100 param='df"g' }}
{{ variable.null? }}

{% capture name %}
{{- title | downcase | slice: -3, 2 -}}
{% endcapture %}

{% cycle "width: 1em", 2, var %}
{% cycle 'group1': '1', var, 2 %}
{% cycle group2 : '1', var, 2 %}

{% if a == 'B' %}
Testing {{ some }} stuff.
{% elsif a != 'C%}' %}
{% elsif c and d or e == empty %}
{% else %}
{% endif %}

{% unless a.empty? %}
Some {{ output }} right here.
{% else %}
{% endunless %}

{% case a.first %}
{% when 'B' or -1 %}
Some {{ output }}!
{% when 'C', 4 %}
Some other {{ output }}!
{% else %}
{% endcase %}

{% include dir/file.html param="example.com" param2 = object.property %}
{% include 'snippet', param: 'example.com', param2 : object.property %}
{% include product_pages[3] with products[0] as product %}
{% include {{-product_page | split: "." | first-}} for products %}

{% assign page_has_image = false %}
{%-assign img_tag = '<' | append: "img" | downcase-%}
{% if link.object.content contains img_tag %}
  {% assign src = link.object.content | split: 'src="' %}
  {% assign src = src[1] | split: '"' | first %}
    {% if src.size > 0 %}
      {% assign page_has_image = true %}
      {% assign image_src = src | replace: '_small', '' | replace: '_compact', '' | replace: '_medium', '' |
                                  replace: '_large', '' | replace: '_grande', '' %}
    {% endif %}
{% endif %}

{% if page_has_image %}
  <a href="{{ link.object.url }}">
    <img src="{{ image_src }}" alt="{{ link.object.title }}">
  </a>
 {% else %}
  <a href="{{ link.object.url }}">
    {{ 'blank-page-image.jpg' | asset_url | img_tag: shop.name }}
  </a>
{% endif %}

{% tablerow page in site.pages cols:num limit:3 %}
  {% if page.layout == 'home' and tablerowloop.col_first %}
    {{ page.excerpt }}
  {% endif %}
{% endtablerow %}

{% for i in (1..5) %}
  {% if i > 4 %}
    {% break %}
  {% else %}
    {% continue %}
  {% endif %}
{% endfor %}

{% for item in array reversed limit:2 %}
  Item {{ forloop.index0 }}: {{ item.name }}
{% endfor %}

{% for item in array, offset:continue %}
  {% increment var %}
{% endfor %}

{% for item in site.data[path] reversed %}
  {% decrement var %}
{% endfor %}

{% assign range = (3 .. 5) %}
{% for i in range %}
  {% render "snippet", number: i %}
{% endfor %}

{% assign num- = 4 %}
{% for i in (1..num-) %}
  {%-if forloop.first-%}{{ i }}{%-endif-%}
{% endfor %}

{% for char in 'The Quick Brown Fox' %}
  {{ char | upcase #| append: "inline comment" }}
{% endfor %}

{% for char in "Hello World" reversed %}
  {% echo char | url_encode %}
{% endfor
  # inline comment %}

{% liquid %}
{% liquid
  # multiline comment
  ###################
  assign size = "one two" | split: " "
  for value in size
    echo value
    unless forloop.last
      echo ", "
    endunless
  endfor
%}