Remove un-minifiable whitespace

This commit is contained in:
Florine W. Dekker 2021-03-27 21:51:01 +01:00
parent a02892414d
commit 543f65675d
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
2 changed files with 34 additions and 39 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@fwdekker/template", "name": "@fwdekker/template",
"version": "0.0.24", "version": "0.0.25",
"description": "The base template for pages on fwdekker.com.", "description": "The base template for pages on fwdekker.com.",
"author": "Felix W. Dekker (https://fwdekker.com)", "author": "Felix W. Dekker (https://fwdekker.com)",
"license": "MIT", "license": "MIT",

View File

@ -51,14 +51,13 @@ export const doAfterLoad = function (fun) {
* @returns {HTMLElement} a base navigation element that will eventually be filled with contents * @returns {HTMLElement} a base navigation element that will eventually be filled with contents
*/ */
export const nav = function (highlightPath = "") { export const nav = function (highlightPath = "") {
const base = stringToHtml(` const base = stringToHtml(
<ul> `<ul><li><a href="https://fwdekker.com/">` +
<li><a href="https://fwdekker.com/"> `<div class="logo"><img class="logo" src="https://fwdekker.com/favicon.png" alt="FWDekker" /></div>` +
<div class="logo"><img class="logo" src="https://fwdekker.com/favicon.png" alt="FWDekker" /></div> `<b>FWDekker</b>` +
<b>FWDekker</b> `</a></li></ul>`,
</a></li> "ul"
</ul> );
`, "ul");
fetch("https://fwdekker.com/api/nav/") fetch("https://fwdekker.com/api/nav/")
.then(it => it.json()) .then(it => it.json())
@ -93,12 +92,11 @@ const unpackEntry = function (entry, path = "/", highlightPath = "") {
const depth = path.split("/").length - 2; // -1 because count parts, then another -1 because of leading `/` const depth = path.split("/").length - 2; // -1 because count parts, then another -1 because of leading `/`
const arrow = depth === 0 ? "&#9662;" : "&#9656;"; const arrow = depth === 0 ? "&#9662;" : "&#9656;";
return ` return "" +
<li class="${shouldHighlight ? "currentPage" : ""}"> `<li class="${shouldHighlight ? "currentPage" : ""}">` +
<a href="${entry.link}">${entry.name} ${arrow}</a> `<a href="${entry.link}">${entry.name} ${arrow}</a>` +
<ul>${entry.entries.map(it => unpackEntry(it, `${path + entry.name}/`, highlightPath)).join("")}</ul> `<ul>${entry.entries.map(it => unpackEntry(it, `${path + entry.name}/`, highlightPath)).join("")}</ul>` +
</li> `</li>`;
`;
}; };
@ -113,14 +111,13 @@ export const header = function ({title, description}) {
if (title === undefined && description === undefined) if (title === undefined && description === undefined)
return stringToHtml(`<header class="header"></header>`, "header"); return stringToHtml(`<header class="header"></header>`, "header");
return stringToHtml(` return stringToHtml(
<header class="header"> `<header class="header"><section class="container">` +
<section class="container"> (title !== undefined ? `<h1>${title}</h1>` : "") +
${(title !== undefined ? `<h1>${title}</h1>` : "")} (description !== undefined ? `<p><em>${description}</em></p>` : "") +
${(description !== undefined ? `<p><em>${description}</em></p>` : "")} `</section></header>`,
</section> "header"
</header> );
`, "header");
}; };
@ -143,22 +140,20 @@ export const footer = function (
author, authorURL, license, licenseURL, vcs, vcsURL, version, author, authorURL, license, licenseURL, vcs, vcsURL, version,
privacyPolicyURL = undefined privacyPolicyURL = undefined
}) { }) {
return stringToHtml(` return stringToHtml(
<footer class="footer"> `<footer class="footer"><section class="container">` +
<section class="container"> footerLink("Made by ", author, authorURL, ". ") +
${footerLink("Made by ", author, authorURL, ". ")} footerLink("Licensed under the ", license, licenseURL, ". ") +
${footerLink("Licensed under the ", license, licenseURL, ". ")} footerLink("Source code available on ", vcs, vcsURL, ". ") +
${footerLink("Source code available on ", vcs, vcsURL, ". ")} footerLink(
${footerLink( "Consider reading the ",
"Consider reading the ", privacyPolicyURL === null ? undefined : "privacy policy",
privacyPolicyURL === null ? undefined : "privacy policy", privacyPolicyURL === undefined ? "https://fwdekker.com/privacy/" : privacyPolicyURL,
privacyPolicyURL === undefined ? "https://fwdekker.com/privacy/" : privacyPolicyURL, ". "
". " ) +
)} `<div style="float: right;">${version || ""}</div>` +
<div style="float: right;">${version || ""}</div> `</section></footer>`,
</section> "footer");
</footer>
`, "footer");
}; };
/** /**