repair doc tools and polish the docs code (#5038)

* set private access modifier

* repair doc build tools

* fix lit issues

* re-generate version index
This commit is contained in:
Denys Vuika
2019-08-30 17:26:10 +01:00
committed by Eugenio Romano
parent 3bebc7a18c
commit 2b1250cae7
32 changed files with 727 additions and 877 deletions

View File

@@ -11,7 +11,7 @@ export class MDNav {
let currIndex = 0;
for (let i = this.pos; i < this.root.children.length; i++) {
let child = this.root.children[i];
const child = this.root.children[i];
if (test(child)) {
if (currIndex === index) {
@@ -30,12 +30,12 @@ export class MDNav {
return [];
}
let result = [];
const result = [];
let currIndex = 0;
for (let i = this.pos; i < this.root.children.length; i++) {
let child = this.root.children[i];
const child = this.root.children[i];
if (test(child)) {
if (currIndex === index) {
@@ -49,107 +49,96 @@ export class MDNav {
return result;
}
emph(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "emphasis" && test(h);
return h.type === 'emphasis' && test(h);
}, index);
}
heading(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "heading" && test(h);
return h.type === 'heading' && test(h);
}, index);
}
headings(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => {
return h.type === "heading" && test(h);
return h.type === 'heading' && test(h);
}, index);
}
html(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "html" && test(h);
return h.type === 'html' && test(h);
}, index);
}
link(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "link" && test(h);
return h.type === 'link' && test(h);
}, index);
}
links(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => {
return h.type === "link" && test(h);
return h.type === 'link' && test(h);
}, index);
}
list(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "list" && test(h);
return h.type === 'list' && test(h);
}, index);
}
listItem(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "listItem" && test(h);
return h.type === 'listItem' && test(h);
}, index);
}
listItems(test: (element: any) => boolean = () => true, index: number = 0): MDNav[] {
return this.findAll((h) => {
return h.type === "listItem" && test(h);
return h.type === 'listItem' && test(h);
}, index);
}
paragraph(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "paragraph" && test(h);
return h.type === 'paragraph' && test(h);
}, index);
}
strong(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "strong" && test(h);
return h.type === 'strong' && test(h);
}, index);
}
table(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "table" && test(h);
return h.type === 'table' && test(h);
}, index);
}
tableRow(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "tableRow" && test(h);
return h.type === 'tableRow' && test(h);
}, index);
}
tableCell(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "tableCell" && test(h);
return h.type === 'tableCell' && test(h);
}, index);
}
text(test: (element: any) => boolean = () => true, index: number = 0): MDNav {
return this.find((h) => {
return h.type === "text" && test(h);
return h.type === 'text' && test(h);
}, index);
}
get item(): any {
if (!this.root || !this.root.children) {
return undefined;
@@ -164,36 +153,33 @@ export class MDNav {
(this.pos >= this.root.children.length);
}
get childNav(): MDNav {
return new MDNav(this.item);
}
get value(): any {
if (this.item && this.item["value"]) {
if (this.item && this.item['value']) {
return this.item.value;
} else {
return "";
return '';
}
}
get textValue() : string {
get textValue(): string {
if (this.item) {
if (this.item["value"]) {
if (this.item['value']) {
return this.item.value;
} else if (
this.item.children &&
(this.item.children.length > 0) &&
(this.item.children[0].type === "text")
){
(this.item.children[0].type === 'text')
) {
return this.item.children[0].value;
} else {
return "";
return '';
}
} else {
return "";
return '';
}
}
}