Created
February 11, 2018 00:13
-
-
Save midnai/a5c93ae6a15d006441e3a2a520dfdc7f to your computer and use it in GitHub Desktop.
Get a resume from a big text in twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for d in data %} | |
{% set text = d.resumen |split(' ') %} | |
{% set t2 = '' %} | |
{% if text|length > 10 %} | |
{% for t in text|slice(0, 10) %} | |
{% set t2 = t2 ~ ' ' ~ t %} | |
{% endfor %} | |
{% set t2 = t2 ~ '...' %} | |
{% else %} | |
{% set t2 = text|join(' ') %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment