This commit is contained in:
parent
9b4ffccef1
commit
c44ecd7ba4
1 changed files with 11 additions and 3 deletions
14
compilar.ts
14
compilar.ts
|
@ -217,7 +217,7 @@ function generateConnectionsSection(
|
|||
h2(`⥆ Conexiones (${fileConnections.length})`),
|
||||
ul(
|
||||
...fileConnections.map(({ linker }) =>
|
||||
li(a({ href: `${linker}.html` }, linker))
|
||||
li(a({ href: internalLink(linker) }, linker))
|
||||
)
|
||||
)
|
||||
),
|
||||
|
@ -234,7 +234,7 @@ async function compilePageList(config: Config, pageList: string[]) {
|
|||
ul(
|
||||
...pageList
|
||||
.sort((a, b) => a.localeCompare(b, "es", { sensitivity: "base" }))
|
||||
.map((name) => li(a({ href: encodeURI(`${name}.html`) }, name)))
|
||||
.map((name) => li(a({ href: internalLink(name) }, name)))
|
||||
)
|
||||
);
|
||||
await writeFile(outputPath, html);
|
||||
|
@ -277,7 +277,7 @@ function renderMarkdown(markdown: string) {
|
|||
async function hackilyTransformHtml(html: string): Promise<string> {
|
||||
html = html
|
||||
.replaceAll("<a h", '<a rel="noopener noreferrer" h')
|
||||
.replaceAll(wikilinkExp, `<a href="$1.html">$1</a>`);
|
||||
.replaceAll(wikilinkExp, (_, l) => render(a({ href: internalLink(l) }, l)));
|
||||
for (const [match, archivo] of html.matchAll(
|
||||
/<nulo-sitio-reemplazar-con archivo="(.+?)" \/>/g
|
||||
)) {
|
||||
|
@ -285,3 +285,11 @@ async function hackilyTransformHtml(html: string): Promise<string> {
|
|||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
// ==============================================
|
||||
// Linking
|
||||
// ==============================================
|
||||
|
||||
function internalLink(path: string) {
|
||||
return encodeURI(`./${path}.html`);
|
||||
}
|
||||
|
|
Reference in a new issue