@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
38 lines • 1.36 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSelectorKeywords = getSelectorKeywords;
const helpers_1 = require("../../../../helpers");
/**
*
* @param entry
*/
function getSelectorKeywords(entry) {
return (0, helpers_1.extractSelectors)(entry.entry.declaration).reduce((acc, selector) => {
// Add attribute selectors as keywords, this is also necessary to make them available for code blocks with highlighting.
// We take the last part of the selector, which is probably the most important one.
// It's not perfect, but at least it makes it work most of the time.
const attributeSelector = selector.match(/\[(?<selector>[\w-]+)\]$/)?.groups?.['selector'];
if (attributeSelector) {
acc.push([
attributeSelector,
{
title: attributeSelector,
path: entry.absoluteRoute(),
languages: ['html'],
},
]);
}
else {
acc.push([
selector,
{
title: selector,
path: entry.absoluteRoute(),
languages: ['html'],
},
]);
}
return acc;
}, []);
}
//# sourceMappingURL=get-selector-keywords.js.map
;