typedoc-plugin-extras
Advanced tools
Comparing version 2.2.4 to 2.2.5
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.replaceTopMostTitleLink = exports.replaceDescription = exports.replaceTopMostTitle = exports.isUrl = exports.appendToFooter = exports.appendFavicon = exports.makeRelativeToRoot = void 0; | ||
exports.replaceTopMostTitleLink = exports.replaceDescription = exports.replaceTopMostTitle = exports.isUrl = exports.setupNewlineInFooter = exports.appendToFooter = exports.appendFavicon = exports.makeRelativeToRoot = void 0; | ||
/** | ||
@@ -39,3 +39,3 @@ * Creates a relative path from a host file to a target file which is located in the root. | ||
function appendToFooter(html, value) { | ||
return html.replace(/(<p>Generated using.*TypeDoc.*)(<\/p>)/, '$1' + // Start of <p> | ||
return html.replace(/(<p.*>Generated using.*TypeDoc.*)(<\/p>)/, '$1' + // Start of <p> | ||
value + | ||
@@ -47,2 +47,13 @@ '$2' // End of <p> | ||
/** | ||
* Sets up the newline in footer. | ||
* @param html HTML string to append to. | ||
*/ | ||
function setupNewlineInFooter(html) { | ||
return html.replace(/(<p)(>Generated using.*TypeDoc)/, '$1' + // Opening of <p> tag | ||
' style="line-height: 28px;"' + // Add spacing between the first line of footer and the date. | ||
'$2' // End of "Generated using TypeDoc" | ||
); | ||
} | ||
exports.setupNewlineInFooter = setupNewlineInFooter; | ||
/** | ||
* Determines whether a string is a URL. | ||
@@ -49,0 +60,0 @@ * @param url The URL to check. |
@@ -83,15 +83,17 @@ "use strict"; | ||
if (options.footerTypedocVersion) { | ||
page.contents = (0, helpers_1.appendToFooter)(page.contents, ` version ${TYPEDOC_VERSION}`); | ||
page.contents = (0, helpers_1.appendToFooter)(page.contents, ` v${TYPEDOC_VERSION}`); | ||
} | ||
page.contents = (0, helpers_1.setupNewlineInFooter)(page.contents); | ||
// Add generation date and/or time. | ||
if (!options.hideGenerator && (options.footerDate || options.footerTime)) { | ||
const now = new Date(); | ||
const date = ` on ${now.toLocaleDateString()}`; | ||
const time = ` at ${now.toLocaleTimeString()}`; | ||
let dateTime = ','; | ||
let args = []; | ||
if (options.footerDate) | ||
dateTime += date; | ||
args.push("dateStyle: 'medium'"); | ||
if (options.footerTime) | ||
dateTime += time; | ||
page.contents = (0, helpers_1.appendToFooter)(page.contents, dateTime); | ||
args.push("timeStyle: 'long'"); | ||
const dateFormatter = `new Intl.DateTimeFormat(navigator.language, {${args.join(',')}})`; | ||
// Compute the generation date string on client-side. | ||
const time = `<br><span id="generation-date"></span><script>window.GENERATION_DATE=${now.getTime()};document.getElementById('generation-date').innerText=${dateFormatter}.format(window.GENERATION_DATE)</script>`; | ||
page.contents = (0, helpers_1.appendToFooter)(page.contents, time); | ||
} | ||
@@ -98,0 +100,0 @@ // Set custom title. |
{ | ||
"name": "typedoc-plugin-extras", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"description": "A plugin for TypeDoc which adds extras to the generated documentation", | ||
@@ -5,0 +5,0 @@ "main": "./dist/main.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27528
319