I am creating a small library for parsing XML documentation in Javascript files in the following format:
/// <doc type="function" name="parse">
/// <summary>Parses javascript documentation</summary>
/// <param name="js" type="string">Javascript input</param>
/// </doc>
var parse = function(js) { ... };
/// <doc type="string">
/// <summary>Holding the version of our library</summary>
/// </doc>
var VERSION = '0.0.1';
I have to create a regular expression that returns the content between the and tags. I've tried the following regular expression but it failed:
var xmlComments = js.match(/ \/\/\/(\s)<doc(.*)>(.*)<\/doc>/gi /);
But the match did not work, I hope someone can help me with this regular expression, thanks.
parse? In other words: how do you get the doc comment from the source?