I can only give you some pointers based on work I recently did to generate CIX catalogs for Angular.js and Ember.js.
The first thing you need to do is figure out how you’re going to parse handlebarsjs files. I am not familiar with it so I can’t help there. If they are using yuidoc to document their JS classes, methods, etc. then you may be able to modify the “src/codeintel/support/gencix/javascript/ember/ember_json_to_cix.py” script to suit your needs. AngularJS does not play nice with yuidoc (or any other documentation generator other than their horrendously ill-documented in-house one), so I had to create my own parser to read their comment tags.
Whichever way you end up going, the first thing you need to do is run “source bin/setenv.sh” from the “src/codeintel” directory. This will load codeintel’s CIX generator Python libraries into your PYTHONPATH.
Once you do that, you can cd
into “src/codeintel/support/gencix/javascript/angular” or “src/codeintel/support/gencix/javascript/ember” and use python
to run either .py
file. That will generate angular and ember cix files for your reference.
If you want to write your own CIX generator from scratch, you basically need to create the following:
- CIX root via Python
createCixRoot()
- this is the toplevel XML declaration of the catalog.
- CIX file via
createCixFile()
- this is the tag that contains all of your classes, functions, etc. for your framework.
- CIX module via
createCixModule()
- this is also a tag that contains all of your classes, functions, etc.
- Each namespace/class will be added to your CIX module object.
- Each function will be added to either your CIX module object (for global functions) or any namespace/class CIX objects you create.
- Documentation can be attached to namespaces, classes, and functions via
setCixDoc()
.
I know this is a lot of information to take in, but have a look at the angular and ember CIX generators. They should make some level of sense (probably more than the others, which I found to be haphazard and poorly documented).