Created
August 19, 2016 15:16
-
-
Save rpowis/b6da2ce2c553ebe42457aa2439f2455e to your computer and use it in GitHub Desktop.
Convert mustache/hogan templates to nunjucks.
This file contains hidden or 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
#### REPLACE LAYOUTS | |
{{<layouts(.*)}}((.|\n)*){{\/(.*)}} | |
replace with | |
{% extends "$1.html" %} $2 | |
#### REPLACE BLOCK TITLES | |
{{\$(\w+)}} | |
((.|\n)*) | |
{{\/(\w+)}} | |
replace with | |
{% block $1 %} \r $2 \r {% endblock %} | |
#### REPLACE INCLUDES | |
{{>(.*)}} | |
replace with | |
{% include "$1.html" %} | |
#### IF TRUE | |
{{#(.*)}}((.|\n)*){{\/(.*)}} | |
replace with | |
{% if $1 %} \r $2 \r {% endif %} | |
#### IF NOT TRUE | |
{{\^(.*)}}((.|\n)*){{\/(.*)}} | |
replace with | |
{% if not $1 %} \r $2 \r {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use the regular expressions in Sublime. You'll to enable the Regex by clicking on the ".*" option in the 'Search and Replace' screen.