mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3801] Added source linking tool and updated content services docs (#4037)
* [ADF-3801] Added source linking tool * [ADF-3801] Added source links to doc files
This commit is contained in:
committed by
Eugenio Romano
parent
164abecc06
commit
4b68c98007
@@ -43,7 +43,7 @@ function searchItemsRecursively(item) {
|
||||
|
||||
|
||||
function interestedIn(itemKind) {
|
||||
return itemKind === 128;
|
||||
return (itemKind === 128) || (itemKind === 256);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
"toc"
|
||||
],
|
||||
"dev": [
|
||||
"toc"
|
||||
"sourceLinker"
|
||||
]
|
||||
},
|
||||
"statusIcons": {
|
||||
@@ -51,8 +51,10 @@
|
||||
"UserRepresentation": "https://github.com/Alfresco/alfresco-js-api/blob/development/src/alfresco-activiti-rest-api/docs/UserRepresentation.md"
|
||||
},
|
||||
"typeNameExceptions": {
|
||||
"content-node-share.directive": "NodeSharedDirective",
|
||||
"content.widget": "ContentWidgetComponent",
|
||||
"datatable.component": "DataTableComponent",
|
||||
"document-library.model": "NodePaging",
|
||||
"tasklist.service": "TaskListService",
|
||||
"text-mask.component": "InputMaskDirective",
|
||||
"card-item-types.service": "CardItemTypeService",
|
||||
@@ -60,7 +62,8 @@
|
||||
"header.component": "HeaderLayoutComponent",
|
||||
"process-list.component": "ProcessInstanceListComponent",
|
||||
"inherited-button.directive": "InheritPermissionDirective",
|
||||
"node-share.directive": "NodeSharedDirective",
|
||||
"permissions-style.model": "PermissionStyleModel",
|
||||
"search-widget.interface": "SearchWidget",
|
||||
"sites-dropdown.component": "DropdownSitesComponent",
|
||||
"start-process.component": "StartProcessInstanceComponent"
|
||||
},
|
||||
|
35
tools/doc/tools/sourceLinker.js
Normal file
35
tools/doc/tools/sourceLinker.js
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var path = require("path");
|
||||
var unist_util_select_1 = require("unist-util-select");
|
||||
var ngHelpers = require("../ngHelpers");
|
||||
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
|
||||
function processDocs(mdCache, aggData, errorMessages) {
|
||||
var pathnames = Object.keys(mdCache);
|
||||
pathnames.forEach(function (pathname) {
|
||||
var fileBaseName = path.basename(pathname, '.md');
|
||||
if (!fileBaseName.match(angFilenameRegex)) {
|
||||
return;
|
||||
}
|
||||
var tree = mdCache[pathname].mdOutTree;
|
||||
var className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions);
|
||||
var classInfo = aggData.classInfo[className];
|
||||
var sourcePath = classInfo ? classInfo.sourcePath : '';
|
||||
var titleHeading = unist_util_select_1.select('heading[depth=1]:first-of-type', tree);
|
||||
if (titleHeading.children[0].type === "text") {
|
||||
var titleText = titleHeading.children[0];
|
||||
titleHeading.children[0] = {
|
||||
type: 'link',
|
||||
url: "../../" + sourcePath,
|
||||
title: "Defined in " + path.basename(sourcePath),
|
||||
children: [titleText]
|
||||
};
|
||||
}
|
||||
else if (titleHeading.children[0].type === "link") {
|
||||
var linkElem = titleHeading.children[0];
|
||||
linkElem.url = "../../" + sourcePath;
|
||||
linkElem.title = "Defined in " + path.basename(sourcePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.processDocs = processDocs;
|
42
tools/doc/tools/sourceLinker.ts
Normal file
42
tools/doc/tools/sourceLinker.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import * as path from "path";
|
||||
|
||||
import { select } from "unist-util-select";
|
||||
|
||||
import * as ngHelpers from "../ngHelpers";
|
||||
|
||||
|
||||
const angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(interface)|(model)|(pipe)|(service)|(widget))/;
|
||||
|
||||
|
||||
export function processDocs(mdCache, aggData, errorMessages) {
|
||||
var pathnames = Object.keys(mdCache);
|
||||
|
||||
pathnames.forEach(pathname => {
|
||||
let fileBaseName = path.basename(pathname, '.md');
|
||||
|
||||
if (!fileBaseName.match(angFilenameRegex)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let tree = mdCache[pathname].mdOutTree;
|
||||
let className = ngHelpers.ngNameToClassName(fileBaseName, aggData.config.typeNameExceptions);
|
||||
let classInfo = aggData.classInfo[className];
|
||||
let sourcePath = classInfo ? classInfo.sourcePath : '';
|
||||
let titleHeading = select('heading[depth=1]:first-of-type', tree);
|
||||
|
||||
if (titleHeading.children[0].type === "text") {
|
||||
let titleText = titleHeading.children[0];
|
||||
|
||||
titleHeading.children[0] = {
|
||||
type: 'link',
|
||||
url: `../../${sourcePath}`,
|
||||
title: `Defined in ${path.basename(sourcePath)}`,
|
||||
children: [titleText]
|
||||
}
|
||||
} else if (titleHeading.children[0].type === "link") {
|
||||
let linkElem = titleHeading.children[0];
|
||||
linkElem.url = `../../${sourcePath}`;
|
||||
linkElem.title = `Defined in ${path.basename(sourcePath)}`;
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user