Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worked on FIRESDK-23 (Add Events in the table of content) #62

Open
wants to merge 5 commits into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion util/docs/macros/index.mjs
Expand Up @@ -108,10 +108,13 @@ function insertMacros(data = '', moduleJson = {}, templates = {}, schemas = {},
regex = /\$\{events\}/
if (match = data.match(regex)) {
let eventsBlock = ''
let eventsList = ''
events.forEach(method => {
eventsBlock += insertMethodMacros(match[0], method, moduleJson, schemas, templates, options)
eventsList += ' - [' + method.name[2].toLowerCase() + method.name.substr(3) + '](#' + method.name.substr(2).toLowerCase() + ')' + '\n'
})
data = data.replace(regex, eventsBlock)
data = data.replace(/\$\{toc.events\}/g, eventsList)
}
}

Expand Down Expand Up @@ -296,7 +299,6 @@ function insertMacros(data = '', moduleJson = {}, templates = {}, schemas = {},
if (methods) {
data = data
.replace(/\$\{toc.methods\}/g, methods.filter(isTocMethod).map(m => ' - [' + m.name + '](#' + m.name.toLowerCase() + ')').join('\n'))
.replace(/\$\{toc.events\}/g, methods.filter(m => isEvent(m) && !isProviderInterfaceMethod(m)).map(m => ' - [' + m.name[2].toLowerCase() + m.name.substr(3) + '](#' + m.name.substr(2).toLowerCase() + ')').join('\n'))
.replace(/\$\{toc.providers\}/g, capabilities.map(c => ` - [${getProviderName(c, moduleJson, schemas)}](#${getProviderName(c, moduleJson, schemas).toLowerCase()})`).join('\n'))
}

Expand Down