mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
26 lines
697 B
JavaScript
26 lines
697 B
JavaScript
(function() {
|
|
|
|
load(BASEDIR + '/templates/lib/janl/mustache.js');
|
|
|
|
publish = function(docs, opts) {
|
|
docs.doc.filter(function($) {
|
|
$.desc = linkify($.desc);
|
|
$.path = "<a name='"+symbolnameToLinkname($.path)+"'>" + $.path + '</a>';
|
|
});
|
|
var template = readFile(BASEDIR + '/templates/default/tmpl/index.html');
|
|
print(Mustache.to_html(template, docs));
|
|
}
|
|
|
|
function linkify(text) {
|
|
if (typeof text === 'string') {
|
|
return text.replace(/\{@link\s+(.+?)(:? (.+?))?\}/gi, function(str, p1, p2, offset, s) {
|
|
return "<a href='?doc=" + encodeURIComponent(symbolnameToLinkname(p1)) + "'>" + (p2 || p1) + '</a>';
|
|
});
|
|
}
|
|
}
|
|
|
|
function symbolnameToLinkname(symbolName) {
|
|
return symbolName;
|
|
}
|
|
|
|
})(); |