build(aio): tighten up code autolinking (#20468)

Do not match code "words" that are part of a hyphenated
string of characters: e.g. `platform-browser-dynamic` should
not auto-link `browser`.

Do not match code "words" that correspond to pipe names
but are not preceded by a pipe `|` character. E.g. `package.json` should
not auto link `json` to the `JsonPipe`.

Closes #20187

PR Close #20468
This commit is contained in:
Peter Bacon Darwin
2017-11-15 23:30:09 +00:00
committed by Miško Hevery
parent 81f1d42328
commit 8ddbed8f7b
5 changed files with 86 additions and 7 deletions

View File

@ -35,6 +35,7 @@ module.exports = new Package('angular-base', [
.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })
.factory(require('./readers/json'))
.factory(require('./services/copyFolder'))
.factory(require('./services/filterPipes'))
.factory(require('./services/getImageDimensions'))
.factory(require('./post-processors/add-image-dimensions'))
@ -126,8 +127,9 @@ module.exports = new Package('angular-base', [
})
.config(function(postProcessHtml, addImageDimensions, autoLinkCode) {
.config(function(postProcessHtml, addImageDimensions, autoLinkCode, filterPipes) {
addImageDimensions.basePath = path.resolve(AIO_PATH, 'src');
autoLinkCode.customFilters = [filterPipes];
postProcessHtml.plugins = [
require('./post-processors/autolink-headings'),
addImageDimensions,