Skip to content

Commit

Permalink
Merge branch 'release/1.0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
vogloblinsky committed Mar 1, 2018
2 parents 8464209 + 0b598e2 commit a3cb6c2
Show file tree
Hide file tree
Showing 34 changed files with 1,349 additions and 645 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<a name="1.0.8"></a>
# [1.0.8](https://github.com/compodoc/compodoc/compare/1.0.7...1.0.8) (2018-03-01)

### Features

* **routing:** option to disable routes graph ([62073b](https://github.com/compodoc/compodoc/commit/62073b)), closes [#472](https://github.com/compodoc/compodoc/issues/472) [#485](https://github.com/compodoc/compodoc/issues/485)

### Bug Fixes

* **jsdoc:** @link for external url broken ([6775ef](https://github.com/compodoc/compodoc/commit/6775ef)), closes [#305](https://github.com/compodoc/compodoc/issues/305)

<a name="1.0.7"></a>
# [1.0.7](https://github.com/compodoc/compodoc/compare/1.0.6...1.0.7) (2018-02-15)

Expand Down
942 changes: 448 additions & 494 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@compodoc/compodoc",
"version": "1.0.7",
"version": "1.0.8",
"description": "The missing documentation tool for your Angular application",
"main": "dist/index.js",
"bin": {
Expand Down Expand Up @@ -63,7 +63,7 @@
},
"homepage": "https://github.com/compodoc/compodoc#readme",
"dependencies": {
"@compodoc/ngd-transformer": "^2.0.0-alpha.4",
"@compodoc/ngd-transformer": "^2.0.0",
"chalk": "^2.3.1",
"cheerio": "^1.0.0-rc.2",
"chokidar": "^2.0.2",
Expand All @@ -78,8 +78,8 @@
"json5": "^0.5.1",
"live-server": "1.1.0",
"lodash": "^4.17.5",
"lunr": "2.1.5",
"marked": "^0.3.12",
"lunr": "2.1.6",
"marked": "^0.3.17",
"os-name": "^2.0.1",
"traverse": "^0.6.6",
"ts-simple-ast": "6.12.0",
Expand All @@ -88,31 +88,31 @@
"devDependencies": {
"@types/chai": "4.1.2",
"@types/es6-promise": "3.3.0",
"@types/fs-extra": "5.0.0",
"@types/fs-extra": "5.0.1",
"@types/handlebars": "^4.0.36",
"@types/lodash": "^4.14.102",
"@types/lodash": "^4.14.104",
"@types/marked": "0.3.0",
"@types/mocha": "2.2.48",
"@types/node": "9.4.6",
"@types/semver": "^5.5.0",
"chai": "^4.1.2",
"codecov": "^3.0.0",
"conventional-changelog-cli": "^1.3.13",
"conventional-changelog-cli": "^1.3.15",
"cross-env": "5.1.3",
"mocha": "^3.5.3",
"mocha-parallel-tests": "^1.2.10",
"nodemon": "^1.14.12",
"nodemon": "^1.17.1",
"npm-watch": "0.3.0",
"nyc": "11.4.1",
"prettier": "1.10.2",
"prettier": "1.11.0",
"request": "^2.83.0",
"rimraf": "^2.6.2",
"rollup": "0.55.5",
"rollup": "0.56.3",
"rollup-plugin-typescript": "^0.8.1",
"rollup-watch": "^4.3.1",
"selenium-webdriver": "^4.0.0-alpha.1",
"semver": "^5.5.0",
"ts-node": "4.1.0",
"ts-node": "5.0.0",
"tslint": "^5.9.1"
},
"nyc": {
Expand Down
6 changes: 4 additions & 2 deletions src/app/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ export class Application {

this.configuration.resetPages();

actions.push(() => this.prepareRoutes());
if (!this.configuration.mainData.disableRoutesGraph) {
actions.push(() => this.prepareRoutes());
}

if (diffCrawledData.modules.length > 0) {
actions.push(() => this.prepareModules());
Expand Down Expand Up @@ -497,7 +499,7 @@ export class Application {
actions.push(() => { return this.prepareInterceptors(); });
}

if (this.dependenciesEngine.routes && this.dependenciesEngine.routes.children.length > 0) {
if (this.dependenciesEngine.routes && this.dependenciesEngine.routes.children.length > 0 && !this.configuration.mainData.disableRoutesGraph) {
actions.push(() => { return this.prepareRoutes(); });
}

Expand Down
14 changes: 8 additions & 6 deletions src/app/compiler/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,12 @@ export class Dependencies {

// $componentsTreeEngine.createTreesForComponents();

this.routerParser.linkModulesAndRoutes();
this.routerParser.constructModulesTree();
if (!this.configuration.mainData.disableRoutesGraph) {
this.routerParser.linkModulesAndRoutes();
this.routerParser.constructModulesTree();

deps.routesTree = this.routerParser.constructRoutesTree();
deps.routesTree = this.routerParser.constructRoutesTree();
}

return deps;
}
Expand Down Expand Up @@ -269,7 +271,7 @@ export class Dependencies {
});
}

if (hasRoutesStatements) {
if (hasRoutesStatements && !this.configuration.mainData.disableRoutesGraph) {
// Clean file for spread and dynamics inside routes definitions
logger.info('Analysing routes definitions and clean them if necessary');

Expand Down Expand Up @@ -622,7 +624,7 @@ export class Dependencies {
outputSymbols.miscellaneous.enumerations.push(deps);
}
}
}
};

parseNode(fileName, scannedFile, initialNode);

Expand Down Expand Up @@ -835,7 +837,7 @@ export class Dependencies {
}).reverse();
if (_.indexOf(kinds, ts.SyntaxKind.PublicKeyword) !== -1 && _.indexOf(kinds, ts.SyntaxKind.StaticKeyword) !== -1) {
kinds = kinds.filter((kind) => kind !== ts.SyntaxKind.PublicKeyword);
};
}
}
}
if (jsdoctags && jsdoctags.length >= 1) {
Expand Down
101 changes: 77 additions & 24 deletions src/app/engines/html-engine-helpers/parse-description.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { extractLeadingText, splitLinkText } from '../../../utils/link-parser';
import { DependenciesEngine } from '../dependencies.engine';

export class ParseDescriptionHelper implements IHtmlEngineHelper {
constructor(private dependenciesEngine: DependenciesEngine) {

}
constructor(private dependenciesEngine: DependenciesEngine) {}

public helperFunc(context: any, description: string, depth: number) {
let tagRegExpLight = new RegExp('\\{@link\\s+((?:.|\n)+?)\\}', 'i');
Expand All @@ -15,12 +13,12 @@ export class ParseDescriptionHelper implements IHtmlEngineHelper {
let previousString;
let tagInfo = [];

tagRegExp = (description.indexOf(']{') !== -1) ? tagRegExpFull : tagRegExpLight;
tagRegExp = description.indexOf(']{') !== -1 ? tagRegExpFull : tagRegExpLight;

const processTheLink = (string, tagInfo, leadingText) => {
let leading = extractLeadingText(string, tagInfo.completeTag);
let split;
let result;
let resultInCompodoc;
let newLink;
let rootPath;
let stringtoReplace;
Expand All @@ -31,20 +29,19 @@ export class ParseDescriptionHelper implements IHtmlEngineHelper {
split = splitLinkText(tagInfo.text);

if (typeof split.linkText !== 'undefined') {
result = this.dependenciesEngine.findInCompodoc(split.target);
resultInCompodoc = this.dependenciesEngine.findInCompodoc(split.target);
} else {
let info = tagInfo.text;
if (tagInfo.text.indexOf('#') !== -1) {
anchor = tagInfo.text.substr(tagInfo.text.indexOf('#'), tagInfo.text.length);
info = tagInfo.text.substr(0, tagInfo.text.indexOf('#'));
}
result = this.dependenciesEngine.findInCompodoc(info);
resultInCompodoc = this.dependenciesEngine.findInCompodoc(info);
}

if (result) {

label = result.name;
pageName = result.name;
if (resultInCompodoc) {
label = resultInCompodoc.name;
pageName = resultInCompodoc.name;

if (leadingText) {
stringtoReplace = '[' + leadingText + ']' + tagInfo.completeTag;
Expand All @@ -56,19 +53,22 @@ export class ParseDescriptionHelper implements IHtmlEngineHelper {
stringtoReplace = tagInfo.completeTag;
}

if (result.type === 'class') {
result.type = 'classe';
} else if (result.type === 'miscellaneous' || (result.ctype && result.ctype === 'miscellaneous')) {
result.type = 'miscellaneou';
label = result.name;
anchor = '#' + result.name;
if (result.subtype === 'enum') {
if (resultInCompodoc.type === 'class') {
resultInCompodoc.type = 'classe';
} else if (
resultInCompodoc.type === 'miscellaneous' ||
(resultInCompodoc.ctype && resultInCompodoc.ctype === 'miscellaneous')
) {
resultInCompodoc.type = 'miscellaneou';
label = resultInCompodoc.name;
anchor = '#' + resultInCompodoc.name;
if (resultInCompodoc.subtype === 'enum') {
pageName = 'enumerations';
} else if (result.subtype === 'function') {
} else if (resultInCompodoc.subtype === 'function') {
pageName = 'functions';
} else if (result.subtype === 'typealias') {
} else if (resultInCompodoc.subtype === 'typealias') {
pageName = 'typealiases';
} else if (result.subtype === 'variable') {
} else if (resultInCompodoc.subtype === 'variable') {
pageName = 'variables';
}
}
Expand All @@ -95,8 +95,34 @@ export class ParseDescriptionHelper implements IHtmlEngineHelper {
label = split.linkText;
}

newLink = `<a href="${rootPath}${result.type}s/${pageName}.html${anchor}">${label}</a>`;

newLink = `<a href="${rootPath}${
resultInCompodoc.type
}s/${pageName}.html${anchor}">${label}</a>`;

return string.replace(stringtoReplace, newLink);
} else if (!resultInCompodoc && typeof split.linkText !== 'undefined') {
newLink = `<a href="${split.target}">${split.linkText}</a>`;
if (leadingText) {
stringtoReplace = '[' + leadingText + ']' + tagInfo.completeTag;
} else if (leading.leadingText !== undefined) {
stringtoReplace = '[' + leading.leadingText + ']' + tagInfo.completeTag;
} else if (typeof split.linkText !== 'undefined') {
stringtoReplace = tagInfo.completeTag;
} else {
stringtoReplace = tagInfo.completeTag;
}
return string.replace(stringtoReplace, newLink);
} else if (!resultInCompodoc && leading && typeof leading.leadingText !== 'undefined') {
newLink = `<a href="${split.target}">${leading.leadingText}</a>`;
if (leadingText) {
stringtoReplace = '[' + leadingText + ']' + tagInfo.completeTag;
} else if (leading.leadingText !== undefined) {
stringtoReplace = '[' + leading.leadingText + ']' + tagInfo.completeTag;
} else if (typeof split.linkText !== 'undefined') {
stringtoReplace = tagInfo.completeTag;
} else {
stringtoReplace = tagInfo.completeTag;
}
return string.replace(stringtoReplace, newLink);
} else {
return string;
Expand All @@ -118,15 +144,42 @@ export class ParseDescriptionHelper implements IHtmlEngineHelper {
}
}

// Clean description for marked a tag parsed too early

if (description.indexOf('href=') !== -1) {
let insideMarkedATagResults = description.match(/<a [^>]+>([^<]+)<\/a>/g);

if (insideMarkedATagResults && insideMarkedATagResults.length > 0) {
for (let i = 0; i < insideMarkedATagResults.length; i++) {
let markedATagRegExp = new RegExp('<a [^>]+>([^<]+)</a>', 'gm');
let parsedATag = markedATagRegExp.exec(description);
if (parsedATag && parsedATag.length === 2) {
let insideMarkedATag = parsedATag[1];
description = description.replace(
`{@link <a href="${insideMarkedATag}">${insideMarkedATag}</a>`,
`{@link ${insideMarkedATag}`
);
}
}
}
}

do {
matches = tagRegExp.exec(description);

if (matches) {
previousString = description;
if (matches.length === 2) {
description = replaceMatch(processTheLink, 'link', matches[0], matches[1]);
}
if (matches.length === 3) {
description = replaceMatch(processTheLink, 'link', matches[0], matches[2], matches[1]);
description = replaceMatch(
processTheLink,
'link',
matches[0],
matches[2],
matches[1]
);
}
}
} while (matches && previousString !== description);
Expand Down
7 changes: 3 additions & 4 deletions src/app/engines/ngd.engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ export class NgdEngine {

constructor(
private dependenciesEngine: DependenciesEngine,
private fileEngine: FileEngine = new FileEngine()) {

}
private fileEngine: FileEngine = new FileEngine()
) {}

public init(outputpath: string) {
this.engine = new ngdT.DotEngine({
output: outputpath,
displayLegend: true,
outputFormats: 'svg',
silent: false
silent: true
});
}

Expand Down
1 change: 1 addition & 0 deletions src/app/interfaces/main-data.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface MainDataInterface {
disableProtected: boolean;
disableInternal: boolean;
disableLifeCycleHooks: boolean;
disableRoutesGraph: boolean;
watch: boolean;
mainGraph: string;
coverageTest: boolean;
Expand Down
5 changes: 5 additions & 0 deletions src/index-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class CliApplication extends Application {
.option('--disableProtected', 'Do not show protected in generated documentation', false)
.option('--disableInternal', 'Do not show @internal in generated documentation', false)
.option('--disableLifeCycleHooks', 'Do not show Angular lifecycle hooks in generated documentation', false)
.option('--disableRoutesGraph', 'Do not add the routes graph', COMPODOC_DEFAULTS.disableRoutesGraph)
.option('--customFavicon [path]', 'Use a custom favicon')
.option('--gaID [id]', 'Google Analytics tracking ID')
.option('--gaSite [site]', 'Google Analytics site name', COMPODOC_DEFAULTS.gaSite)
Expand Down Expand Up @@ -172,6 +173,10 @@ export class CliApplication extends Application {
this.configuration.mainData.disableLifeCycleHooks = program.disableLifeCycleHooks;
}

if (program.disableRoutesGraph) {
this.configuration.mainData.disableRoutesGraph = program.disableRoutesGraph;
}

if (program.customFavicon) {
this.configuration.mainData.customFavicon = program.customFavicon;
}
Expand Down
4 changes: 4 additions & 0 deletions src/resources/styles/compodoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ h6 {
font-size: 16px;
}

a[href] {
cursor: pointer;
}

/**
* Mobile navbar
*/
Expand Down
12 changes: 7 additions & 5 deletions src/templates/partials/menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,13 @@
</li>
{{/if}}

{{#if routes}}
<li class="chapter">
<a data-type="chapter-link" href="{{relativeURL depth 'routes'}}routes.html" {{#compare name "===" 'routes' }} class="active" {{/compare}}><span class="fa fa-fw fa-code-fork"></span>Routes</a>
</li>
{{/if}}
{{#unless disableRoutesGraph}}
{{#if routes}}
<li class="chapter">
<a data-type="chapter-link" href="{{relativeURL depth 'routes'}}routes.html" {{#compare name "===" 'routes' }} class="active" {{/compare}}><span class="fa fa-fw fa-code-fork"></span>Routes</a>
</li>
{{/if}}
{{/unless}}

{{#unless disableCoverage}}
<li class="chapter">
Expand Down
Loading

0 comments on commit a3cb6c2

Please sign in to comment.