Last active
July 10, 2016 16:28
-
-
Save binary1230/cf2cf5bca6842d691931ff9c9b90f867 to your computer and use it in GitHub Desktop.
regexes to match ubersystem jinja template conversion
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
\{% (options) ([^\s]+) ([^\s]+) \%\} | |
{{ $1\($2,$3\) }} | |
\{\% (popup_link) (".*?") (".*?") \%\} | |
{{ macros.$1\($2,$3\) }} | |
\{\% (checkgroup) (.*)\.(.+) \%\} | |
{{ $2.html_$1('$3') }} | |
# can improve this by copying from yesno example | |
\{\{ (.+?(?=|))default:"" }} | |
{{ $1default('') }} | |
\{\{ (.+?(?=|))(datetime):(".*?") \}\} | |
{{ $1$2($3) }} | |
\{\{ (.+?(?=|))(yesno):(".*?") \}\} | |
{{ $1$2($3) }} | |
\{\% (checkbox) (.*)\.(.+) \%\} | |
{{ macros.$1($2, '$3') }} | |
# catch anything like: whatever|tag:"stuff" turn into whatever|tag("stuff"), also works for single quoted | |
\{\{ (.+?(?=|))(.*?):(["'].*?["']) | |
\{\{ $1$2($3) | |
\{% (stripe_form) ([^\s]+) ([^\s]+) \%\} | |
{{ $1\('$2',$3\) }} | |
\{\% (stripe_button) (".*?") \%\} | |
\{\{ macros.$1\($2\) \}\} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment