diff --git a/config/eslint/custom-rules.ts b/config/eslint/custom-rules.ts
index 7519ac9f..daa50c85 100644
--- a/config/eslint/custom-rules.ts
+++ b/config/eslint/custom-rules.ts
@@ -1,9 +1,11 @@
+import stylistic from "@stylistic/eslint-plugin";
import jsdoc from "eslint-plugin-jsdoc";
export default {
files: ["**/*.{js,mjs,cjs,ts,tsx}"],
plugins: {
- jsdoc
+ jsdoc,
+ "@stylistic": stylistic
},
rules: {
"@typescript-eslint/no-unused-vars": "warn",
@@ -68,14 +70,21 @@ export default {
next: "*"
}
],
- "lines-around-comment": [
+ // The @stylistic variant understands TypeScript bodies (interfaces,
+ // enums, type literals, modules), so it does not fight Prettier there.
+ "lines-around-comment": "off",
+ "@stylistic/lines-around-comment": [
"warn",
{
beforeBlockComment: true,
allowBlockStart: true,
allowObjectStart: true,
allowArrayStart: true,
- allowClassStart: true
+ allowClassStart: true,
+ allowInterfaceStart: true,
+ allowEnumStart: true,
+ allowTypeStart: true,
+ allowModuleStart: true
}
],
"max-depth": ["warn", 4],
diff --git a/config/eslint/scripts.ts b/config/eslint/scripts.ts
index b6e3fbf2..e1a0b480 100644
--- a/config/eslint/scripts.ts
+++ b/config/eslint/scripts.ts
@@ -1,12 +1,13 @@
/**
- * Overrides for the maintenance scripts under `scripts/`.
+ * Overrides for the maintenance scripts under `scripts/` and the authoring
+ * inputs they load from `docs/` (`docs/content/authored/*.mjs`).
*
* These are build and integration-test files rather than library sources:
* they are plain JavaScript, they run on a console, and the Apps Script ones
* reach for the library through the shared global scope.
*/
export default {
- files: ["scripts/**/*.{js,mjs,cjs}"],
+ files: ["scripts/**/*.{js,mjs,cjs}", "docs/**/*.{js,mjs,cjs}"],
rules: {
// A build script reports its progress; that is its interface.
"no-console": "off",
@@ -17,6 +18,11 @@ export default {
// A bundler exists to read and write computed paths.
"security/detect-non-literal-fs-filename": "off",
+ // The patterns parse repository sources and are built from constants
+ // in these files, never from outside input.
+ "security/detect-unsafe-regex": "off",
+ "security/detect-non-literal-regexp": "off",
+
// The lookups here are into objects these files declare themselves.
"security/detect-object-injection": "off"
}
diff --git a/config/eslint/security.ts b/config/eslint/security.ts
index 0201f027..40fed626 100644
--- a/config/eslint/security.ts
+++ b/config/eslint/security.ts
@@ -11,6 +11,10 @@ export default {
security
},
rules: {
- ...security.configs.recommended.rules
+ ...security.configs.recommended.rules,
+
+ // Flags every `obj[key]`. The keys here come from code, not from request
+ // input, and CodeQL already covers prototype pollution.
+ "security/detect-object-injection": "off"
}
};
diff --git a/docs/content/authored/_entry.mjs b/docs/content/authored/_entry.mjs
index 18c96a19..2b6e5ee3 100644
--- a/docs/content/authored/_entry.mjs
+++ b/docs/content/authored/_entry.mjs
@@ -1,4 +1,6 @@
-/** Assembles one prose entry from a table keyed by field, then by language. */
+/**
+ * Assembles one prose entry from a table keyed by field, then by language.
+ */
const LANGUAGE_CODES = ["en", "ru", "uk", "de", "fr"];
@@ -28,7 +30,9 @@ export function entry({
return result;
}
-/** Short-hand for a value that is only described in one sentence per language. */
+/**
+ * Short-hand for a value that is only described in one sentence per language.
+ */
export function code(body) {
return [{ body: ["```javascript", body, "```"].join("\n") }];
}
diff --git a/docs/content/authored/a1.mjs b/docs/content/authored/a1.mjs
index 35f13c34..5b100862 100644
--- a/docs/content/authored/a1.mjs
+++ b/docs/content/authored/a1.mjs
@@ -1,4 +1,6 @@
-/** Prose for the A1-notation and column-letter helpers. */
+/**
+ * Prose for the A1-notation and column-letter helpers.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/html.mjs b/docs/content/authored/html.mjs
index 63294c85..cf9894c0 100644
--- a/docs/content/authored/html.mjs
+++ b/docs/content/authored/html.mjs
@@ -1,4 +1,6 @@
-/** Prose for the HTML and XML helpers. */
+/**
+ * Prose for the HTML and XML helpers.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/last-functions.mjs b/docs/content/authored/last-functions.mjs
index 4d4246ca..c8a567b4 100644
--- a/docs/content/authored/last-functions.mjs
+++ b/docs/content/authored/last-functions.mjs
@@ -1,4 +1,6 @@
-/** Prose for the last of the Apps Script helpers. */
+/**
+ * Prose for the last of the Apps Script helpers.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/object.mjs b/docs/content/authored/object.mjs
index 4b359f6a..7bee0358 100644
--- a/docs/content/authored/object.mjs
+++ b/docs/content/authored/object.mjs
@@ -1,4 +1,6 @@
-/** Prose for the object helpers and the JSON pair. */
+/**
+ * Prose for the object helpers and the JSON pair.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/path-misc.mjs b/docs/content/authored/path-misc.mjs
index 83f2c31d..a8f11605 100644
--- a/docs/content/authored/path-misc.mjs
+++ b/docs/content/authored/path-misc.mjs
@@ -1,4 +1,6 @@
-/** Prose for the path helpers and the odds and ends. */
+/**
+ * Prose for the path helpers and the odds and ends.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/rest.mjs b/docs/content/authored/rest.mjs
index cca88228..f0a345da 100644
--- a/docs/content/authored/rest.mjs
+++ b/docs/content/authored/rest.mjs
@@ -1,10 +1,14 @@
-/** Prose for the remaining functions and classes. */
+/**
+ * Prose for the remaining functions and classes.
+ */
import { code, entry } from "./_entry.mjs";
const NONE = { en: "", ru: "", uk: "", de: "", fr: "" };
-/** A shorter form for entries that need one paragraph and no parameters table beyond the obvious. */
+/**
+ * A shorter form for entries that need one paragraph and no parameters table beyond the obvious.
+ */
function simple({
seeAlso,
examples,
diff --git a/docs/content/authored/sheet-conditional.mjs b/docs/content/authored/sheet-conditional.mjs
index fd13c318..ea2a0e18 100644
--- a/docs/content/authored/sheet-conditional.mjs
+++ b/docs/content/authored/sheet-conditional.mjs
@@ -1,4 +1,6 @@
-/** Prose for the conditional row and column operations, and the lookups. */
+/**
+ * Prose for the conditional row and column operations, and the lookups.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/sheet-guards.mjs b/docs/content/authored/sheet-guards.mjs
index 143841be..a89d58ec 100644
--- a/docs/content/authored/sheet-guards.mjs
+++ b/docs/content/authored/sheet-guards.mjs
@@ -1,4 +1,6 @@
-/** Prose for the two-argument grid-range guards, the admin family and the leftovers. */
+/**
+ * Prose for the two-argument grid-range guards, the admin family and the leftovers.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/sheet-read.mjs b/docs/content/authored/sheet-read.mjs
index 20bd21bf..64c73bbd 100644
--- a/docs/content/authored/sheet-read.mjs
+++ b/docs/content/authored/sheet-read.mjs
@@ -1,4 +1,6 @@
-/** Prose for reading a sheet, its schema and its formulas. */
+/**
+ * Prose for reading a sheet, its schema and its formulas.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/sheet-write.mjs b/docs/content/authored/sheet-write.mjs
index a290c725..ca8190af 100644
--- a/docs/content/authored/sheet-write.mjs
+++ b/docs/content/authored/sheet-write.mjs
@@ -1,4 +1,6 @@
-/** Prose for the row and column operations on a sheet. */
+/**
+ * Prose for the row and column operations on a sheet.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/string.mjs b/docs/content/authored/string.mjs
index 586e426b..65dc090e 100644
--- a/docs/content/authored/string.mjs
+++ b/docs/content/authored/string.mjs
@@ -1,4 +1,6 @@
-/** Prose for the string helpers. Example code is shared by every language. */
+/**
+ * Prose for the string helpers. Example code is shared by every language.
+ */
export const FUNCTIONS = {
toCamelCase: {
diff --git a/docs/content/authored/string2.mjs b/docs/content/authored/string2.mjs
index 5f7bd4ba..84be1f3b 100644
--- a/docs/content/authored/string2.mjs
+++ b/docs/content/authored/string2.mjs
@@ -1,4 +1,6 @@
-/** Prose for the remaining string helpers. */
+/**
+ * Prose for the remaining string helpers.
+ */
const CASE_OPTION = {
en: "`trim` trims the string and collapses runs of whitespace into single spaces.",
diff --git a/docs/content/authored/string3.mjs b/docs/content/authored/string3.mjs
index bca9a157..bba00fe2 100644
--- a/docs/content/authored/string3.mjs
+++ b/docs/content/authored/string3.mjs
@@ -1,8 +1,12 @@
-/** Prose for the remaining string helpers: escaping, templating and versions. */
+/**
+ * Prose for the remaining string helpers: escaping, templating and versions.
+ */
const L = ["en", "ru", "uk", "de", "fr"];
-/** Assembles one entry from a table keyed by field, then by language. */
+/**
+ * Assembles one entry from a table keyed by field, then by language.
+ */
export function entry({
examples,
seeAlso,
diff --git a/docs/content/authored/time-json.mjs b/docs/content/authored/time-json.mjs
index 37696560..e454db38 100644
--- a/docs/content/authored/time-json.mjs
+++ b/docs/content/authored/time-json.mjs
@@ -1,4 +1,6 @@
-/** Prose for the JSON pair, the time helpers and the path helpers. */
+/**
+ * Prose for the JSON pair, the time helpers and the path helpers.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/docs/content/authored/types.mjs b/docs/content/authored/types.mjs
index 2f7d5247..f99f85cb 100644
--- a/docs/content/authored/types.mjs
+++ b/docs/content/authored/types.mjs
@@ -1,4 +1,6 @@
-/** Prose for the types, interfaces and classes the package exports. */
+/**
+ * Prose for the types, interfaces and classes the package exports.
+ */
import { code, entry } from "./_entry.mjs";
diff --git a/package-lock.json b/package-lock.json
index 2e732bbd..ab3f4ce5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -22,6 +22,7 @@
"@eslint/js": "^9.39.2",
"@eslint/json": "^0.14.0",
"@eslint/markdown": "^7.5.1",
+ "@stylistic/eslint-plugin": "^6.0.1",
"@types/eslint-plugin-security": "^3.0.1",
"@types/google-apps-script": "^2.0.15",
"@types/node": "^25.0.9",
@@ -734,6 +735,66 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@stylistic/eslint-plugin": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-6.0.1.tgz",
+ "integrity": "sha512-7nyi2RmGIuzBYGq5C8cFaoQsh+COfo6oHMWCygzg2iaqJJ4RDThaKCMYRkkOUAQWv80R7sbBbpuKZfulH7bFcw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.10.1",
+ "@typescript-eslint/types": "^8.72.2",
+ "@typescript-eslint/visitor-keys": "^8.72.2",
+ "espree": "^11.2.0",
+ "picomatch": "^4.0.7"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "peerDependencies": {
+ "eslint": "^9.0.0 || ^10.0.0",
+ "oxlint": "^1.55.0"
+ },
+ "peerDependenciesMeta": {
+ "eslint": {
+ "optional": true
+ },
+ "oxlint": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@stylistic/eslint-plugin/node_modules/eslint-visitor-keys": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@stylistic/eslint-plugin/node_modules/espree": {
+ "version": "11.2.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz",
+ "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "acorn": "^8.16.0",
+ "acorn-jsx": "^5.3.2",
+ "eslint-visitor-keys": "^5.0.1"
+ },
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
"node_modules/@types/chai": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
diff --git a/package.json b/package.json
index 9496149e..99dab1f5 100644
--- a/package.json
+++ b/package.json
@@ -105,6 +105,7 @@
"@eslint/js": "^9.39.2",
"@eslint/json": "^0.14.0",
"@eslint/markdown": "^7.5.1",
+ "@stylistic/eslint-plugin": "^6.0.1",
"@types/eslint-plugin-security": "^3.0.1",
"@types/google-apps-script": "^2.0.15",
"@types/node": "^25.0.9",
diff --git a/scripts/docs/author-batch.mjs b/scripts/docs/author-batch.mjs
index 9342bbd2..66644b21 100644
--- a/scripts/docs/author-batch.mjs
+++ b/scripts/docs/author-batch.mjs
@@ -60,7 +60,10 @@ for (const file of readdirSync(AUTHORED).sort()) {
const dir = join(ROOT, "docs/content", language.code, "functions");
mkdirSync(dir, { recursive: true });
- writeFileSync(join(dir, `${name}.json`), `${JSON.stringify(content, null, 2)}\n`);
+
+ const json = JSON.stringify(content, null, 2);
+
+ writeFileSync(join(dir, `${name}.json`), `${json}\n`);
written += 1;
}
}
diff --git a/scripts/docs/author-exceptions.mjs b/scripts/docs/author-exceptions.mjs
index 354927a3..f196e752 100644
--- a/scripts/docs/author-exceptions.mjs
+++ b/scripts/docs/author-exceptions.mjs
@@ -260,7 +260,10 @@ for (const [name, data] of Object.entries(CLASSES)) {
const dir = join(ROOT, "docs/content", language.code, "functions");
mkdirSync(dir, { recursive: true });
- writeFileSync(join(dir, `${name}.json`), `${JSON.stringify(content, null, 2)}\n`);
+
+ const json = JSON.stringify(content, null, 2);
+
+ writeFileSync(join(dir, `${name}.json`), `${json}\n`);
written += 1;
}
}
diff --git a/scripts/docs/author-guards.mjs b/scripts/docs/author-guards.mjs
index 1e5d3c4e..5ae326f6 100644
--- a/scripts/docs/author-guards.mjs
+++ b/scripts/docs/author-guards.mjs
@@ -70,8 +70,8 @@ const TEMPLATES = {
requireNonSummary: (s) => `Returns the value after checking that it is not ${s.non}.`,
family:
"`isX` and `nonX` answer a question and never interrupt control flow; `requireX` and `requireNonX` hand the value back or throw. The scheme is explained in [](validation-conventions.md).",
- negation: (name) =>
- `\`${name}(value)\` is the same test as \`!${name.replace(/^non/, "is")}(value)\`, written so that a guard clause reads as a sentence rather than as a negation.`,
+ negation: (name, positive) =>
+ `\`${name}(value)\` is the same test as \`!${positive}(value)\`, written so that a guard clause reads as a sentence rather than as a negation.`,
valueParam: "The value to check.",
validateParam: "The value to validate.",
messageParam: () => "The message of the exception. A default is used when omitted.",
@@ -98,8 +98,8 @@ const TEMPLATES = {
requireNonSummary: (s) => `Возвращает значение, убедившись, что оно не является ${s.non}.`,
family:
"`isX` и `nonX` отвечают на вопрос и никогда не прерывают выполнение; `requireX` и `requireNonX` возвращают значение или выбрасывают исключение. Схема разобрана в [](validation-conventions.md).",
- negation: (name) =>
- `\`${name}(value)\` — та же проверка, что и \`!${name.replace(/^non/, "is")}(value)\`, записанная так, чтобы охранное условие читалось как утверждение, а не как отрицание.`,
+ negation: (name, positive) =>
+ `\`${name}(value)\` — та же проверка, что и \`!${positive}(value)\`, записанная так, чтобы охранное условие читалось как утверждение, а не как отрицание.`,
valueParam: "Проверяемое значение.",
validateParam: "Значение, которое нужно проверить.",
messageParam: () =>
@@ -128,8 +128,8 @@ const TEMPLATES = {
requireNonSummary: (s) => `Повертає значення, переконавшись, що воно не є ${s.non}.`,
family:
"`isX` та `nonX` відповідають на питання й ніколи не переривають виконання; `requireX` і `requireNonX` повертають значення або викидають виняток. Схему розібрано в [](validation-conventions.md).",
- negation: (name) =>
- `\`${name}(value)\` — та сама перевірка, що й \`!${name.replace(/^non/, "is")}(value)\`, записана так, щоб охоронна умова читалася як твердження, а не як заперечення.`,
+ negation: (name, positive) =>
+ `\`${name}(value)\` — та сама перевірка, що й \`!${positive}(value)\`, записана так, щоб охоронна умова читалася як твердження, а не як заперечення.`,
valueParam: "Значення, що перевіряється.",
validateParam: "Значення, яке потрібно перевірити.",
messageParam: () =>
@@ -158,8 +158,8 @@ const TEMPLATES = {
`Gibt den Wert zurück, nachdem geprüft wurde, dass er nicht ${s.non} ist.`,
family:
"`isX` und `nonX` beantworten eine Frage und unterbrechen den Ablauf nie; `requireX` und `requireNonX` geben den Wert zurück oder werfen. Das Schema erklärt [](validation-conventions.md).",
- negation: (name) =>
- `\`${name}(value)\` ist dieselbe Prüfung wie \`!${name.replace(/^non/, "is")}(value)\`, so geschrieben, dass eine Wächterklausel sich wie ein Satz liest und nicht wie eine Verneinung.`,
+ negation: (name, positive) =>
+ `\`${name}(value)\` ist dieselbe Prüfung wie \`!${positive}(value)\`, so geschrieben, dass eine Wächterklausel sich wie ein Satz liest und nicht wie eine Verneinung.`,
valueParam: "Der zu prüfende Wert.",
validateParam: "Der zu validierende Wert.",
messageParam: () =>
@@ -188,8 +188,8 @@ const TEMPLATES = {
requireNonSummary: (s) => `Renvoie la valeur après avoir vérifié qu'elle n'est pas ${s.non}.`,
family:
"`isX` et `nonX` répondent à une question sans jamais interrompre le flot ; `requireX` et `requireNonX` rendent la valeur ou lèvent. Le schéma est expliqué dans [](validation-conventions.md).",
- negation: (name) =>
- `\`${name}(value)\` est le même test que \`!${name.replace(/^non/, "is")}(value)\`, écrit pour qu'une clause de garde se lise comme une phrase plutôt que comme une négation.`,
+ negation: (name, positive) =>
+ `\`${name}(value)\` est le même test que \`!${positive}(value)\`, écrit pour qu'une clause de garde se lise comme une phrase plutôt que comme une négation.`,
valueParam: "La valeur à vérifier.",
validateParam: "La valeur à valider.",
messageParam: () => "Le message de l'exception. À défaut, un message par défaut est utilisé.",
@@ -301,7 +301,11 @@ for (const [module, subjects] of Object.entries(MODULES)) {
if (present.non) {
write(language.code, members.non, {
summary: t.nonSummary(s),
- description: [t.negation(members.non), s.note, t.family],
+ description: [
+ t.negation(members.non, members.non.replace(/^non/, "is")),
+ s.note,
+ t.family
+ ],
params: { value: t.valueParam },
returns: t.nonReturns(s),
throws: {},
@@ -396,7 +400,10 @@ function write(code, name, content) {
const dir = join(ROOT, "docs/content", code, "functions");
mkdirSync(dir, { recursive: true });
- writeFileSync(join(dir, `${name}.json`), `${JSON.stringify(content, null, 2)}\n`);
+
+ const json = JSON.stringify(content, null, 2);
+
+ writeFileSync(join(dir, `${name}.json`), `${json}\n`);
written.push(`${code}/${name}`);
}
diff --git a/scripts/docs/finalize-site.mjs b/scripts/docs/finalize-site.mjs
index 09991f3f..7b5af539 100644
--- a/scripts/docs/finalize-site.mjs
+++ b/scripts/docs/finalize-site.mjs
@@ -46,7 +46,9 @@ function pagesOf(dir, base = dir) {
const full = join(dir, entry);
if (statSync(full).isDirectory()) {
- if (SKIP.has(entry) || (dir === base && CODES.has(entry))) {
+ const isLanguageRoot = dir === base && CODES.has(entry);
+
+ if (SKIP.has(entry) || isLanguageRoot) {
continue;
}
@@ -90,13 +92,19 @@ function injections(language) {
* that runs none, both still see every translation.
*/
function languageRow(language, page, present) {
- const links = present.map((other) =>
- other === language
- ? `${other.name}`
- : `${other.name}`
- );
+ const links = present.map((other) => {
+ if (other === language) {
+ return `${other.name}`;
+ }
+
+ const href = urlOf(other, page);
+
+ return `${other.name}`;
+ });
+
+ const row = links.join(' · ');
- return ``;
+ return ``;
}
const pages = pagesOf(root);
@@ -121,10 +129,11 @@ for (const page of pages) {
}
const alternates = present
- .map(
- (language) =>
- ``
- )
+ .map((language) => {
+ const href = urlOf(language, page);
+
+ return ``;
+ })
.join("\n ");
const xDefault = ``;
@@ -143,13 +152,25 @@ for (const page of pages) {
const injected = injections(language);
if (injected.head && !html.includes("SoftwareSourceCode")) {
- html = `${html.slice(0, html.indexOf(""))}${injected.head}\n${html.slice(html.indexOf(""))}`;
+ const headEnd = html.indexOf("");
+
+ const beforeHead = html.slice(0, headEnd);
+
+ const fromHead = html.slice(headEnd);
+
+ html = `${beforeHead}${injected.head}\n${fromHead}`;
}
if (!html.includes('rel="alternate" hreflang=')) {
- const canonical = ``;
+ const href = urlOf(language, page);
+
+ const canonical = ``;
- html = `${html.slice(0, at)} ${canonical}\n ${alternates}\n ${xDefault}\n${html.slice(at)}`;
+ const beforeHead = html.slice(0, at);
+
+ const fromHead = html.slice(at);
+
+ html = `${beforeHead} ${canonical}\n ${alternates}\n ${xDefault}\n${fromHead}`;
linked += 1;
}
@@ -167,7 +188,13 @@ for (const page of pages) {
if (article) {
const at = html.indexOf(article[0]) + article[0].length;
- html = `${html.slice(0, at)}${languageRow(language, page, present)}${html.slice(at)}`;
+ const row = languageRow(language, page, present);
+
+ const before = html.slice(0, at);
+
+ const after = html.slice(at);
+
+ html = `${before}${row}${after}`;
}
}
@@ -182,7 +209,11 @@ for (const page of pages) {
const at = article === -1 ? html.lastIndexOf("