ruleset html { meta { provides header, footer, cookies shares __testing } global { __testing = { "queries": [ { "name": "__testing" } //, { "name": "entry", "args": [ "key" ] } ] , "events": [ //{ "domain": "d1", "type": "t1" } //, { "domain": "d2", "type": "t2", "attrs": [ "a1", "a2" ] } ] } header = function(title,scripts) { << #{title} #{scripts.defaultsTo("")} >> } footer = function() { << >> } cookies = function(_headers) { arg = event:attr("_headers") || _headers arg{"cookie"}.isnull() => {} | arg{"cookie"} .split("; ") .map(function(v){v.split("=")}) .collect(function(v){v.head()}) .map(function(v){v.head()[1]}) } } }