Skip to content

Functions List

tacoen edited this page Jan 14, 2021 · 10 revisions

In usage

pop: {{ popularity('monthly')|raw  }}
{{ fileget(page.path()~"/coba.txt")|raw }}

Filters

stripper

Syntax: stripper([text],[compress])

Strip empty lines, trailing spaces, leading spaces.

param type
text string
compress boolean
{% set multiline = 'what are worldwide web' %}
{{ multiline|stripper(true) }}

Functions

filedir

Syntax: filedir([relative_path_to_root],[pattern])

param type
relative_path_to_root string
pattern string
{% for file in filedir('/user/themes/neoca/particles/tema','*.html.twig') %}

   {% set f = file|replace({
	'/user/themes/neoca/particles/tema/':'',
	'.html.twig':''
   }) %}

   {{ f|raw }}

{% endfor %}

fileget

Syntax: `fileget([filename])'

param type
filename string
{% set content = fileget('/user/themes/neoca/particles/tema/file.txt') %}

{{ content|markdown|raw }}

randomwords

syntax: {{ randomwords([count]) }}

param type
count int

gasvara

Put string to config. gas

Syntax: gasvara([where],[string])

You can output this array by {{ config.gas.where|print_r }}

param type
where string
string string
{% set module_injectjs = module_injectjs ~ "ncc_construct_pallete('#"~id~"');" %}
{% do gasvara('inline_js',module_injectjs) %}

{# output #}

{{ config.gas.inline_js|sort|join('\n')|stripper|raw }}
Clone this wiki locally