- ')
this.menuBegan = true
}
this.write('
- ') if (link) { this.write(``) } // Write the real menu entry text this.write(name) if (link) { this.write('') } this.write(' ') } /** * Ends an opened menu */ endMenu() { if (!this.menuBegan) { throw new Error('No menu had been started in the first place.') } this.write('
---${tlobject.isFunction ? 'functions' : 'types'}---\n` ) // Write the function or type and its ID if (tlobject.namespace) { this.write(tlobject.namespace) this.write('.') } this.write( `${tlobject.name}#${tlobject.id.toString(16).padStart(8, '0')}` ) // Write all the arguments (or do nothing if there's none) for (const arg of tlobject.args) { this.write(' ') const addLink = !arg.genericDefinition && !arg.isGeneric // "Opening" modifiers if (arg.genericDefinition) { this.write('{') } // Argument name this.write(arg.name) this.write(':') // "Opening" modifiers if (arg.isFlag) { this.write(`flags.${arg.flagIndex}?`) } if (arg.isGeneric) { this.write('!') } if (arg.isVector) { this.write( `Vector<` ) } // Argument type if (arg.type) { if (addLink) { this.write(``) } this.write(arg.type) if (addLink) { this.write('') } } else { this.write('#') } // "Closing" modifiers if (arg.isVector) { this.write('>') } if (arg.genericDefinition) { this.write('}') } } // Now write the resulting type (result from a function/type) this.write(' = ') const [genericName] = tlobject.args .filter((arg) => arg.genericDefinition) .map((arg) => arg.name) if (tlobject.result === genericName) { // Generic results cannot have any link this.write(tlobject.result) } else { if (/^vector+$/, '') this.write( `${vector}<` ) this.write( `${inner}>` ) } else { this.write( `${ tlobject.result }` ) } } this.write('') } /** * Begins a table with the given 'column_count', required to automatically * create the right amount of columns when adding items to the rows */ beginTable(columnCount) { this.tableColumns = columnCount this.tableColumnsLeft = 0 this.write('
') if (bold) { this.write('') } if (link) { this.write(``) } // Finally write the real table data, the given text this.write(text) if (link) { this.write('') } if (bold) { this.write('') } this.write(' | ') this.tableColumnsLeft -= 1 if (!this.tableColumnsLeft) { this.write('
${text}
`) } /** * Writes a button with 'text' which can be used * to copy 'textToCopy' to clipboard when it's clicked. */ writeCopyButton(text, textToCopy) { this.writeCopyScript = true this.write( `` ) } addScript(src, path) { if (path) { this._script += `` } else if (src) { this._script += `` } } /** * Ends the whole document. This should be called the last */ endBody() { if (this.writeCopyScript) { this.write( '' + '' ) } this.write(`