diff --git a/bin/generate-partial-cache.js b/bin/generate-partial-cache.js index 93ba293..da58cf9 100644 --- a/bin/generate-partial-cache.js +++ b/bin/generate-partial-cache.js @@ -8,7 +8,7 @@ const fileSet = new FileSet() async function start () { await fileSet.add('./partials/**/*.hbs') const map = new Map() - for (const file of fileSet.files) { + for (const file of fileSet.files.sort()) { map.set( path.basename(file, '.hbs'), fs.readFileSync(file, 'utf8') || '' diff --git a/helpers/ddata.js b/helpers/ddata.js index 66b85de..ed49eba 100644 --- a/helpers/ddata.js +++ b/helpers/ddata.js @@ -739,85 +739,51 @@ function parentName (options) { /** returns a dmd option, e.g. "sort-by", "heading-depth" etc. -@static */ function option (name, options) { return objectGet(options.data.root.options, name) } -/** -@static -*/ function optionEquals (name, value, options) { return options.data.root.options[name] === value } -/** -@static -*/ function optionSet (name, value, options) { options.data.root.options[name] = value } -/** -@static -*/ function optionIsSet (name, options) { return options.data.root.options[name] !== undefined } -/** -@static -*/ function stripNewlines (input) { if (input) return input.replace(/[\r\n]+/g, ' ') } -/** -@static -*/ function headingDepth (options) { return options.data.root.options._depth + (options.data.root.options['heading-depth']) } -/** -@static -*/ function depth (options) { return options.data.root.options._depth } -/** -@static -*/ function depthIncrement (options) { options.data.root.options._depth++ } -/** -@static -*/ function depthDecrement (options) { options.data.root.options._depth-- } -/** -@static -*/ function indexDepth (options) { return options.data.root.options._indexDepth } -/** -@static -*/ function indexDepthIncrement (options) { options.data.root.options._indexDepth++ } -/** -@static -*/ function indexDepthDecrement (options) { options.data.root.options._indexDepth-- } diff --git a/helpers/helpers.js b/helpers/helpers.js index 2a27b62..c93180e 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -3,11 +3,9 @@ const arrayify = require('array-back') const handlebars = require('handlebars') const util = require('util') const commonSequence = require('common-sequence') -const unique = require('reduce-unique') /** A library of helpers used exclusively by dmd.. dmd also registers helpers from ddata. -@module */ exports.escape = escape exports.inlineLinks = inlineLinks @@ -194,13 +192,13 @@ function _groupBy (identifiers, groupByFields) { groupByFields = groupByFields.slice(0) groupByFields.forEach(function (group) { - const groupValues = identifiers + let groupValues = identifiers .filter(function (identifier) { /* exclude constructors from grouping.. re-implement to work off a `null` group value */ return identifier.kind !== 'constructor' }) .map(function (i) { return i[group] }) - .reduce(unique, []) + groupValues = Array.from(new Set(groupValues)) // unique if (groupValues.length <= 1) groupByFields = groupByFields.filter(g => g !== group) }) identifiers = _addGroup(identifiers, groupByFields) diff --git a/helpers/selectors.js b/helpers/selectors.js index 9bbbded..6f3cd5d 100644 --- a/helpers/selectors.js +++ b/helpers/selectors.js @@ -17,7 +17,6 @@ exports.misc = misc /** * render the supplied block for each identifier in the query - * @static */ function identifiers (options) { return handlebars.helpers.each(ddata._identifiers(options), options) @@ -25,7 +24,6 @@ function identifiers (options) { /** * render the supplied block for the specified identifier - * @static */ function identifier (options) { const result = ddata._identifier(options) @@ -34,7 +32,6 @@ function identifier (options) { /** * render the supplied block for each parent (global identifier, or module) - * @static */ function orphans (options) { return handlebars.helpers.each(ddata._orphans(options), options) @@ -42,7 +39,6 @@ function orphans (options) { /** * render the supplied block for each identifier in global scope - * @static */ function globals (options) { return handlebars.helpers.each(ddata._globals(options), options) @@ -50,7 +46,6 @@ function globals (options) { /** * render the supplied block for each module - * @static */ function modules (options) { options.hash.kind = 'module' @@ -59,7 +54,6 @@ function modules (options) { /** * render the supplied block for the specified module - * @static */ function module (options) { options.hash.kind = 'module' @@ -69,7 +63,6 @@ function module (options) { /** * render the block for each class - * @static */ function classes (options) { options.hash.kind = 'class' @@ -87,7 +80,6 @@ function class_ (options) { /** * render the block for each function/method - * @static */ function functions (options) { options.hash.kind = 'function' @@ -123,7 +115,6 @@ function enum_ (options) { /** * render the supplied block for each orphan with no scope set - * @static */ function misc (options) { options.hash.scope = undefined diff --git a/index.js b/index.js index 331c1bf..f1f2579 100644 --- a/index.js +++ b/index.js @@ -1,22 +1,26 @@ const path = require('path') +const fs = require('fs') const Cache = require('cache-point') const DmdOptions = require('./lib/dmd-options') const FileSet = require('file-set') const os = require('os') -const fs = require('fs') const partialCache = require('./partials/partial-cache.js') +const handlebars = require('handlebars') +const arrayify = require('array-back') +const walkBack = require('walk-back') +const HandlebarsTemplate = require('./lib/handlebars-template.js') const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, './package.json'), 'utf8')) const dmdVersion = pkg.version /** - * Transforms doclet data into markdown documentation. + * Transforms jsdoc-parse data into markdown documentation. * @param {object[]} * @param [options] {module:dmd-options} - The render options * @return {Promise} * @alias module:dmd */ -async function dmd (templateData, options) { +async function dmd (templateData = [], options) { options = new DmdOptions(options) if (skipCache(options)) { return generate(templateData, options) @@ -31,61 +35,48 @@ async function dmd (templateData, options) { } } +/* Expose cache so `jsdoc2md --clear` command can access it */ dmd.cache = new Cache({ dir: path.join(os.tmpdir(), 'dmd') }) -async function generate (templateData, options) { - const fs = require('fs') - const path = require('path') - const arrayify = require('array-back') - const handlebars = require('handlebars') - const walkBack = require('walk-back') - const DmdOptions = require('./lib/dmd-options') - - async function registerPartials (paths) { - const fileSet = new FileSet() - await fileSet.add(paths) - for (const file of fileSet.files) { - handlebars.registerPartial( - path.basename(file, '.hbs'), - fs.readFileSync(file, 'utf8') || '' - ) - } - } - - async function registerHelpers (helpers) { - const fileSet = new FileSet() - await fileSet.add(helpers) - for (const file of fileSet.files) { - handlebars.registerHelper(require(path.resolve(process.cwd(), file))) - } - } - - /* Register handlebars helper modules */ - ;['./helpers/helpers', './helpers/ddata', './helpers/selectors'].forEach(function (modulePath) { - handlebars.registerHelper(require(modulePath)) +async function loadPartialFiles (paths) { + const fileSet = new FileSet() + await fileSet.add(paths) + return fileSet.files.map(file => { + return [ + path.basename(file, '.hbs'), + fs.readFileSync(file, 'utf8') || '' + ] }) +} - const inputData = templateData.map(function (row) { - return Object.assign({}, row) +async function loadHelperFiles (helpers) { + const fileSet = new FileSet() + await fileSet.add(helpers) + return fileSet.files.map(file => { + return require(path.resolve(process.cwd(), file)) }) +} + +async function generate (templateData, options) { + const handlebarsTemplate = new HandlebarsTemplate() + + /* Copy input data */ + const inputData = templateData.map(row => Object.assign({}, row)) const inputOptions = Object.assign({}, options) - templateData = arrayify(templateData) options = Object.assign(new DmdOptions(), options) options.plugin = arrayify(options.plugin) + /* used by helpers.headingDepth */ options._depth = 0 + /* used by helpers.indexDepth */ options._indexDepth = 0 + templateData.options = options - /* state module, for sharing with the helpers */ + /* state module, for sharing data between the helpers - functions as a global object */ const state = require('./lib/state') state.templateData = templateData state.options = options - /* register all internal dmd partials. */ - for (const [name, content] of partialCache) { - handlebars.registerPartial(name, content) - } - /* if plugins were specified, register the helpers/partials from them too */ if (options.plugin) { for (let i = 0; i < options.plugin.length; i++) { @@ -111,24 +102,28 @@ async function generate (templateData, options) { } } - /* if additional partials/helpers paths were specified, register them too */ - if (options.partial.length) await registerPartials(options.partial) - if (options.helper.length) await registerHelpers(options.helper) + /* register all internal and external dmd partials. */ + const internalPartials = Array.from(partialCache) + const externalPartials = await loadPartialFiles(options.partial) + for (const [name, content] of [...internalPartials, ...externalPartials]) { + handlebars.registerPartial(name, content) + } - const compiled = handlebars.compile(options.template, { - preventIndent: true, - strict: false - }) - templateData.options = options - const output = compiled(templateData) + /* Register internal helpers first so they can be overriden by user-defined helpers */ + const internalHelpers = [require('./helpers/helpers.js'), require('./helpers/ddata.js'), require('./helpers/selectors.js')] + const externalHelpers = await loadHelperFiles(options.helper) + for (const helper of [...internalHelpers, ...externalHelpers]) { + handlebarsTemplate.handlebars.registerHelper(helper) + } + + let output = handlebarsTemplate.generate(options.template, templateData) - let adjOutput = output if (options.EOL) { - adjOutput = output.replace(/\r?\n/gm, options.EOL === 'posix' ? '\n' : '\r\n') + output = output.replace(/\r?\n/gm, options.EOL === 'posix' ? '\n' : '\r\n') } - dmd.cache.writeSync([inputData, inputOptions, dmdVersion], adjOutput) - return adjOutput + dmd.cache.writeSync([inputData, inputOptions, dmdVersion], output) + return output } /* always skip the cache when custom plugins, partials or helpers are used */ diff --git a/lib/handlebars-template.js b/lib/handlebars-template.js new file mode 100644 index 0000000..8c5fde0 --- /dev/null +++ b/lib/handlebars-template.js @@ -0,0 +1,24 @@ +const handlebars = require('handlebars') +const path = require('path') +const fs = require('fs') + +class HandlebarsTemplate { + handlebars = handlebars + + async registerPartialFile (file) { + handlebars.registerPartial( + path.basename(file, '.hbs'), + fs.readFileSync(file, 'utf8') || '' + ) + } + + generate (template, templateData) { + const compiled = handlebars.compile(template, { + preventIndent: true, + strict: false + }) + return compiled(templateData) + } +} + +module.exports = HandlebarsTemplate diff --git a/lib/state.js b/lib/state.js index 150de6b..6b5882f 100644 --- a/lib/state.js +++ b/lib/state.js @@ -1,2 +1,3 @@ +/* This module operates as a global object importing clients can read/write to */ exports.templateData = [] exports.options = {} diff --git a/package-lock.json b/package-lock.json index 4de7540..cf22bb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,6 @@ "handlebars": "^4.7.8", "marked": "^4.3.0", "object-get": "^2.1.1", - "reduce-unique": "^2.0.1", "walk-back": "^5.1.1" }, "devDependencies": { @@ -336,15 +335,6 @@ ], "license": "MIT" }, - "node_modules/reduce-unique": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/reduce-unique/-/reduce-unique-2.0.1.tgz", - "integrity": "sha512-x4jH/8L1eyZGR785WY+ePtyMNhycl1N2XOLxhCbzZFaqF4AXjLzqSxa2UHgJ2ZVR/HHyPOvl1L7xRnW8ye5MdA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", diff --git a/package.json b/package.json index d5c690d..315ab1d 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "handlebars": "^4.7.8", "marked": "^4.3.0", "object-get": "^2.1.1", - "reduce-unique": "^2.0.1", "walk-back": "^5.1.1" }, "devDependencies": { diff --git a/partials/partial-cache.js b/partials/partial-cache.js index 5a80711..0801387 100644 --- a/partials/partial-cache.js +++ b/partials/partial-cache.js @@ -1,333 +1,312 @@ module.exports = [ [ - 'main', - '{{>main-index~}}\n{{>all-docs~}}\n' + 'all-docs', + '{{#orphans ~}}\n{{>docs~}}\n{{/orphans~}}\n' ], [ - 'separator', - '{{#if (option "separators")}}\n\n* * *\n\n{{/if~}}' + 'access', + '{{#if access}}**Access**: {{{access}}} \n{{/if~}}\n' ], [ - 'index-indent', - '{{string-repeat " " (indexDepth)}}' + 'augments', + '{{#if augments}}**Extends**: {{>linked-type-list types=augments delimiter=", " }} \n' + + '{{/if}}\n' ], [ - 'heading-indent', - '{{string-repeat "#" (headingDepth)}} ' + 'authors', + '{{#if author}}{{#each author}}**Author**: {{{inlineLinks this}}} \n' + + '{{/each}}{{/if~}}\n' ], [ - 'main-index', - '{{! a main index is only shown if at least 2 global or modules exist ~}}\n' + - '\n' + - '{{#if (showMainIndex)~}}\n' + - '{{>module-index~}}\n' + - '{{>global-index~}}\n' + - '{{/if~}}\n' + 'body', + '{{>deprecated~}}\n' + + '{{>description~}}\n' + + '{{>scope~}}\n' + + '{{>summary~}}\n' + + '{{>augments~}}\n' + + '{{>implements~}}\n' + + '{{>mixes~}}\n' + + '{{>default~}}\n' + + '{{>chainable~}}\n' + + '{{>overrides~}}\n' + + '{{>returns~}}\n' + + '{{>category~}}\n' + + '{{>throws~}}\n' + + '{{>fires~}}\n' + + '{{>this~}}\n' + + '{{>access~}}\n' + + '{{>readOnly~}}\n' + + '{{>requires~}}\n' + + '{{>customTags~}}\n' + + '{{>see~}}\n' + + '{{>since~}}\n' + + '{{>version~}}\n' + + '{{>authors~}}\n' + + '{{>license~}}\n' + + '{{>copyright~}}\n' + + '{{>todo~}}\n' + + '{{>params~}}\n' + + '{{>properties~}}\n' + + '{{>examples~}}\n' ], [ - 'all-docs', - '{{#orphans ~}}\n{{>docs~}}\n{{/orphans~}}\n' + 'category', + '{{#if category}}**Category**: {{inlineLinks category}} \n{{/if~}}' ], [ - 'linked-type-list', - '{{#each types~}}\n' + - '{{>link to=this html=../html ~}}\n' + - '{{#unless @last}}{{{../delimiter}}}{{/unless~}}\n' + - '{{/each}}' + 'chainable', + '{{#if chainable}}**Chainable** \n{{/if~}}' ], [ - 'link', - '{{! usage: link to="namepath" html=true/false caption="optional caption"~}}\n' + - '\n' + - '{{~#if html~}}\n' + - '\n' + - '\n' + - '{{~#link to~}}\n' + - '{{#if url~}}\n' + - '{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if}}\n' + - '{{~else~}}\n' + - '{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if~}}\n' + - '{{/if~}}\n' + - '{{/link~}}\n' + - '\n' + - '\n' + - '{{~else~}}\n' + - '\n' + - '{{#link to~}}\n' + - '{{#if url~}}\n' + - '[{{#if ../../caption}}{{escape ../../../caption}}{{else}}{{escape name}}{{/if}}]({{{url}}})\n' + - '{{~else~}}\n' + - '{{#if ../../caption}}{{escape ../../../caption}}{{else}}{{escape name}}{{/if~}}\n' + - '{{~/if~}}\n' + - '{{/link~}}\n' + - '\n' + - '{{/if~}}\n' + 'copyright', + '{{#if copyright}}**Copyright**: {{{inlineLinks copyright}}} \n{{/if~}}\n' ], [ - 'defaultvalue', - '{{#unless (equal defaultvalue undefined)}}{{#if equals}} = {{/if}}{{#if (equal type.names.[0] "string")}}{{json-stringify defaultvalue}}{{else}}{{defaultvalue}}{{/if}}{{/unless}}' + 'customTags', + '{{#if customTags}}{{#each customTags}}**{{titleCase tag}}**: {{#with (parseType value)~}}\n' + + '{{#if type}}{{>link to=type}}{{/if}}{{#if description}}{{{inlineLinks description}}}{{/if}}{{/with}} \n' + + '{{/each}}{{/if~}}\n' ], [ - 'sig-name', - '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + - '{{#if name}}{{#sig~}}\n' + - '{{{@depOpen}~}}\n' + - '{{{@codeOpen}~}}\n' + - '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + - '{{@parent~}}\n' + - '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{escape name}}}{{/if~}}\n' + - '{{#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + - '{{{@codeClose}~}}\n' + - '{{#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + - '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \\| " }}{{/if~}}\n' + - '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + - '{{{@depClose}~}}\n' + - '{{~/sig}}{{/if~}}\n' + - '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + 'default', + '{{#unless (equal defaultvalue undefined)}}**Default**: {{>defaultvalue}} \n' + + '{{/unless}}' ], [ - 'sig-link', - '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + - '{{#if name}}{{#sig~}}\n' + - '{{{@depOpen}~}}\n' + - '[{{{@codeOpen}~}}\n' + - '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + - '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}}\n' + - '{{~#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + - '{{{@codeClose}}}](#{{{anchorName}}})\n' + - '{{~#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + - '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \\| " }}{{/if~}}\n' + - '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + - '{{{@depClose}~}}\n' + - '{{~/sig}}{{/if~}}\n' + - '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + 'deprecated', + '{{#if deprecated}}***Deprecated***\n\n{{/if~}}' ], [ - 'sig-link-parent', - '{{#if name}}{{#sig~}}\n' + - '{{{@depOpen}~}}\n' + - '[{{{@codeOpen}~}}\n' + - '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + - '{{#if (isClassMember)}}{{@parent~}}{{/if~}}\n' + - '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}}\n' + - '{{~#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + - '{{{@codeClose}}}](#{{{anchorName}}})\n' + - '{{~#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + - '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \\| " }}{{/if~}}\n' + - '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + - '{{{@depClose}~}}\n' + - '{{~/sig}}{{/if~}}\n' + 'description', + '{{#if description}}{{{inlineLinks description}}}\n\n{{/if}}' ], [ - 'sig-link-html', - '{{#if name}}{{#sig no-gfm=true ~}}\n' + - '{{{@depOpen}~}}\n' + - '\n' + - '{{~{@codeOpen}~}}\n' + - '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + - '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}}\n' + - '{{~#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + - '{{{@codeClose}~}}\n' + - '\n' + - '{{~#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + - '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes html=true delimiter=" | " }}{{/if~}}\n' + - '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + - '{{{@depClose}~}}\n' + - '{{~/sig}}{{/if~}}\n' + 'examples', + '{{#examples}}\n' + + '**Example**{{#if caption}} *({{caption}})* {{else}} {{/if}}\n' + + '{{{inlineLinks example}}}\n' + + '{{/examples}}\n' ], [ - 'module-index', - '{{#unless (optionEquals "module-index-format" "none")~}}\n' + - '{{#if (optionEquals "module-index-format" "dl")}}{{>module-index-dl ~}}{{/if~}}\n' + - '{{#if (optionEquals "module-index-format" "grouped")}}{{>module-index-grouped ~}}{{/if~}}\n' + - '{{#if (optionEquals "module-index-format" "table")}}{{>module-index-table ~}}{{/if~}}\n' + - '{{/unless~}}\n' + 'fires', + '{{#if fires~}}\n' + + '**Emits**: {{>linked-type-list types=fires delimiter=", " }} \n' + + '{{/if}}' ], [ - 'module-index-table', - '{{#modules~}}\n' + - '{{#if @first~}}\n' + - '{{>heading-indent}}Modules\n' + + 'implements', + '{{#if implements}}**Implements**: {{>linked-type-list types=implements delimiter=", " }} \n' + + '{{/if}}\n' + ], + [ + 'license', + '{{#if license}}**License**: {{inlineLinks license}} \n{{/if~}}' + ], + [ + 'mixes', + '{{#if mixes~}}\n' + + '**Mixes**: {{>linked-type-list types=mixes delimiter=", " }} \n' + + '{{/if}}' + ], + [ + 'overrides', + '{{#if overrides}}**Overrides**: {{>link to=overrides}} \n{{/if~}}\n' + ], + [ + 'param-table-name', + '{{#if optional}}[{{/if~}}\n' + + '{{#if variable}}...{{/if~}}\n' + + '{{{name}~}}\n' + + '{{#if optional}}]{{/if}}' + ], + [ + 'params-list', + '{{#if params}}\n' + + '{{#params}}**Params**\n' + + '\n' + + '{{#each this~}}\n' + + '{{indent}}- {{name}}{{#if type}} {{>linked-type-list types=type.names delimiter=" | " }}{{/if}}{{#unless (equal defaultvalue undefined)}} {{>defaultvalue equals=true ~}}{{/unless}}{{#if description}} - {{{inlineLinks description}}}{{/if}}\n' + + '{{/each}}\n' + '\n' + + '{{/params~}}\n' + + '{{/if}}' + ], + [ + 'params-table-html', + '{{#if params}}\n' + '\n' + ' \n' + ' \n' + - ' \n' + + ' {{#each (tableHeadHtml params "name|Param" "type|Type" "defaultvalue|Default" "description|Description")}}{{/each}}\n' + ' \n' + ' \n' + ' \n' + - '{{/if~}}\n' + + ' {{#tableRow params "name" "type" "defaultvalue" "description" ~}}\n' + ' \n' + - ' \n' + - ' \n' + + ' {{#if @col1}}{{/if~}}\n' + + ' {{#if @col2}}{{/if~}}\n' + + ' {{#if @col3}}{{/if~}}\n' + + ' {{#if @col4}}{{/if}}\n' + ' \n' + - '{{#if @last~}}\n' + + ' {{~/tableRow}}\n' + ' \n' + '
ModuleDescription{{this}}
{{>sig-link-html}}{{{md (inlineLinks description)}}}{{>param-table-name}}{{>linked-type-list types=type.names delimiter=" | " html=true}}{{>defaultvalue}}{{{md (inlineLinks description)}}}
\n' + '\n' + - '{{/if~}}\n' + - '{{/modules}}\n' + '{{/if}}' ], [ - 'module-index-grouped', - '{{#modules~}}\n' + - '{{#if @first~}}{{>heading-indent}}Modules\n' + + 'params-table', + '{{#if params}}\n' + '\n' + - '{{/if~}}\n' + - '{{>member-index-grouped~}}\n' + - '{{/modules}}\n' + - '\n' - ], - [ - 'module-index-dl', - '{{#modules~}}\n' + - '{{#if @first~}}{{>heading-indent}}Modules\n' + + '{{tableHead params "name|Param" "type|Type" "defaultvalue|Default" "description|Description" ~}}\n' + '\n' + - '
\n' + - '{{/if~}}\n' + - '
{{>sig-link-html}}
\n' + - '
{{{md (inlineLinks description)}}}
\n' + - '{{#if @last~}}
\n' + + '{{#tableRow params "name" "type" "defaultvalue" "description" ~}}\n' + + '| {{#if @col1}}{{>param-table-name}} | {{/if~}}\n' + + '{{#if @col2}}{{>linked-type-list types=type.names delimiter=" \\| " }} | {{/if~}}\n' + + '{{#if @col3}}{{>defaultvalue}} | {{/if~}}\n' + + '{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}}\n' + + '{{/tableRow}}\n' + '\n' + - '{{/if~}}\n' + - '{{/modules~}}\n' + '{{/if}}' ], [ - 'global-index', - '{{>global-index-kinds kind="class" title="Classes" ~}}\n' + - '{{>global-index-kinds kind="mixin" title="Mixins" ~}}\n' + - '{{>global-index-kinds kind="member" title="Members" ~}}\n' + - '{{>global-index-kinds kind="namespace" title="Objects" ~}}\n' + - '{{>global-index-kinds kind="constant" title="Constants" ~}}\n' + - '{{>global-index-kinds kind="function" title="Functions" ~}}\n' + - '{{>global-index-kinds kind="event" title="Events" ~}}\n' + - '{{>global-index-kinds kind="typedef" title="Typedefs" ~}}\n' + - '{{>global-index-kinds kind="external" title="External" ~}}\n' + - '{{>global-index-kinds kind="interface" title="Interfaces" ~}}\n' + 'params', + '{{#if (optionEquals "param-list-format" "list")}}{{>params-list~}}{{/if~}}\n' + + '{{#if (optionEquals "param-list-format" "table")~}}\n' + + '{{#if (optionEquals "no-gfm" true)}}{{>params-table-html~}}{{else}}{{>params-table~}}{{/if~}}\n' + + '{{/if~}}\n' ], [ - 'global-index-table', - '{{#globals kind=kind~}}\n' + - '{{#if @first~}}\n' + - '{{>heading-indent}}{{../title}}\n' + + 'properties-list', + '{{#if properties}}**Properties**\n' + + '\n' + + '{{#each properties~}}\n' + + '{{#if (regexp-test name "\\w+\\.\\w+")}} {{/if}}- {{{name}}} {{>linked-type-list types=type.names delimiter=" \\| " ~}}{{#if description}} - {{{inlineLinks description}}}{{/if}} \n' + + '{{/each}}\n' + + '\n' + + '{{/if~}}' + ], + [ + 'properties-table-html', + '{{#if properties~}}**Properties**\n' + '\n' + '\n' + ' \n' + ' \n' + - ' \n' + + ' {{#each (tableHeadHtml properties "name|Name" "type|Type" "defaultvalue|Default" "description|Description")}}{{/each}}\n' + ' \n' + ' \n' + ' \n' + - '{{/if~}}\n' + + ' {{#tableRow properties "name" "type" "defaultvalue" "description" ~}}\n' + ' \n' + - ' \n' + - ' \n' + + ' {{#if @col1}}{{/if~}}\n' + + ' {{#if @col2}}{{/if~}}\n' + + ' {{#if @col3}}{{/if~}}\n' + + ' {{#if @col4}}{{/if}}\n' + ' \n' + - '{{#if @last~}}\n' + + ' {{~/tableRow}}\n' + ' \n' + '
GlobalDescription{{this}}
{{>sig-link-html}}{{{md (inlineLinks description)}}}{{>param-table-name}}{{>linked-type-list types=type.names delimiter=" | " html=true}}{{>defaultvalue}}{{{md (inlineLinks description)}}}
\n' + '\n' + - '{{/if~}}\n' + - '{{/globals}}\n' - ], - [ - 'global-index-kinds', - '{{#unless (optionEquals "global-index-format" "none")~}}\n' + - '{{#if (optionEquals "global-index-format" "dl")}}\n' + - '{{>global-index-dl kind=kind title=title ~}}\n' + - '{{/if~}}\n' + - '{{#if (optionEquals "global-index-format" "grouped")}}\n' + - '{{>global-index-grouped kind=kind title=title }}\n' + - '{{/if~}}\n' + - '{{#if (optionEquals "global-index-format" "table")}}\n' + - '{{>global-index-table kind=kind title=title ~}}\n' + - '{{/if~}}\n' + - '{{/unless~}}\n' + '{{/if}}' ], [ - 'global-index-grouped', - '{{#globals kind=kind~}}\n' + - '{{#if @first~}}{{>heading-indent}}{{../title}}\n' + + 'properties-table', + '{{#if properties}}**Properties**\n' + '\n' + - '{{/if~}}\n' + - '{{>member-index-grouped~}}\n' + - '{{#if @last}}\n' + + '{{tableHead properties "name|Name" "type|Type" "defaultvalue|Default" "description|Description" ~}}\n' + '\n' + - '{{/if~}}\n' + - '{{/globals}}\n' + '{{#tableRow properties "name" "type" "defaultvalue" "description" ~}}\n' + + '| {{#if @col1}}{{>param-table-name}} | {{/if~}}\n' + + '{{#if @col2}}{{>linked-type-list types=type.names delimiter=" \\| " }} | {{/if~}}\n' + + '{{#if @col3}}{{>defaultvalue}} | {{/if~}}\n' + + '{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}}\n' + + '{{/tableRow}}\n' + + '\n' + + '{{/if}}' ], [ - 'global-index-dl', - '{{#globals kind=kind ~}}\n' + - '{{#if @first~}}{{>heading-indent}}{{../title}}\n' + - '\n' + - '
\n' + - '{{/if~}}\n' + - '
{{>sig-link-html}}
\n' + - '
{{{md (inlineLinks description)}}}
\n' + - '{{#if @last~}}
\n' + - '\n' + - '{{/if~}}\n' + - '{{/globals~}}\n' + 'properties', + '{{#if (optionEquals "property-list-format" "list")}}{{>properties-list~}}{{/if~}}\n' + + '{{#if (optionEquals "property-list-format" "table")~}}\n' + + ' {{#if (optionEquals "no-gfm" true)}}{{>properties-table-html}}{{else}}{{>properties-table}}{{/if~}}\n' + + '{{/if~}}\n' ], [ - 'members', - '{{#children inherited=undefined ~}}\n{{>docs~}}\n{{/children~}}\n' + 'readOnly', + '{{#if readonly}}**Read only**: true \n{{/if~}}' ], [ - 'header', - '\n\n{{>heading-indent}}{{>sig-name}}\n' + 'requires', + '{{#if requires~}}\n' + + '**Requires**: {{>linked-type-list types=requires delimiter=", " }} \n' + + '{{/if}}' ], [ - 'docs', - '{{>header~}}\n{{>body}}\n{{>member-index~}}\n{{>separator~}}\n{{>members~}}\n' + 'returns', + '{{#if returns}}\n' + + '{{#if returns.[0].description~}}\n' + + '**Returns**: {{#each returns~}}\n' + + ' {{#if type~}}\n' + + ' {{#if type.names}}{{>linked-type-list types=type.names delimiter=" \\| " ~}}{{/if}}\n' + + ' {{~#if description}} - {{{inlineLinks description}}}{{/if~}}\n' + + ' {{else~}}\n' + + ' {{{inlineLinks description}~}}\n' + + ' {{/if~}}\n' + + '{{~/each}}\n' + + ' \n' + + '{{/if}}{{/if}}' ], [ - 'member-index', - '{{setLevel this 0~}}\n' + - "{{#if (descendants min=(option 'memberIndex.minDescendants'))~}}\n" + - '{{#if isExported~}}\n' + - '{{#if (equal (depth) 0)}}\n' + - '{{#if (optionEquals "member-index-format" "list")}}\n' + - '\n' + - '{{>member-index-list}}\n' + - '\n' + + 'scope', + '{{#if scope}}\n' + + '**Kind**: {{#if (equal kind "event") ~}}\n' + + 'event emitted{{#if memberof}} by {{>link to=memberof}}{{/if}} \n' + '{{else~}}\n' + - '\n' + - '{{>member-index-grouped}}\n' + - '\n' + - '{{/if~}}\n' + + '{{scope}} {{#if virtual}}abstract {{/if}}{{kindInThisContext}}{{#if memberof}} of {{>link to=memberof}}{{/if}} \n' + '{{/if~}}\n' + '{{else~}}\n' + - '{{#if (optionEquals "member-index-format" "list")}}\n' + - '\n' + - '{{>member-index-list}}\n' + + '{{#if isExported}}**Kind**: Exported {{kind}} \n' + + '{{/if~}}\n' + + '{{/if~}}' + ], + [ + 'see', + '{{#if see~}}\n' + '\n' + - '{{else}}\n' + + '{{#if (equal see.length 1)~}}\n' + + '**See**: {{{inlineLinks see.[0]}}} \n' + + '{{else~}}\n' + + '**See**\n' + '\n' + - '{{>member-index-grouped}}\n' + + '{{#each see}}- {{{inlineLinks this}}}\n' + + '{{/each}}\n' + '\n' + '{{/if~}}\n' + - '{{/if~}}\n' + - '{{/if}}\n' + '{{/if~}}' ], [ - 'member-index-list', - '{{>index-indent}}* {{>sig-link-parent}}\n' + - '{{#indexChildren ~}}\n' + - '{{>member-index-list~}}\n' + - '{{/indexChildren}}' + 'since', + '{{#if since}}**Since**: {{{inlineLinks since}}} \n{{/if~}}' ], [ - 'member-index-grouped', - '{{string-repeat " " (add level baseLevel)}}* {{#unless (equal _title undefined)}}_{{_title}}_{{else}}{{>sig-link}}{{/unless}}\n' + - '{{#groupBy (option "group-by")~}}\n' + - '{{>member-index-grouped baseLevel=(add ../level ../baseLevel 1)~}}\n' + - '{{/groupBy~}}\n' + 'summary', + '{{#if summary}}**Summary**: {{{inlineLinks summary}}} \n{{/if~}}\n' ], [ - 'version', - '{{#if version}}**Version**: {{inlineLinks version}} \n{{/if~}}' + 'this', + '{{#if thisvalue}}**this**: {{>link to=thisvalue}} \n{{/if~}}' + ], + [ + 'throws', + '{{#if exceptions~}}\n' + + '**Throws**:\n' + + '\n' + + '{{#each exceptions~}}\n' + + '- {{#if type.names}}{{>linked-type-list types=type.names}} {{/if}}{{{inlineLinks description}}}\n' + + '{{/each}}\n' + + '\n' + + '{{/if}}' ], [ 'todo', @@ -355,308 +334,329 @@ module.exports = [ '{{/if~}}\n' ], [ - 'throws', - '{{#if exceptions~}}\n' + - '**Throws**:\n' + - '\n' + - '{{#each exceptions~}}\n' + - '- {{#if type.names}}{{>linked-type-list types=type.names}} {{/if}}{{{inlineLinks description}}}\n' + - '{{/each}}\n' + - '\n' + - '{{/if}}' + 'version', + '{{#if version}}**Version**: {{inlineLinks version}} \n{{/if~}}' ], [ - 'this', - '{{#if thisvalue}}**this**: {{>link to=thisvalue}} \n{{/if~}}' + 'docs', + '{{>header~}}\n{{>body}}\n{{>member-index~}}\n{{>separator~}}\n{{>members~}}\n' ], [ - 'summary', - '{{#if summary}}**Summary**: {{{inlineLinks summary}}} \n{{/if~}}\n' + 'header', + '\n\n{{>heading-indent}}{{>sig-name}}\n' ], [ - 'since', - '{{#if since}}**Since**: {{{inlineLinks since}}} \n{{/if~}}' + 'member-index-grouped', + '{{string-repeat " " (add level baseLevel)}}* {{#unless (equal _title undefined)}}_{{_title}}_{{else}}{{>sig-link}}{{/unless}}\n' + + '{{#groupBy (option "group-by")~}}\n' + + '{{>member-index-grouped baseLevel=(add ../level ../baseLevel 1)~}}\n' + + '{{/groupBy~}}\n' ], [ - 'see', - '{{#if see~}}\n' + + 'member-index-list', + '{{>index-indent}}* {{>sig-link-parent}}\n' + + '{{#indexChildren ~}}\n' + + '{{>member-index-list~}}\n' + + '{{/indexChildren}}' + ], + [ + 'member-index', + '{{setLevel this 0~}}\n' + + "{{#if (descendants min=(option 'memberIndex.minDescendants'))~}}\n" + + '{{#if isExported~}}\n' + + '{{#if (equal (depth) 0)}}\n' + + '{{#if (optionEquals "member-index-format" "list")}}\n' + + '\n' + + '{{>member-index-list}}\n' + '\n' + - '{{#if (equal see.length 1)~}}\n' + - '**See**: {{{inlineLinks see.[0]}}} \n' + '{{else~}}\n' + - '**See**\n' + '\n' + - '{{#each see}}- {{{inlineLinks this}}}\n' + - '{{/each}}\n' + + '{{>member-index-grouped}}\n' + '\n' + '{{/if~}}\n' + - '{{/if~}}' - ], - [ - 'scope', - '{{#if scope}}\n' + - '**Kind**: {{#if (equal kind "event") ~}}\n' + - 'event emitted{{#if memberof}} by {{>link to=memberof}}{{/if}} \n' + - '{{else~}}\n' + - '{{scope}} {{#if virtual}}abstract {{/if}}{{kindInThisContext}}{{#if memberof}} of {{>link to=memberof}}{{/if}} \n' + '{{/if~}}\n' + '{{else~}}\n' + - '{{#if isExported}}**Kind**: Exported {{kind}} \n' + + '{{#if (optionEquals "member-index-format" "list")}}\n' + + '\n' + + '{{>member-index-list}}\n' + + '\n' + + '{{else}}\n' + + '\n' + + '{{>member-index-grouped}}\n' + + '\n' + + '{{/if~}}\n' + '{{/if~}}\n' + - '{{/if~}}' - ], - [ - 'returns', - '{{#if returns}}\n' + - '{{#if returns.[0].description~}}\n' + - '**Returns**: {{#each returns~}}\n' + - ' {{#if type~}}\n' + - ' {{#if type.names}}{{>linked-type-list types=type.names delimiter=" \\| " ~}}{{/if}}\n' + - ' {{~#if description}} - {{{inlineLinks description}}}{{/if~}}\n' + - ' {{else~}}\n' + - ' {{{inlineLinks description}~}}\n' + - ' {{/if~}}\n' + - '{{~/each}}\n' + - ' \n' + - '{{/if}}{{/if}}' - ], - [ - 'requires', - '{{#if requires~}}\n' + - '**Requires**: {{>linked-type-list types=requires delimiter=", " }} \n' + - '{{/if}}' - ], - [ - 'readOnly', - '{{#if readonly}}**Read only**: true \n{{/if~}}' - ], - [ - 'overrides', - '{{#if overrides}}**Overrides**: {{>link to=overrides}} \n{{/if~}}\n' - ], - [ - 'mixes', - '{{#if mixes~}}\n' + - '**Mixes**: {{>linked-type-list types=mixes delimiter=", " }} \n' + - '{{/if}}' - ], - [ - 'license', - '{{#if license}}**License**: {{inlineLinks license}} \n{{/if~}}' - ], - [ - 'implements', - '{{#if implements}}**Implements**: {{>linked-type-list types=implements delimiter=", " }} \n' + '{{/if}}\n' ], [ - 'fires', - '{{#if fires~}}\n' + - '**Emits**: {{>linked-type-list types=fires delimiter=", " }} \n' + - '{{/if}}' - ], - [ - 'examples', - '{{#examples}}\n' + - '**Example**{{#if caption}} *({{caption}})* {{else}} {{/if}}\n' + - '{{{inlineLinks example}}}\n' + - '{{/examples}}\n' - ], - [ - 'description', - '{{#if description}}{{{inlineLinks description}}}\n\n{{/if}}' - ], - [ - 'deprecated', - '{{#if deprecated}}***Deprecated***\n\n{{/if~}}' - ], - [ - 'default', - '{{#unless (equal defaultvalue undefined)}}**Default**: {{>defaultvalue}} \n' + - '{{/unless}}' - ], - [ - 'customTags', - '{{#if customTags}}{{#each customTags}}**{{titleCase tag}}**: {{#with (parseType value)~}}\n' + - '{{#if type}}{{>link to=type}}{{/if}}{{#if description}}{{{inlineLinks description}}}{{/if}}{{/with}} \n' + - '{{/each}}{{/if~}}\n' - ], - [ - 'copyright', - '{{#if copyright}}**Copyright**: {{{inlineLinks copyright}}} \n{{/if~}}\n' - ], - [ - 'chainable', - '{{#if chainable}}**Chainable** \n{{/if~}}' - ], - [ - 'category', - '{{#if category}}**Category**: {{inlineLinks category}} \n{{/if~}}' - ], - [ - 'body', - '{{>deprecated~}}\n' + - '{{>description~}}\n' + - '{{>scope~}}\n' + - '{{>summary~}}\n' + - '{{>augments~}}\n' + - '{{>implements~}}\n' + - '{{>mixes~}}\n' + - '{{>default~}}\n' + - '{{>chainable~}}\n' + - '{{>overrides~}}\n' + - '{{>returns~}}\n' + - '{{>category~}}\n' + - '{{>throws~}}\n' + - '{{>fires~}}\n' + - '{{>this~}}\n' + - '{{>access~}}\n' + - '{{>readOnly~}}\n' + - '{{>requires~}}\n' + - '{{>customTags~}}\n' + - '{{>see~}}\n' + - '{{>since~}}\n' + - '{{>version~}}\n' + - '{{>authors~}}\n' + - '{{>license~}}\n' + - '{{>copyright~}}\n' + - '{{>todo~}}\n' + - '{{>params~}}\n' + - '{{>properties~}}\n' + - '{{>examples~}}\n' - ], - [ - 'authors', - '{{#if author}}{{#each author}}**Author**: {{{inlineLinks this}}} \n' + - '{{/each}}{{/if~}}\n' + 'members', + '{{#children inherited=undefined ~}}\n{{>docs~}}\n{{/children~}}\n' ], [ - 'augments', - '{{#if augments}}**Extends**: {{>linked-type-list types=augments delimiter=", " }} \n' + - '{{/if}}\n' + 'global-index-dl', + '{{#globals kind=kind ~}}\n' + + '{{#if @first~}}{{>heading-indent}}{{../title}}\n' + + '\n' + + '
\n' + + '{{/if~}}\n' + + '
{{>sig-link-html}}
\n' + + '
{{{md (inlineLinks description)}}}
\n' + + '{{#if @last~}}
\n' + + '\n' + + '{{/if~}}\n' + + '{{/globals~}}\n' ], [ - 'access', - '{{#if access}}**Access**: {{{access}}} \n{{/if~}}\n' + 'global-index-grouped', + '{{#globals kind=kind~}}\n' + + '{{#if @first~}}{{>heading-indent}}{{../title}}\n' + + '\n' + + '{{/if~}}\n' + + '{{>member-index-grouped~}}\n' + + '{{#if @last}}\n' + + '\n' + + '{{/if~}}\n' + + '{{/globals}}\n' ], [ - 'params', - '{{#if (optionEquals "param-list-format" "list")}}{{>params-list~}}{{/if~}}\n' + - '{{#if (optionEquals "param-list-format" "table")~}}\n' + - '{{#if (optionEquals "no-gfm" true)}}{{>params-table-html~}}{{else}}{{>params-table~}}{{/if~}}\n' + - '{{/if~}}\n' + 'global-index-kinds', + '{{#unless (optionEquals "global-index-format" "none")~}}\n' + + '{{#if (optionEquals "global-index-format" "dl")}}\n' + + '{{>global-index-dl kind=kind title=title ~}}\n' + + '{{/if~}}\n' + + '{{#if (optionEquals "global-index-format" "grouped")}}\n' + + '{{>global-index-grouped kind=kind title=title }}\n' + + '{{/if~}}\n' + + '{{#if (optionEquals "global-index-format" "table")}}\n' + + '{{>global-index-table kind=kind title=title ~}}\n' + + '{{/if~}}\n' + + '{{/unless~}}\n' ], [ - 'params-table', - '{{#if params}}\n' + - '\n' + - '{{tableHead params "name|Param" "type|Type" "defaultvalue|Default" "description|Description" ~}}\n' + - '\n' + - '{{#tableRow params "name" "type" "defaultvalue" "description" ~}}\n' + - '| {{#if @col1}}{{>param-table-name}} | {{/if~}}\n' + - '{{#if @col2}}{{>linked-type-list types=type.names delimiter=" \\| " }} | {{/if~}}\n' + - '{{#if @col3}}{{>defaultvalue}} | {{/if~}}\n' + - '{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}}\n' + - '{{/tableRow}}\n' + + 'global-index-table', + '{{#globals kind=kind~}}\n' + + '{{#if @first~}}\n' + + '{{>heading-indent}}{{../title}}\n' + '\n' + - '{{/if}}' - ], - [ - 'params-table-html', - '{{#if params}}\n' + '\n' + ' \n' + ' \n' + - ' {{#each (tableHeadHtml params "name|Param" "type|Type" "defaultvalue|Default" "description|Description")}}{{/each}}\n' + + ' \n' + ' \n' + ' \n' + ' \n' + - ' {{#tableRow params "name" "type" "defaultvalue" "description" ~}}\n' + + '{{/if~}}\n' + ' \n' + - ' {{#if @col1}}{{/if~}}\n' + - ' {{#if @col2}}{{/if~}}\n' + - ' {{#if @col3}}{{/if~}}\n' + - ' {{#if @col4}}{{/if}}\n' + + ' \n' + + ' \n' + ' \n' + - ' {{~/tableRow}}\n' + + '{{#if @last~}}\n' + ' \n' + '
{{this}}GlobalDescription
{{>param-table-name}}{{>linked-type-list types=type.names delimiter=" | " html=true}}{{>defaultvalue}}{{{md (inlineLinks description)}}}{{>sig-link-html}}{{{md (inlineLinks description)}}}
\n' + '\n' + - '{{/if}}' - ], - [ - 'params-list', - '{{#if params}}\n' + - '{{#params}}**Params**\n' + - '\n' + - '{{#each this~}}\n' + - '{{indent}}- {{name}}{{#if type}} {{>linked-type-list types=type.names delimiter=" | " }}{{/if}}{{#unless (equal defaultvalue undefined)}} {{>defaultvalue equals=true ~}}{{/unless}}{{#if description}} - {{{inlineLinks description}}}{{/if}}\n' + - '{{/each}}\n' + - '\n' + - '{{/params~}}\n' + - '{{/if}}' + '{{/if~}}\n' + + '{{/globals}}\n' ], [ - 'param-table-name', - '{{#if optional}}[{{/if~}}\n' + - '{{#if variable}}...{{/if~}}\n' + - '{{{name}~}}\n' + - '{{#if optional}}]{{/if}}' + 'global-index', + '{{>global-index-kinds kind="class" title="Classes" ~}}\n' + + '{{>global-index-kinds kind="mixin" title="Mixins" ~}}\n' + + '{{>global-index-kinds kind="member" title="Members" ~}}\n' + + '{{>global-index-kinds kind="namespace" title="Objects" ~}}\n' + + '{{>global-index-kinds kind="constant" title="Constants" ~}}\n' + + '{{>global-index-kinds kind="function" title="Functions" ~}}\n' + + '{{>global-index-kinds kind="event" title="Events" ~}}\n' + + '{{>global-index-kinds kind="typedef" title="Typedefs" ~}}\n' + + '{{>global-index-kinds kind="external" title="External" ~}}\n' + + '{{>global-index-kinds kind="interface" title="Interfaces" ~}}\n' ], [ - 'properties', - '{{#if (optionEquals "property-list-format" "list")}}{{>properties-list~}}{{/if~}}\n' + - '{{#if (optionEquals "property-list-format" "table")~}}\n' + - ' {{#if (optionEquals "no-gfm" true)}}{{>properties-table-html}}{{else}}{{>properties-table}}{{/if~}}\n' + + 'main-index', + '{{! a main index is only shown if at least 2 global or modules exist ~}}\n' + + '\n' + + '{{#if (showMainIndex)~}}\n' + + '{{>module-index~}}\n' + + '{{>global-index~}}\n' + '{{/if~}}\n' ], [ - 'properties-table', - '{{#if properties}}**Properties**\n' + + 'module-index-dl', + '{{#modules~}}\n' + + '{{#if @first~}}{{>heading-indent}}Modules\n' + '\n' + - '{{tableHead properties "name|Name" "type|Type" "defaultvalue|Default" "description|Description" ~}}\n' + + '
\n' + + '{{/if~}}\n' + + '
{{>sig-link-html}}
\n' + + '
{{{md (inlineLinks description)}}}
\n' + + '{{#if @last~}}
\n' + '\n' + - '{{#tableRow properties "name" "type" "defaultvalue" "description" ~}}\n' + - '| {{#if @col1}}{{>param-table-name}} | {{/if~}}\n' + - '{{#if @col2}}{{>linked-type-list types=type.names delimiter=" \\| " }} | {{/if~}}\n' + - '{{#if @col3}}{{>defaultvalue}} | {{/if~}}\n' + - '{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}}\n' + - '{{/tableRow}}\n' + + '{{/if~}}\n' + + '{{/modules~}}\n' + ], + [ + 'module-index-grouped', + '{{#modules~}}\n' + + '{{#if @first~}}{{>heading-indent}}Modules\n' + '\n' + - '{{/if}}' + '{{/if~}}\n' + + '{{>member-index-grouped~}}\n' + + '{{/modules}}\n' + + '\n' ], [ - 'properties-table-html', - '{{#if properties~}}**Properties**\n' + + 'module-index-table', + '{{#modules~}}\n' + + '{{#if @first~}}\n' + + '{{>heading-indent}}Modules\n' + '\n' + '\n' + ' \n' + ' \n' + - ' {{#each (tableHeadHtml properties "name|Name" "type|Type" "defaultvalue|Default" "description|Description")}}{{/each}}\n' + + ' \n' + ' \n' + ' \n' + ' \n' + - ' {{#tableRow properties "name" "type" "defaultvalue" "description" ~}}\n' + + '{{/if~}}\n' + ' \n' + - ' {{#if @col1}}{{/if~}}\n' + - ' {{#if @col2}}{{/if~}}\n' + - ' {{#if @col3}}{{/if~}}\n' + - ' {{#if @col4}}{{/if}}\n' + + ' \n' + + ' \n' + ' \n' + - ' {{~/tableRow}}\n' + + '{{#if @last~}}\n' + ' \n' + '
{{this}}ModuleDescription
{{>param-table-name}}{{>linked-type-list types=type.names delimiter=" | " html=true}}{{>defaultvalue}}{{{md (inlineLinks description)}}}{{>sig-link-html}}{{{md (inlineLinks description)}}}
\n' + '\n' + - '{{/if}}' + '{{/if~}}\n' + + '{{/modules}}\n' ], [ - 'properties-list', - '{{#if properties}}**Properties**\n' + + 'module-index', + '{{#unless (optionEquals "module-index-format" "none")~}}\n' + + '{{#if (optionEquals "module-index-format" "dl")}}{{>module-index-dl ~}}{{/if~}}\n' + + '{{#if (optionEquals "module-index-format" "grouped")}}{{>module-index-grouped ~}}{{/if~}}\n' + + '{{#if (optionEquals "module-index-format" "table")}}{{>module-index-table ~}}{{/if~}}\n' + + '{{/unless~}}\n' + ], + [ + 'main', + '{{>main-index~}}\n{{>all-docs~}}\n' + ], + [ + 'heading-indent', + '{{string-repeat "#" (headingDepth)}} ' + ], + [ + 'index-indent', + '{{string-repeat " " (indexDepth)}}' + ], + [ + 'separator', + '{{#if (option "separators")}}\n\n* * *\n\n{{/if~}}' + ], + [ + 'sig-link-html', + '{{#if name}}{{#sig no-gfm=true ~}}\n' + + '{{{@depOpen}~}}\n' + + '\n' + + '{{~{@codeOpen}~}}\n' + + '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + + '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}}\n' + + '{{~#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + + '{{{@codeClose}~}}\n' + + '\n' + + '{{~#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + + '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes html=true delimiter=" | " }}{{/if~}}\n' + + '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + + '{{{@depClose}~}}\n' + + '{{~/sig}}{{/if~}}\n' + ], + [ + 'sig-link-parent', + '{{#if name}}{{#sig~}}\n' + + '{{{@depOpen}~}}\n' + + '[{{{@codeOpen}~}}\n' + + '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + + '{{#if (isClassMember)}}{{@parent~}}{{/if~}}\n' + + '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}}\n' + + '{{~#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + + '{{{@codeClose}}}](#{{{anchorName}}})\n' + + '{{~#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + + '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \\| " }}{{/if~}}\n' + + '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + + '{{{@depClose}~}}\n' + + '{{~/sig}}{{/if~}}\n' + ], + [ + 'sig-link', + '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + + '{{#if name}}{{#sig~}}\n' + + '{{{@depOpen}~}}\n' + + '[{{{@codeOpen}~}}\n' + + '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + + '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}}\n' + + '{{~#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + + '{{{@codeClose}}}](#{{{anchorName}}})\n' + + '{{~#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + + '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \\| " }}{{/if~}}\n' + + '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + + '{{{@depClose}~}}\n' + + '{{~/sig}}{{/if~}}\n' + + '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + ], + [ + 'sig-name', + '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + + '{{#if name}}{{#sig~}}\n' + + '{{{@depOpen}~}}\n' + + '{{{@codeOpen}~}}\n' + + '{{#if @prefix}}{{@prefix}} {{/if~}}\n' + + '{{@parent~}}\n' + + '{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{escape name}}}{{/if~}}\n' + + '{{#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}\n' + + '{{{@codeClose}~}}\n' + + '{{#if @returnSymbol}} {{@returnSymbol}}{{/if~}}\n' + + '{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \\| " }}{{/if~}}\n' + + '{{#if @suffix}} {{@suffix}}{{/if~}}\n' + + '{{{@depClose}~}}\n' + + '{{~/sig}}{{/if~}}\n' + + '{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}\n' + ], + [ + 'defaultvalue', + '{{#unless (equal defaultvalue undefined)}}{{#if equals}} = {{/if}}{{#if (equal type.names.[0] "string")}}{{json-stringify defaultvalue}}{{else}}{{defaultvalue}}{{/if}}{{/unless}}' + ], + [ + 'link', + '{{! usage: link to="namepath" html=true/false caption="optional caption"~}}\n' + '\n' + - '{{#each properties~}}\n' + - '{{#if (regexp-test name "\\w+\\.\\w+")}} {{/if}}- {{{name}}} {{>linked-type-list types=type.names delimiter=" \\| " ~}}{{#if description}} - {{{inlineLinks description}}}{{/if}} \n' + - '{{/each}}\n' + + '{{~#if html~}}\n' + + '\n' + '\n' + - '{{/if~}}' + '{{~#link to~}}\n' + + '{{#if url~}}\n' + + '{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if}}\n' + + '{{~else~}}\n' + + '{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if~}}\n' + + '{{/if~}}\n' + + '{{/link~}}\n' + + '\n' + + '\n' + + '{{~else~}}\n' + + '\n' + + '{{#link to~}}\n' + + '{{#if url~}}\n' + + '[{{#if ../../caption}}{{escape ../../../caption}}{{else}}{{escape name}}{{/if}}]({{{url}}})\n' + + '{{~else~}}\n' + + '{{#if ../../caption}}{{escape ../../../caption}}{{else}}{{escape name}}{{/if~}}\n' + + '{{~/if~}}\n' + + '{{/link~}}\n' + + '\n' + + '{{/if~}}\n' + ], + [ + 'linked-type-list', + '{{#each types~}}\n' + + '{{>link to=this html=../html ~}}\n' + + '{{#unless @last}}{{{../delimiter}}}{{/unless~}}\n' + + '{{/each}}' ] ] diff --git a/test/overrides/helpers.js b/test/overrides/helpers.js index eb35e22..09215b5 100644 --- a/test/overrides/helpers.js +++ b/test/overrides/helpers.js @@ -1,8 +1,11 @@ -'use strict' +const overrides = { + inlineLinks: function (text, options) { + return 'get me?' + }, -exports.inlineLinks = inlineLinks - -/* override inlineLinks */ -function inlineLinks (text, options) { - return 'get me?' + orphans: function () { + return 'whatever' + } } + +module.exports = overrides