Compare commits

...

3 commits

Author SHA1 Message Date
d5157f98fa borrar links muertos
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-04-16 16:17:11 -03:00
3cb1d8b5b0 index 2023-04-16 16:16:27 -03:00
3823c2546f detectar links internos muertos 2023-04-16 16:16:17 -03:00
5 changed files with 42 additions and 24 deletions

View file

@ -1,6 +1,6 @@
Da direcciones a lugares a partir de los datos de [[OpenStreetMap]]. Disponible como [servicio comercial](https://graphhopper.com) y como [self-hosted](https://github.com/graphhopper/graphhopper).
Da direcciones a lugares a partir de los datos de OpenStreetMap. Disponible como [servicio comercial](https://graphhopper.com) y como [self-hosted](https://github.com/graphhopper/graphhopper).
Tip: usar la [interfaz web](https://openstreetmap.org) de [[OpenStreetMap]] o [GraphHopper Maps](https://graphhopper.com/maps/) para hacer pedidos a la API fácil.
Tip: usar la [interfaz web](https://openstreetmap.org) de OpenStreetMap o [GraphHopper Maps](https://graphhopper.com/maps/) para hacer pedidos a la API fácil.
## API

View file

@ -1,3 +1 @@
- [Opus Recommended Settings](https://wiki.xiph.org/index.php?title=Opus_Recommended_Settings)
[[Encoding de multimedia]]

View file

@ -1,4 +1,11 @@
import { copyFile, mkdir, opendir, readFile, writeFile } from "fs/promises";
import {
copyFile,
mkdir,
opendir,
readFile,
readdir,
writeFile,
} from "fs/promises";
import { basename, extname, join } from "path";
import { execFile as execFileCallback } from "child_process";
import { promisify } from "util";
@ -54,19 +61,13 @@ const connections = await scanForConnections(config.sourcePath);
await mkdir(config.buildPath, { recursive: true });
const dir = await opendir(config.sourcePath);
let pageList: string[] = [];
let promises: Promise<void>[] = [];
for await (const entry of dir) {
const dir = await readdir(config.sourcePath, { withFileTypes: true });
let pageList: { src: string }[] = [];
for (const entry of dir) {
if (!entry.isFile()) continue;
promises.push(compileFile(entry.name));
}
await Promise.all(promises);
await compilePageList(config, pageList);
async function compileFile(name: string) {
const { name } = entry;
const extension = extname(name);
if (
[
".ts",
@ -82,11 +83,14 @@ async function compileFile(name: string) {
) {
await copyFile(join(config.sourcePath, name), join(config.buildPath, name));
}
if ([".md"].includes(extension) || name.endsWith(".gen.js")) {
pageList.push(basename(name, extension));
await compilePage(config, name);
pageList.push({ src: name });
}
}
await Promise.all(pageList.map(({ src }) => compilePage(config, src)));
await compilePageList(config, pageList);
async function compilePage(config: Config, sourceFileName: string) {
const name = basename(sourceFileName, extname(sourceFileName));
@ -162,6 +166,7 @@ async function compileMarkdownHtml(
const parsed = reader.parse(markdown);
const markdownHtml = writer.render(parsed);
checkLinks(sourceFileName, markdownHtml);
const contentHtml = await hackilyTransformHtml(markdownHtml);
return { html: contentHtml, image };
}
@ -354,7 +359,7 @@ function generateConnectionsSection(
: [];
}
async function compilePageList(config: Config, pageList: string[]) {
async function compilePageList(config: Config, pageList: { src: string }[]) {
const name = "Lista de páginas";
const outputPath = join(config.buildPath, name + ".html");
const html = render(
@ -362,6 +367,7 @@ async function compilePageList(config: Config, pageList: string[]) {
...generateHeader(name, "compilar.ts"),
ul(
...pageList
.map(({ src: name }) => basename(name, extname(name)))
.sort((a, b) => a.localeCompare(b, "es", { sensitivity: "base" }))
.map((name) => li(internalLink(name)))
)
@ -411,6 +417,17 @@ async function hackilyTransformHtml(html: string): Promise<string> {
return html;
}
function checkLinks(srcName: string, html: string) {
const matches = html.matchAll(wikilinkExp);
const list = pageList.map(({ src }) => basename(src, extname(src)));
if (!matches) return;
for (const match of matches) {
if (!list.some((n) => n === match[1])) {
console.warn(`${srcName} linkea a ${match[1]}, pero no existe`);
}
}
}
// ==============================================
// Linking
// ==============================================

View file

@ -7,11 +7,13 @@
- Perdete en la [[Lista de páginas]]
Algunas cosas que escribí:
- [[2023-02-05 Vergüenza algorítmica]]
- [[2022-10-15 Analisis de la extracción de datos del teléfono de Fernando André Sabag Montiel]]
- [[Arreglando bugs ajenos]]
Algunas cosas que hice:
- [Este sitio](https://gitea.nulo.in/Nulo/sitio)
- Juguetes:
- [Cuarentena](https://cuarentena.nulo.in)
@ -22,9 +24,10 @@ Algunas cosas que hice:
- Y otros [[Proyectos]].
Algunas cosas de las que soy parte:
- [Sutty](https://sutty.coop.ar/)
## Mis amigxs ([[Mi webring]])
## Mis amigxs ([[Mi webring.gen]])
<nulo-sitio-reemplazar-con archivo="Mi webring.gen.js" />

View file

@ -1,3 +1,3 @@
Implementación de la CLI de Git usando libgit2. [GitHub](https://github.com/sba1/simplegit)
[[Git]] y [[libgit2]]
[[Git]] y libgit2