Mercurial > doc-thingy
changeset 10:5418d21d7751
Only comment blocks that begin with heading-style wiki markup are treated as documentation now.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Mon, 05 Jan 2009 21:31:56 -0800 |
parents | 8a87f49fea8b |
children | d0e32e673d94 |
files | samplecode.js thingy.js |
diffstat | 2 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/samplecode.js Mon Jan 05 18:44:30 2009 -0800 +++ b/samplecode.js Mon Jan 05 21:31:56 2009 -0800 @@ -61,6 +61,8 @@ scriptError.init(aMessage, aSourceName, aSourceLine, aLineNumber, aColumnNumber, aFlags, aCategory); + // All that was done for naught. + return "blarg"; }
--- a/thingy.js Mon Jan 05 18:44:30 2009 -0800 +++ b/thingy.js Mon Jan 05 21:31:56 2009 -0800 @@ -26,23 +26,26 @@ lines, function(lineNum) { var line = this; + var isCode = true; var isComment = (App.trim(line).indexOf("//") == 0); - if (!isComment) { - codeText += line + "\n"; - return; + if (isComment) { + var startIndex = line.indexOf("//"); + var text = line.slice(startIndex + 3); + if (lineNum == lastCommentLine + 1) { + blockText += text + "\n"; + lastCommentLine += 1; + isCode = false; + } else if (text[0] == "=") { + maybeAppendBlock(); + firstCommentLine = lineNum; + lastCommentLine = lineNum; + blockText = text + "\n"; + codeText = ""; + isCode = false; + } } - var startIndex = line.indexOf("//"); - var text = line.slice(startIndex + 3); - if (lineNum == lastCommentLine + 1) { - blockText += text + "\n"; - lastCommentLine += 1; - } else { - maybeAppendBlock(); - firstCommentLine = lineNum; - lastCommentLine = lineNum; - blockText = text + "\n"; - codeText = ""; - } + if (isCode) + codeText += line + "\n"; }); maybeAppendBlock();