mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
* [ADF-4152] Initial GraphQL implementation * [ADF-4152] Schema updates * [ADF-4152] Rounded out basic fields * [ADF-4152] Added basic template functionality * [ADF-4152] Added full template generation * [ADF-4152] Moved proc services doc files to new folders * [ADF-4152] Updated README.md with section from new template * [ADF-4152] Fixed another problem with relative URLs * [ADF-4152] Fixed links and some more bugs * [ADF-4152] Removed proc services folder README file
46 lines
1.9 KiB
JavaScript
46 lines
1.9 KiB
JavaScript
"use strict";
|
|
exports.__esModule = 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)|(dialog)|(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);
|
|
var relDocPath = pathname.substring(pathname.indexOf('docs'));
|
|
var srcUrl = fixRelSrcUrl(relDocPath, sourcePath);
|
|
if (titleHeading.children[0].type === "text") {
|
|
var titleText = titleHeading.children[0];
|
|
titleHeading.children[0] = {
|
|
type: 'link',
|
|
url: srcUrl,
|
|
title: "Defined in " + path.basename(sourcePath),
|
|
children: [titleText]
|
|
};
|
|
}
|
|
else if ((titleHeading.children[0].type === "link") && sourcePath) {
|
|
var linkElem = titleHeading.children[0];
|
|
linkElem.url = srcUrl, //`../../${sourcePath}`;
|
|
linkElem.title = "Defined in " + path.basename(sourcePath);
|
|
}
|
|
});
|
|
}
|
|
exports.processDocs = processDocs;
|
|
function fixRelSrcUrl(docPath, srcPath) {
|
|
var docPathSegments = docPath.split(/[\\\/]/);
|
|
var dotPathPart = '';
|
|
for (var i = 0; i < (docPathSegments.length - 1); i++) {
|
|
dotPathPart += '../';
|
|
}
|
|
return dotPathPart + srcPath;
|
|
}
|