Skip to content

Instantly share code, notes, and snippets.

@juliandescottes
Created August 13, 2013 11:50
Show Gist options
  • Save juliandescottes/6220354 to your computer and use it in GitHub Desktop.
Save juliandescottes/6220354 to your computer and use it in GitHub Desktop.
Some helpful macros for aria templates.
// 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