Following previous post about documentation
, I'm finally sticking to ASDoc. NaturalDocs seems... errr.. very natural, but I don't like the output nor it seems to be easy to modify. Om3ga
which nicely comes as an Ubuntu package but doesn't have AS3 support. Tried telling the tool it was Java and did output some stuff but I gave up (maybe too soon I have to admit).
So, back to ASDocs again. Modifying the output is not easy and requires going through the XSL templates. Something I wanted to do was add Google Analytics to the files so I did some
copy & paste
research and got it working.
First, you should create your own template. Go to asdoc/templates and copy that folder somewhere else. Then pass it as a parameter to the compiler:
[code lang="actionscript"]--templates-path path/to/your/template/folder[/code]
Doing this you don't mess up Adobe's original files. Now we work all the time modifying your template. Open asdoc-utils.xsl and add this somewhere:
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
var pageTracker = _gat._getTracker("XXXXXXXX"); // change this for your tracking id.
And now you have to add this template to your files. I'd love to have a single template where add this and be done, but sadly you have to add it to a bunch of files. If there's such a central place, please let me know. Until then, open these files: class-summary.xsl, all-index.xsl, class-files.xsl, package-detail.xsl and package-summary.xsl (there are other files, but they are always shown on the frames, when one of these is already being displayed).
Now search for "</head>" and add this just before:
[code lang="xml"]<xsl:call-template name="gAnalytics"/>[/code]
Export and you are good to go, Analytics on your API