From 4a1e2a81e85be60d3bc14aa1ae8addbd5621ffa9 Mon Sep 17 00:00:00 2001 From: Nulo Date: Sat, 9 Sep 2023 10:31:05 -0300 Subject: [PATCH] prettier js ts --- Menú artístico.gen.js | 6 +++--- Mi webring.gen.js | 12 ++++++------ compilar.ts | 26 +++++++++++++------------- feeds.js | 2 +- timer.html.js | 3 +-- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Menú artístico.gen.js b/Menú artístico.gen.js index 42a254f..f1b77fd 100755 --- a/Menú artístico.gen.js +++ b/Menú artístico.gen.js @@ -47,7 +47,7 @@ export default () => { const tema = random(temas); const adjetivo = random(adjetivos)[tipo[1]]; return li(tipo[0], " ", adjetivo, " sobre ", tema); - }) + }), ), h2("Tipos de obra"), 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", }, - "Código" - ) + "Código", + ), ); }; diff --git a/Mi webring.gen.js b/Mi webring.gen.js index 5bf0efe..473988f 100644 --- a/Mi webring.gen.js +++ b/Mi webring.gen.js @@ -28,12 +28,12 @@ export default async () => { target: "_blank", rel: "noopener", }, - item.title + item.title, ), // TODO: format date " 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( (n) => n === "rss" || n === "feed" || n === "rdf:RDF", dom.childNodes, - false + false, )[0]; const linksDom = getElementsByTagName( (t) => ["link", "atom:link"].includes(t), feedDom.childNodes, - false + false, ); const linkDom = linksDom.find( (d) => d.attribs.rel === "alternate" || // 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". - !("rel" in d.attribs) + !("rel" in d.attribs), ); const feedUrll = new URL(feedUrl); diff --git a/compilar.ts b/compilar.ts index ff0ed3e..dc6f351 100644 --- a/compilar.ts +++ b/compilar.ts @@ -79,7 +79,7 @@ await compilePageList(config, pageList); async function compileFile( config: Config, - sourceFileName: string + sourceFileName: string, ): Promise<{ contentHtml: string; image?: Image }> { if (extname(sourceFileName) === ".md") { 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" }, ...(isIndex ? [] : generateHeader(name, sourceFileName, fileConnections.length > 0, image)), main({ itemprop: "articleBody", "data-pagefind-body": "" }, raw(contentHtml)), - ...generateConnectionsSection(fileConnections) - ) + ...generateConnectionsSection(fileConnections), + ), ); const outputPath = join(config.buildPath, name + ".html"); @@ -125,7 +125,7 @@ type Image = { async function compileMarkdownHtml( config: Config, - sourceFileName: string + sourceFileName: string, ): Promise<{ html: string; image?: Image }> { let markdown = await readFile(join(config.sourcePath, sourceFileName), "utf-8"); @@ -230,11 +230,11 @@ function parseName(name: string): TitleMetadata { function dateishToElement( dateish: Dateish, - { itemprop, upper }: { itemprop?: string; upper?: boolean } = {} + { itemprop, upper }: { itemprop?: string; upper?: boolean } = {}, ): VirtualElement { return time( { datetime: dateishToString(dateish), ...(itemprop ? { itemprop } : {}) }, - formatDate(dateish, upper) + formatDate(dateish, upper), ); } @@ -261,7 +261,7 @@ function generateHeader( name: string, sourceCodePath: string, linkConexiones = false, - image?: Image + image?: Image, ): Renderable[] { const parsedTitle = parseName(name); return [ @@ -285,16 +285,16 @@ function generateHeader( dateishToElement(parsedTitle.date, { itemprop: "datePublished", upper: true, - }) + }), ), ]), a( { 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( { id: "conexiones" }, 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 .map(({ src: name }) => basename(name, extname(name))) .sort((a, b) => a.localeCompare(b, "es", { sensitivity: "base" })) - .map((name) => li(internalLink(name))) - ) + .map((name) => li(internalLink(name))), + ), ); await writeFile(outputPath, html); } diff --git a/feeds.js b/feeds.js index cc2a79a..a075362 100644 --- a/feeds.js +++ b/feeds.js @@ -17,7 +17,7 @@ if (process.argv[2] === "refresh") { const res = await fetch(url); const txt = await res.text(); await writeFile(join("cached-feeds/", `${name}.xml`), txt); - }) + }), ); } diff --git a/timer.html.js b/timer.html.js index 0c48f19..a0d2a9a 100644 --- a/timer.html.js +++ b/timer.html.js @@ -13,8 +13,7 @@ buttonEl.addEventListener("click", (event) => { } else { interval = setInterval(() => { 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)}`; }, 1000); buttonEl.textContent = "Parar";