Last active
April 6, 2016 13:47
-
-
Save alextea/12ecab18cc3ebebb86fe7064e4801fa1 to your computer and use it in GitHub Desktop.
Regular expressions for converting mustache to nunjucks
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
# template tag | |
\{\{<([^}]+)\}\} | |
{% extends "$1.html" %} | |
# includes tag | |
\{\{>([^}]+)\}\} | |
{% include "$1.html" %} | |
# block tag | |
\{\{\$([^}]+)\}\} | |
{% block $1 %} | |
# for loops and if conditionals | |
\{\{#([^}]+)\}\} | |
{% for i in $1 %} | |
{% if $1 %} | |
# if false conditionals | |
\{\{\^([^}]+)\}\} | |
{% if $1 != true %} | |
# closing tags | |
\{\{/[^}]+\}\} | |
{% endblock %} | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment