Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing Javascript files with phpDocumentor

I've been playing with phpDocumentor recently and found it quite suitable for my needs. I'm largely working with PHP/HTML/JS/CSS codebases and would like phpDocumentor to parse my Javascript (and perhaps CSS) in order to keep it all together.

I've managed to get phpdoc to parse javascript files contained throughout the codebase - however it rejects the page-level docblock - which results in it rejecting the various tags (see below). I've found that by adding in a PHP open tag (with a JavaScript comment before it) to the top of the JavaScript file, I can get it to parse it just like a PHP file.

// <?php
/**
 * phpdoc goes here
 * @package
 * @todo
 *   - Todo 1
 *   - Todo 2
 */
function javascript(goes, here) {
}

I can think of a problem occurring should the webserver be setup to server .js files through PHP. Are there any other problems anyone can think of? Is there a better way to accomplish this?

Thanks

like image 559
ncatnow Avatar asked Dec 14 '22 01:12

ncatnow


1 Answers

I think it's a bit naive assumption to think there is no similar tool for JavaScript.

There is a tool called JSDoc which is basically the same as phpdoc, but for JavaScript.


Update Friday, May 1, 2015:-

It seems like that the new project link is:-

https://github.com/jsdoc3/jsdoc

like image 169
Jani Hartikainen Avatar answered Dec 25 '22 23:12

Jani Hartikainen