2015-01-11 23:28:02 +01:00
|
|
|
|
<?
|
|
|
|
|
|
|
|
|
|
function anchorify(str)
|
|
|
|
|
{
|
|
|
|
|
// how github creates the name attribute for anchors from headlines
|
|
|
|
|
|
|
|
|
|
str = str.replace(/[()<>.]/g, "");
|
|
|
|
|
str = str.replace(/[^a-z0-9_-]+/gi, "-");
|
|
|
|
|
str = str.toLowerCase();
|
|
|
|
|
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
docfiles.forEach(function(doc)
|
|
|
|
|
{
|
|
|
|
|
doc.javadoc.forEach(function(comment)
|
|
|
|
|
{
|
|
|
|
|
var tags = comment.raw.tags;
|
|
|
|
|
|
|
|
|
|
comment.tagsByType = comment.raw.tags.reduce(function(result, tag)
|
|
|
|
|
{
|
|
|
|
|
result[tag.type] = tag;
|
|
|
|
|
return result;
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
comment.ignore = "ignore" in comment.tagsByType;
|
|
|
|
|
|
|
|
|
|
if(comment.name && !comment.ignore)
|
|
|
|
|
{
|
|
|
|
|
if(comment.isMethod || comment.isFunction)
|
|
|
|
|
{
|
|
|
|
|
var args = comment.paramTags.map(function(c)
|
|
|
|
|
{
|
|
|
|
|
return c.joinedTypes + " " + c.name;
|
|
|
|
|
}).join(", ");
|
|
|
|
|
|
|
|
|
|
var returnVal = "";
|
|
|
|
|
|
|
|
|
|
if(comment.returnTags[0])
|
|
|
|
|
{
|
|
|
|
|
returnVal = " -> " + comment.returnTags[0].joinedTypes;
|
|
|
|
|
}
|
|
|
|
|
comment.args = args;
|
|
|
|
|
comment.returnVal = returnVal;
|
|
|
|
|
comment.longName = comment.name + "(" + comment.args + ")" + comment.returnVal;
|
|
|
|
|
|
|
|
|
|
?><?= "- [`" + comment.longName + "`](#" + anchorify(comment.longName) + ")\n" ?><?
|
|
|
|
|
} else {
|
|
|
|
|
?># <?= comment.name + "\n" ?><?
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
doc.javadoc.forEach(function(comment)
|
|
|
|
|
{
|
|
|
|
|
if(!comment.ignore)
|
|
|
|
|
{
|
|
|
|
|
?><?= "\n***\n" ?><?
|
|
|
|
|
|
|
|
|
|
if(comment.name)
|
|
|
|
|
{
|
|
|
|
|
if(comment.isMethod || comment.isFunction)
|
|
|
|
|
{
|
|
|
|
|
?><?= "#### `" + comment.longName + "`\n" ?><?
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
?><?= "## `" + comment.name + "`\n" ?><?
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-12 22:02:58 +02:00
|
|
|
|
|
|
|
|
|
if(comment.deprecated)
|
|
|
|
|
{
|
|
|
|
|
?><?= "\n\n**Deprecated - Might be removed in a later release.**\n\n" ?><?
|
|
|
|
|
}
|
2015-01-11 23:28:02 +01:00
|
|
|
|
|
|
|
|
|
?><?= comment.description + "\n" ?><?
|
|
|
|
|
|
2015-04-12 22:02:58 +02:00
|
|
|
|
|
2015-01-11 23:28:02 +01:00
|
|
|
|
if(comment.paramTags.length)
|
|
|
|
|
{
|
|
|
|
|
?><?= "**Parameters:**\n\n" ?><?
|
|
|
|
|
|
|
|
|
|
comment.paramTags.forEach(function(paramTag, i)
|
|
|
|
|
{
|
2015-01-19 23:15:11 +01:00
|
|
|
|
?><?= (i + 1) + ". **`" + paramTag.joinedTypes + "`** " + (paramTag.optional ? "(optional) " : "") + paramTag.name + " " + (paramTag.description ? "– " + paramTag.description : "") + "\n" ?><?
|
2015-01-11 23:28:02 +01:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(comment.returnTags.length)
|
|
|
|
|
{
|
|
|
|
|
?><?= "**Returns:**\n\n" ?><?
|
|
|
|
|
|
|
|
|
|
comment.returnTags.forEach(function(returnTag)
|
|
|
|
|
{
|
|
|
|
|
?><?= "* **`" + returnTag.joinedTypes + "`** " + returnTag.description + "\n" ?><?
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-01-11 23:36:03 +01:00
|
|
|
|
?><?= "\n<!-- " + doc.filename + "-->\n" ?><?
|
2015-01-11 23:28:02 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<!-- vim: set tabstop=2 shiftwidth=2 softtabstop=2: -->
|