Created
August 13, 2013 11:50
-
-
Save juliandescottes/6220354 to your computer and use it in GitHub Desktop.
Some helpful macros for aria templates.
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
// Log any object in the console | |
{macro _log(obj)} | |
${(function(){console.log(obj)})()} | |
{/macro} | |
// create a section with a one-liner : {call _section("mysection", "boundvalue", "div")/} | |
{macro _section(id, bindings, type, css)} | |
{var _gb = null /} | |
${(function(){_gb=function(b){return {inside:data,to:b}}})()} | |
${(function(){bindings=Array.isArray(bindings)?bindings.map(function(b){return _gb(b)}):[_gb(bindings)]})()} | |
${(function () {type = type ? type : "div"; return ""})()} | |
{section { | |
id : id, | |
type : type, | |
macro : id, | |
bindRefreshTo : bindings, | |
cssClass : css || undefined | |
}/} | |
{/macro} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment