tera
tera copied to clipboard
Added substr, find and rfind
Added substr, find and rfind into src/builtsin/filters/string.rs
Substr motivated by providing a descriptive href link opposed to the common ...more.
Used as such with Zola
{{page.content | striptags | substr(begin = 0, length=300) | safe}}
<a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{page.content | striptags | substr(begin = 300, length=30) | safe}}...</a>
find and rfind used to facilitate ending on a word end or period in the link rfind(" ") or rfind(".")
Tests included for all also within string.rs