Review documentation plus some tools fix (#5100)

* review 3.5.0 doc

* fix documentation

* fix documentation

* fix documentation
This commit is contained in:
Eugenio Romano
2019-09-26 10:27:04 +01:00
committed by GitHub
parent bfc7e91eb6
commit 3dc92beeb9
83 changed files with 3717 additions and 41598 deletions

View File

@@ -91,7 +91,7 @@ var MethodSigInfo = /** @class */ (function () {
this.name = sourceData.name;
this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
if (!this.docText) {
if (!this.docText && this.name.indexOf('service') > 0) {
this.errorMessages.push("Warning: method \"" + sourceData.name + "\" has no doc text.");
}
this.returnType = sourceData.syntax['return'].type || '';
@@ -101,7 +101,7 @@ var MethodSigInfo = /** @class */ (function () {
if (this.returnDocText.toLowerCase() === 'nothing') {
this.returnsSomething = false;
}
if (this.returnsSomething && !this.returnDocText) {
if (this.returnsSomething && !this.returnDocText && this.name.indexOf('service') > 0) {
this.errorMessages.push("Warning: Return value of method \"" + sourceData.name + "\" has no doc text.");
}
this.isDeprecated = false;
@@ -116,7 +116,7 @@ var MethodSigInfo = /** @class */ (function () {
var paramStrings = [];
if (sourceData.syntax.parameters) {
sourceData.syntax.parameters.forEach(function (rawParam) {
if (!rawParam.description) {
if (rawParam.name && !rawParam.description && !rawParam.name.startWith('on')) {
_this.errorMessages.push("Warning: parameter \"" + rawParam.name + "\" of method \"" + sourceData.name + "\" has no doc text.");
}
var param = new ParamInfo(rawParam);

View File

@@ -132,7 +132,7 @@ export class MethodSigInfo {
this.docText = sourceData.summary || '';
this.docText = this.docText.replace(/[\n\r]+/g, ' ').trim();
if (!this.docText) {
if (!this.docText && this.name.indexOf('service') > 0) {
this.errorMessages.push(`Warning: method "${sourceData.name}" has no doc text.`);
}
@@ -145,7 +145,7 @@ export class MethodSigInfo {
this.returnsSomething = false;
}
if (this.returnsSomething && !this.returnDocText) {
if (this.returnsSomething && !this.returnDocText && this.name.indexOf('service') > 0) {
this.errorMessages.push(`Warning: Return value of method "${sourceData.name}" has no doc text.`);
}
@@ -165,7 +165,7 @@ export class MethodSigInfo {
if (sourceData.syntax.parameters) {
sourceData.syntax.parameters.forEach(rawParam => {
if (!rawParam.description) {
if (rawParam.name && !rawParam.description && !rawParam.name.startWith('on')) {
this.errorMessages.push(`Warning: parameter "${rawParam.name}" of method "${sourceData.name}" has no doc text.`);
}

View File

@@ -143,10 +143,11 @@ function getMDMethodParams(methItem) {
paramName = paramNameNode.text().item.value.replace(/:/, '');
}
else {
paramName = paramListItem.childNav
.paragraph().childNav
.strong().childNav
.text().item.value;
var item = paramListItem.childNav.paragraph().childNav
.strong().childNav.text();
if (paramName) {
paramName = item.value;
}
}
var paramDoc = paramListItem.childNav
.paragraph().childNav

View File

@@ -87,28 +87,28 @@ function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
const nav = new MDNav(tree);
const classMemHeading = nav
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
});
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
});
const propsTable = classMemHeading
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === sectionHeading);
}).table();
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === sectionHeading);
}).table();
let propTableRow = propsTable.childNav
.tableRow(() => true, 1).childNav;
.tableRow(() => true, 1).childNav;
let i = 1;
while (!propTableRow.empty) {
const propName = propTableRow
.tableCell().childNav
.text().item.value;
.tableCell().childNav
.text().item.value;
const propDocText = propTableRow
.tableCell(() => true, docsColumn).childNav
.text().item;
.tableCell(() => true, docsColumn).childNav
.text().item;
if (propDocText) {
result[propName] = propDocText.value;
@@ -116,7 +116,7 @@ function getPropDocsFromMD(tree, sectionHeading, docsColumn) {
i++;
propTableRow = propsTable.childNav
.tableRow(() => true, i).childNav;
.tableRow(() => true, i).childNav;
}
return result;
@@ -128,24 +128,24 @@ function getMethodDocsFromMD(tree) {
const nav = new MDNav(tree);
const classMemHeading = nav
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
});
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === 'Class members');
});
const methListItems = classMemHeading
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === 'Methods');
}).list().childNav;
.heading(h => {
return (h.children[0].type === 'text') && (h.children[0].value === 'Methods');
}).list().childNav;
let methItem = methListItems
.listItem();
.listItem();
let i = 0;
while (!methItem.empty) {
const methNameSection = methItem.childNav
.paragraph().childNav
.strong().childNav;
.paragraph().childNav
.strong().childNav;
let methName = '';
@@ -154,9 +154,9 @@ function getMethodDocsFromMD(tree) {
methName = methNameSection.text().item.value;
const methDoc = methItem.childNav
.paragraph().childNav
.html()
.text().value;
.paragraph().childNav
.html()
.text().value;
const params = getMDMethodParams(methItem);
@@ -169,7 +169,7 @@ function getMethodDocsFromMD(tree) {
i++;
methItem = methListItems
.listItem(l => true, i);
.listItem(l => true, i);
}
return result;
@@ -181,27 +181,30 @@ function getMDMethodParams(methItem: MDNav) {
const paramList = methItem.childNav.list().childNav;
const paramListItems = paramList
.listItems();
.listItems();
paramListItems.forEach(paramListItem => {
const paramNameNode = paramListItem.childNav
.paragraph().childNav
.emph().childNav;
.paragraph().childNav
.emph().childNav;
let paramName;
if (!paramNameNode.empty) {
paramName = paramNameNode.text().item.value.replace(/:/, '');
} else {
paramName = paramListItem.childNav
.paragraph().childNav
.strong().childNav
.text().item.value;
let item = paramListItem.childNav.paragraph().childNav
.strong().childNav.text();
if (paramName) {
paramName = item.value;
}
}
const paramDoc = paramListItem.childNav
.paragraph().childNav
.text(t => true, 1).value; // item.value;
.paragraph().childNav
.text(t => true, 1).value; // item.value;
result[paramName] = paramDoc.replace(/^[ -]+/, '');
});

View File

@@ -49,7 +49,7 @@ function readPhase(mdCache, aggData) {
function getFileData(tree, pathname, aggData) {
var compName = pathname;
var angNameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget))/;
var angNameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget)|(dialog))/;
if (!compName.match(angNameRegex))
return;