Docs: ensure ops without examples are indexed

This commit is contained in:
Lovell Fuller 2021-05-24 16:24:04 +01:00
parent dc53f1baff
commit 35e8c8b25e
3 changed files with 11 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -37,14 +37,14 @@ for (const match of matches) {
].forEach((section) => { ].forEach((section) => {
const contents = fs.readFileSync(path.join(__dirname, '..', `api-${section}.md`), 'utf8'); const contents = fs.readFileSync(path.join(__dirname, '..', `api-${section}.md`), 'utf8');
const matches = contents.matchAll( const matches = contents.matchAll(
/\n## (?<title>[A-Za-z]+)\n\n(?<firstparagraph>.+?)\n\n(?<parameters>### Parameters*.+?)#/gs /\n## (?<title>[A-Za-z]+)\n\n(?<firstparagraph>.+?)\n\n(?<parameters>### Parameters.+?Returns)?/gs
); );
for (const match of matches) { for (const match of matches) {
const { title, firstparagraph, parameters } = match.groups; const { title, firstparagraph, parameters } = match.groups;
const description = firstparagraph.startsWith('###') const description = firstparagraph.startsWith('###')
? 'Constructor' ? 'Constructor'
: extractDescription(firstparagraph); : extractDescription(firstparagraph);
const parameterNames = extractParameters(parameters); const parameterNames = parameters ? extractParameters(parameters) : '';
searchIndex.push({ searchIndex.push({
t: title, t: title,

View File

@ -17,6 +17,7 @@ module.exports = [
'before', 'before',
'both', 'both',
'call', 'call',
'callback',
'can', 'can',
'containing', 'containing',
'default', 'default',
@ -26,6 +27,7 @@ module.exports = [
'ensure', 'ensure',
'etc', 'etc',
'every', 'every',
'except',
'for', 'for',
'from', 'from',
'get', 'get',
@ -49,12 +51,16 @@ module.exports = [
'occur', 'occur',
'occurs', 'occurs',
'options', 'options',
'other',
'out',
'over', 'over',
'perform', 'perform',
'performs', 'performs',
'provide', 'provide',
'provided', 'provided',
'ready', 'ready',
'requires',
'returned',
'same', 'same',
'see', 'see',
'set', 'set',
@ -67,9 +73,11 @@ module.exports = [
'supported', 'supported',
'sure', 'sure',
'take', 'take',
'than',
'that', 'that',
'the', 'the',
'their', 'their',
'then',
'there', 'there',
'therefore', 'therefore',
'these', 'these',