Created
September 20, 2013 19:29
-
-
Save hyperking/6642615 to your computer and use it in GitHub Desktop.
Split Key Value Pairs multiple times using jinja template
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
{% if article.productvariations %} | |
{% for category_groups in article.productvariations.split('|') %} | |
{% for category in category_groups.split('=') %} | |
{% if loop.first %} | |
<h1>{{ category }}</h1> | |
{% else %} | |
<ul> | |
{% for list in category.split(',') %} | |
{% set itemvalues = list.split(':') %} | |
<li>{{ itemvalues[0] }} costs {{itemvalues [1]}} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% endfor %} | |
{% endfor %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to talha131 for help on this solution
https://gist.github.com/talha131/6642646#file-hyperking-prob-sol-1