diff --git a/source/Ox/js/JavaScript.js b/source/Ox/js/JavaScript.js index e8bf4c3b..65adbf51 100644 --- a/source/Ox/js/JavaScript.js +++ b/source/Ox/js/JavaScript.js @@ -3,32 +3,6 @@ /*@ Ox.doc Generates documentation for annotated JavaScript (source) -> <[o]> Array of doc objects - arguments <[o]|u> Arguments (array of doc objects) - Present if the type of the item is - "function". - description Multi-line description with optional markup - See Ox.sanitizeHTML for details - events <[o]|u> Events (array of doc objects) - Present if the item fires any events - file File name - line Line number - name Name of the item - properties <[o]|u> Properties (array of doc objects) - Present if the type of the item is - "event", "function" - or "object". - section Section in the file - source <[o]> Source code (array of tokens) - column Column - line Line - type Type (see Ox.tokenize for a list of types) - value Value - summary One-line summary - usage <[o]> Usage (array of doc objects) - Present if the type of the item is - "function". - tests <[o]> Tests (array of test objects) - type Type of the item (file, callback) -> undefined (files, callback) -> undefined source JavaScript source code @@ -36,14 +10,65 @@ Ox.doc Generates documentation for annotated JavaScript files <[s]> Array of javascript files callback Callback function doc <[o]> Array of doc objects - # > Ox.doc("//@ My.FOO Magic constant\nMy.FOO = 23;") - # [{"name": "Ox.foo", "summary": "Magic constant", "type": "number"}] + arguments <[o]|u> Arguments (array of doc objects) + Present if the type of the item is + "function". + description Multi-line description with optional markup + See Ox.sanitizeHTML for details + events <[o]|u> Events (array of doc objects) + Present if the item fires any events + file File name + line Line number + name Name of the item + properties <[o]|u> Properties (array of doc objects) + Present if the type of the item is + "event", "function" + or "object". + section Section in the file + source <[o]> Source code (array of tokens) + column Column + line Line + type Type (see Ox.tokenize for a list of types) + value Value + summary One-line summary + usage <[o]> Usage (array of doc objects) + Present if the type of the item is + "function". + tests <[o]> Tests (array of test objects) + type Type of the item + + > Ox.test.doc[0].name + 'My.FOO' + > Ox.test.doc[0].types + ['number'] + > Ox.test.doc[0].summary + 'Magic constant' + > Ox.test.doc[1].description + 'Bar per baz is a good indicator of an item\'s foo-ness.' + > Ox.test.doc[1].usage[0].types + ['number'] + > Ox.test.doc[1].usage[0].summary + 'Bar per baz, or NaN' @*/ Ox.doc = (function() { - // fixme: dont require the trailing '@' var re = { item: /^(.+?) <(.+?)> (.+?)$/, - multiline: /^\/\*\@.*?\n([\w\W]+)\n.*?\@\*\/$/, + multiline: /^\/\*\@.*?\n([\w\W]+)\n.*?\@?\*\/$/, script: /\n(\s*