Created
January 31, 2010 03:00
-
-
Save neonstalwart/290871 to your computer and use it in GitHub Desktop.
a script to do the conversion of dojo's api.xml into scriptdoc format
This file contains hidden or 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
dojo.require('dojox.dtl'); | |
dojo.require("dojox.dtl.Context"); | |
dojo.addOnLoad(function(){ | |
var url = 'http://download.dojotoolkit.org/release-1.4.0/api.json'; | |
dojo.xhrGet({ | |
url: url, | |
handleAs: "json" | |
}).addCallback(function(data){ | |
var template = new dojox.dtl.Template( | |
'<?xml version="1.0" encoding="utf-8"?>'+ | |
'<javascript>{% for key, obj in api.items %}{% if obj.classlike %}\n'+ | |
'\t<class type="{{ key }}">{% if obj.summary or obj.description %}\n'+ | |
'\t\t<description>{% if obj.summary %}\n'+ | |
'\t\t\t{{ obj.summary }}{% endif %}{% if obj.description %}\n'+ | |
'\t\t\t{{ obj.description }}{% endif %}\n'+ | |
'\t\t</description>{% endif %}\n'+ | |
'\t</class>\n{% endif %}{% endfor %}'+ | |
'</javascript>', true); | |
var context = new dojox.dtl.Context({ | |
api: data | |
}); | |
var str = template.render(context); | |
console.log(str); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment