add new format for jsdoc

This commit is contained in:
Aleksey Chichenkov 2020-03-31 14:06:26 +03:00
parent eeb2b01574
commit 7c96a53766
19 changed files with 2575 additions and 24 deletions

View file

@ -251,6 +251,7 @@ function generate(title, docs, filename, resolveLinks) {
}
fs.writeFileSync(outpath, html, 'utf8');
return outpath;
}
function generateSourceFiles(sourceFiles, encoding) {
@ -650,6 +651,7 @@ var find_first_members = function (_parent, _clss) {
global.typedefs = {};
global.mainpage_content = [];
global.cusomData = Object.create(null);
var find_tag_by_id = function (_tags, _tag_id) {
for (var a = 0; a < _tags.length; a++) {
@ -718,17 +720,27 @@ exports.publish = function(taffyData, opts, tutorials) {
helper.addEventListeners(data);
data().each(function(doclet){
// console.log(doclet);
if(doclet.kind == "typedef") {
typedefs[doclet.longname] = doclet;
}
if(doclet.tags && find_tag_by_id(doclet.tags, "mainpage")){
// console.log(doclet);
mainpage_content.push(doclet);
}
if(doclet.meta && doclet.meta.path) {
var path = doclet.meta.path.split("/");
if(path[path.length - 1] === "custom") {
var id = doclet.meta.filename.split(".")[0];
if (!cusomData[id])
cusomData[id] = [];
if (doclet.tags && find_tag_by_id(doclet.tags, id))
cusomData[id].push(doclet);
}
}
});
@ -877,6 +889,7 @@ exports.publish = function(taffyData, opts, tutorials) {
// add template helpers
view.content = mainpage_content;
view.cusomData = cusomData;
view.find = find;
view.linkto = linkto;
view.replace_enters_to_br = replace_enters_to_br;
@ -910,9 +923,25 @@ exports.publish = function(taffyData, opts, tutorials) {
).concat(files), indexUrl);
console.log("outdir", outdir)
// console.log("indexUrl", indexUrl)
for(var id in cusomData) {
var out = generate(id,
packages.concat(
[{
subkind: id,
kind: 'custom',
readme: opts.readme,
longname: id
}]
).concat(files), id + ".html");
console.log("generate", id, out)
}
var sih = require("./search_inheritance.js");
var inh_struct = sih.find(env.conf, helper, logger, generate);

View file

@ -93,6 +93,12 @@ div.part > div.desc {
padding: 5px;
}
pre.source {
margin-top: 5px;
margin-bottom: 5px;
}
div.container-overview > .desc > pre,
div.part > pre {
margin: 0px;
@ -194,3 +200,15 @@ h4, h4 a
.compact-method * {
word-spacing: 0px;
}
h3 > a.title {
cursor: pointer;
text-decoration: none;
}
h5 {
margin-block-start: 0;
margin-block-end: 0;
margin-top: 0;
margin-bottom: 0;
}

View file

@ -197,7 +197,7 @@ h5, .container-overview .subsection-title
font-size: 120%;
font-weight: bold;
letter-spacing: -0.01em;
margin: 8px 0 3px 0;
/*margin: 8px 0 3px 0;*/
}
.container-overview > h3 {
@ -235,6 +235,7 @@ table
td, th
{
background-color: #ffffff63;
border: 1px solid #ddd;
margin: 0px;
text-align: left;

View file

@ -18,8 +18,16 @@
isGlobalPage = (doc.kind === 'globalobj');
}
?>
<?js if (doc.kind === 'mainpage' /* || (doc.kind === 'package') */) { ?>
<?js if (doc.kind === 'custom') { ?>
<?js= self.partial('custom.tmpl', doc) ?>
<?js } else if (doc.kind === 'mainpage') { ?>
<?js= self.partial('mainpage.tmpl', doc) ?>
<?js } else if (doc.kind === 'other') { ?>
<?js= self.partial('other.tmpl', doc) ?>
<?js } else if (doc.kind === 'source') { ?>
<?js= self.partial('source.tmpl', doc) ?>
<?js } else { ?>

View file

@ -0,0 +1,16 @@
<?js
var data = obj;
var self = this;
?>
<style>
div#main section {
display: none;
}
</style>
<?js= self.partial('mainpage/each.tmpl', self.cusomData[data.subkind]) ?>
<?js if (data.kind === 'package') { ?>
<h3><?js= data.name ?> <?js= data.version ?></h3>
<?js } ?>