You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
carto/test/index.html

57 lines
1.5 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Carto Test</title>
<script src='underscore.js' type='text/javascript'></script>
12 years ago
<script src='reference.js' type='text/javascript'></script>
<script src='../dist/carto.js' type='text/javascript'></script>
<script>
function test() {
var style = document.getElementById('style').innerHTML;
var parse_env = {
error: function(obj) {
document.getElementById('error').innerHTML += JSON.stringify(obj);
}
};
var ruleset = (new carto.Parser(parse_env)).parse(style);
var definition = ruleset.toList(parse_env);
console.log(definition);
console.log(window.a = (new carto.RendererJS()).render(style));
// for (var i in ruleset.rules) {
// for (var j in ruleset.rules[i].rules) {
// document.getElementById('output').innerHTML += ruleset.rules[i].rules[j].eval(parse_env).toXML(parse_env) + ' ';
// }
// }
}
</script>
</head>
<body onload='test()'>
<h3>Style</h3>
<pre id='style'>
#world {
line-width: 2;
line-color: #f00;
[frame-offset = 1] {
line-width: 3;
}
[frame-offset = 2] {
line-width: 3;
}
}
#worls[frame-offset = 10] {
line-width: 4;
}
</pre>
<h3>Error</h3>
<pre id='error'>
</pre>
<h3>Output</h3>
<pre id='output'>
</pre>
</body>
</html>