Compare commits
No commits in common. "4a1e2a81e85be60d3bc14aa1ae8addbd5621ffa9" and "1b9a4984a52d1399129dedac76cf8b682e881421" have entirely different histories.
4a1e2a81e8
...
1b9a4984a5
6 changed files with 25 additions and 25 deletions
|
@ -47,7 +47,7 @@ export default () => {
|
||||||
const tema = random(temas);
|
const tema = random(temas);
|
||||||
const adjetivo = random(adjetivos)[tipo[1]];
|
const adjetivo = random(adjetivos)[tipo[1]];
|
||||||
return li(tipo[0], " ", adjetivo, " sobre ", tema);
|
return li(tipo[0], " ", adjetivo, " sobre ", tema);
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
h2("Tipos de obra"),
|
h2("Tipos de obra"),
|
||||||
ol(...tipos.map((t) => li(t[0]))),
|
ol(...tipos.map((t) => li(t[0]))),
|
||||||
|
@ -59,7 +59,7 @@ export default () => {
|
||||||
{
|
{
|
||||||
href: "https://gitea.nulo.in/Nulo/sitio/src/branch/ANTIFASCISTA/Men%C3%BA%20art%C3%ADstico.gen.js",
|
href: "https://gitea.nulo.in/Nulo/sitio/src/branch/ANTIFASCISTA/Men%C3%BA%20art%C3%ADstico.gen.js",
|
||||||
},
|
},
|
||||||
"Código",
|
"Código"
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,12 +28,12 @@ export default async () => {
|
||||||
target: "_blank",
|
target: "_blank",
|
||||||
rel: "noopener",
|
rel: "noopener",
|
||||||
},
|
},
|
||||||
item.title,
|
item.title
|
||||||
),
|
),
|
||||||
// TODO: format date
|
// TODO: format date
|
||||||
" via ",
|
" via ",
|
||||||
a({ href: relativeLink(link), rel: "noopener" }, title),
|
a({ href: relativeLink(link), rel: "noopener" }, title)
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,19 +53,19 @@ function parseFeed(feedUrl, rawFeed) {
|
||||||
const feedDom = getElementsByTagName(
|
const feedDom = getElementsByTagName(
|
||||||
(n) => n === "rss" || n === "feed" || n === "rdf:RDF",
|
(n) => n === "rss" || n === "feed" || n === "rdf:RDF",
|
||||||
dom.childNodes,
|
dom.childNodes,
|
||||||
false,
|
false
|
||||||
)[0];
|
)[0];
|
||||||
const linksDom = getElementsByTagName(
|
const linksDom = getElementsByTagName(
|
||||||
(t) => ["link", "atom:link"].includes(t),
|
(t) => ["link", "atom:link"].includes(t),
|
||||||
feedDom.childNodes,
|
feedDom.childNodes,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
const linkDom = linksDom.find(
|
const linkDom = linksDom.find(
|
||||||
(d) =>
|
(d) =>
|
||||||
d.attribs.rel === "alternate" ||
|
d.attribs.rel === "alternate" ||
|
||||||
// https://datatracker.ietf.org/doc/html/rfc4287#section-4.2.7.2
|
// https://datatracker.ietf.org/doc/html/rfc4287#section-4.2.7.2
|
||||||
// >If the "rel" attribute is not present, the link element MUST be interpreted as if the link relation type is "alternate".
|
// >If the "rel" attribute is not present, the link element MUST be interpreted as if the link relation type is "alternate".
|
||||||
!("rel" in d.attribs),
|
!("rel" in d.attribs)
|
||||||
);
|
);
|
||||||
|
|
||||||
const feedUrll = new URL(feedUrl);
|
const feedUrll = new URL(feedUrl);
|
||||||
|
|
26
compilar.ts
26
compilar.ts
|
@ -79,7 +79,7 @@ await compilePageList(config, pageList);
|
||||||
|
|
||||||
async function compileFile(
|
async function compileFile(
|
||||||
config: Config,
|
config: Config,
|
||||||
sourceFileName: string,
|
sourceFileName: string
|
||||||
): Promise<{ contentHtml: string; image?: Image }> {
|
): Promise<{ contentHtml: string; image?: Image }> {
|
||||||
if (extname(sourceFileName) === ".md") {
|
if (extname(sourceFileName) === ".md") {
|
||||||
const { html: contentHtml, image } = await compileMarkdownHtml(config, sourceFileName);
|
const { html: contentHtml, image } = await compileMarkdownHtml(config, sourceFileName);
|
||||||
|
@ -106,8 +106,8 @@ async function compilePage(config: Config, sourceFileName: string) {
|
||||||
{ itemscope: "", itemtype: "https://schema.org/Article" },
|
{ itemscope: "", itemtype: "https://schema.org/Article" },
|
||||||
...(isIndex ? [] : generateHeader(name, sourceFileName, fileConnections.length > 0, image)),
|
...(isIndex ? [] : generateHeader(name, sourceFileName, fileConnections.length > 0, image)),
|
||||||
main({ itemprop: "articleBody", "data-pagefind-body": "" }, raw(contentHtml)),
|
main({ itemprop: "articleBody", "data-pagefind-body": "" }, raw(contentHtml)),
|
||||||
...generateConnectionsSection(fileConnections),
|
...generateConnectionsSection(fileConnections)
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const outputPath = join(config.buildPath, name + ".html");
|
const outputPath = join(config.buildPath, name + ".html");
|
||||||
|
@ -125,7 +125,7 @@ type Image = {
|
||||||
|
|
||||||
async function compileMarkdownHtml(
|
async function compileMarkdownHtml(
|
||||||
config: Config,
|
config: Config,
|
||||||
sourceFileName: string,
|
sourceFileName: string
|
||||||
): Promise<{ html: string; image?: Image }> {
|
): Promise<{ html: string; image?: Image }> {
|
||||||
let markdown = await readFile(join(config.sourcePath, sourceFileName), "utf-8");
|
let markdown = await readFile(join(config.sourcePath, sourceFileName), "utf-8");
|
||||||
|
|
||||||
|
@ -230,11 +230,11 @@ function parseName(name: string): TitleMetadata {
|
||||||
|
|
||||||
function dateishToElement(
|
function dateishToElement(
|
||||||
dateish: Dateish,
|
dateish: Dateish,
|
||||||
{ itemprop, upper }: { itemprop?: string; upper?: boolean } = {},
|
{ itemprop, upper }: { itemprop?: string; upper?: boolean } = {}
|
||||||
): VirtualElement {
|
): VirtualElement {
|
||||||
return time(
|
return time(
|
||||||
{ datetime: dateishToString(dateish), ...(itemprop ? { itemprop } : {}) },
|
{ datetime: dateishToString(dateish), ...(itemprop ? { itemprop } : {}) },
|
||||||
formatDate(dateish, upper),
|
formatDate(dateish, upper)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ function generateHeader(
|
||||||
name: string,
|
name: string,
|
||||||
sourceCodePath: string,
|
sourceCodePath: string,
|
||||||
linkConexiones = false,
|
linkConexiones = false,
|
||||||
image?: Image,
|
image?: Image
|
||||||
): Renderable[] {
|
): Renderable[] {
|
||||||
const parsedTitle = parseName(name);
|
const parsedTitle = parseName(name);
|
||||||
return [
|
return [
|
||||||
|
@ -285,16 +285,16 @@ function generateHeader(
|
||||||
dateishToElement(parsedTitle.date, {
|
dateishToElement(parsedTitle.date, {
|
||||||
itemprop: "datePublished",
|
itemprop: "datePublished",
|
||||||
upper: true,
|
upper: true,
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
a(
|
a(
|
||||||
{
|
{
|
||||||
href: `https://gitea.nulo.in/Nulo/sitio/commits/branch/ANTIFASCISTA/${sourceCodePath}`,
|
href: `https://gitea.nulo.in/Nulo/sitio/commits/branch/ANTIFASCISTA/${sourceCodePath}`,
|
||||||
},
|
},
|
||||||
"Historial",
|
"Historial"
|
||||||
),
|
),
|
||||||
...(linkConexiones ? [" / ", a({ href: "#conexiones" }, "Conexiones")] : []),
|
...(linkConexiones ? [" / ", a({ href: "#conexiones" }, "Conexiones")] : [])
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ function generateConnectionsSection(fileConnections: Connection[]): Renderable[]
|
||||||
section(
|
section(
|
||||||
{ id: "conexiones" },
|
{ id: "conexiones" },
|
||||||
h2(`⥆ Conexiones (${fileConnections.length})`),
|
h2(`⥆ Conexiones (${fileConnections.length})`),
|
||||||
ul(...fileConnections.map(({ linker }) => li(internalLink(linker)))),
|
ul(...fileConnections.map(({ linker }) => li(internalLink(linker))))
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
|
@ -321,8 +321,8 @@ async function compilePageList(config: Config, pageList: { src: string }[]) {
|
||||||
...pageList
|
...pageList
|
||||||
.map(({ src: name }) => basename(name, extname(name)))
|
.map(({ src: name }) => basename(name, extname(name)))
|
||||||
.sort((a, b) => a.localeCompare(b, "es", { sensitivity: "base" }))
|
.sort((a, b) => a.localeCompare(b, "es", { sensitivity: "base" }))
|
||||||
.map((name) => li(internalLink(name))),
|
.map((name) => li(internalLink(name)))
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
await writeFile(outputPath, html);
|
await writeFile(outputPath, html);
|
||||||
}
|
}
|
||||||
|
|
2
feeds.js
2
feeds.js
|
@ -17,7 +17,7 @@ if (process.argv[2] === "refresh") {
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const txt = await res.text();
|
const txt = await res.text();
|
||||||
await writeFile(join("cached-feeds/", `${name}.xml`), txt);
|
await writeFile(join("cached-feeds/", `${name}.xml`), txt);
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild compilar.ts *.js --target=node18 --outdir=build-js --sourcemap && node --enable-source-maps --trace-uncaught build-js/compilar.js && pagefind --source build",
|
"build": "esbuild compilar.ts *.js --target=node18 --outdir=build-js --sourcemap && node --enable-source-maps --trace-uncaught build-js/compilar.js && pagefind --source build",
|
||||||
"build-bun": "bun build compilar.ts --target bun > build-js/bun.js && bun build-js/bun.js && pagefind --source build",
|
|
||||||
"check": "tsc",
|
"check": "tsc",
|
||||||
"refresh-feeds": "node feeds.js refresh"
|
"refresh-feeds": "node feeds.js refresh"
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,8 @@ buttonEl.addEventListener("click", (event) => {
|
||||||
} else {
|
} else {
|
||||||
interval = setInterval(() => {
|
interval = setInterval(() => {
|
||||||
guitaEl.dataset.guita =
|
guitaEl.dataset.guita =
|
||||||
parseFloat(guitaEl.dataset.guita) + (porHoraEl.value / 60 / 60) * personasEl.value;
|
parseFloat(guitaEl.dataset.guita) +
|
||||||
|
(porHoraEl.value / 60 / 60) * personasEl.value;
|
||||||
guitaEl.textContent = `$ ${parseFloat(guitaEl.dataset.guita).toFixed(2)}`;
|
guitaEl.textContent = `$ ${parseFloat(guitaEl.dataset.guita).toFixed(2)}`;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
buttonEl.textContent = "Parar";
|
buttonEl.textContent = "Parar";
|
||||||
|
|
Reference in a new issue