aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src
diff options
context:
space:
mode:
Diffstat (limited to 'nuldoc-src')
-rw-r--r--nuldoc-src/command.ts5
-rw-r--r--nuldoc-src/docbook/to_html.ts7
-rw-r--r--nuldoc-src/html.ts10
3 files changed, 14 insertions, 8 deletions
diff --git a/nuldoc-src/command.ts b/nuldoc-src/command.ts
index 47b8ee0..dd15a77 100644
--- a/nuldoc-src/command.ts
+++ b/nuldoc-src/command.ts
@@ -146,7 +146,10 @@ async function copyStaticFiles(config: Config) {
const globPattern = joinGlobs([Deno.cwd(), config.locations.staticDir, "*"]);
for await (const entry of expandGlob(globPattern)) {
const src = entry.path;
- const dst = src.replace(config.locations.staticDir, config.locations.destDir);
+ const dst = src.replace(
+ config.locations.staticDir,
+ config.locations.destDir,
+ );
await Deno.copyFile(src, dst);
}
}
diff --git a/nuldoc-src/docbook/to_html.ts b/nuldoc-src/docbook/to_html.ts
index 6788158..64d3492 100644
--- a/nuldoc-src/docbook/to_html.ts
+++ b/nuldoc-src/docbook/to_html.ts
@@ -192,6 +192,8 @@ function transformProgramListingElement(doc: Document) {
}
n.name = "pre";
+ const preClass = n.attributes.get("class");
+ n.attributes.set("class", preClass ? preClass + " highlight" : "highlight");
const codeElement: Element = {
kind: "element",
name: "code",
@@ -209,12 +211,13 @@ function transformLiteralLayoutElement(doc: Document) {
}
n.name = "pre";
- const children = n.children;
+ const preClass = n.attributes.get("class");
+ n.attributes.set("class", preClass ? preClass + " highlight" : "highlight");
const codeElement: Element = {
kind: "element",
name: "code",
attributes: new Map(),
- children: children,
+ children: n.children,
};
n.children = [codeElement];
});
diff --git a/nuldoc-src/html.ts b/nuldoc-src/html.ts
index d127d29..2832490 100644
--- a/nuldoc-src/html.ts
+++ b/nuldoc-src/html.ts
@@ -132,11 +132,11 @@ function textNodeToHtmlText(t: Text, ctx: Context): string {
}
function encodeSpecialCharacters(s: string): string {
- return s.replaceAll(/&(?!\w+;)/g, '&')
- .replaceAll(/</g, '&lt;')
- .replaceAll(/>/g, '&gt;')
- .replaceAll(/'/g, '&apos;')
- .replaceAll(/"/g, '&quot;');
+ return s.replaceAll(/&(?!\w+;)/g, "&amp;")
+ .replaceAll(/</g, "&lt;")
+ .replaceAll(/>/g, "&gt;")
+ .replaceAll(/'/g, "&apos;")
+ .replaceAll(/"/g, "&quot;");
}
function elementNodeToHtmlText(e: Element, ctx: Context): string {