From 1bfb3e37159155ddfe31082ad7bef281f4a892ae Mon Sep 17 00:00:00 2001 From: Talon Poole Date: Wed, 24 Feb 2021 21:05:27 +0000 Subject: [PATCH] format --- html.js | 12 ++++++++---- html.spec.js | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/html.js b/html.js index 1ce9945..03f6e8e 100644 --- a/html.js +++ b/html.js @@ -5,7 +5,11 @@ import * as CSS from "./css.js"; export const GMI_REGEX = /^((=>\s?(?[^\s]+)\s?(?.+)?)|(?<pre>```\s?(?<alt>.+)?)|(###\s?(?<h3>.+))|(##\s?(?<h2>.+))|(#\s?(?<h1>.+))|(\*\s?(?<li>.+))|(>\s?(?<quote>.+))|(?<text>(.+)?))$/; export const tokenize = (gemtext) => - JSON.parse(JSON.stringify(gemtext.split("\n").map((line) => GMI_REGEX.exec(line).groups))); + JSON.parse( + JSON.stringify( + gemtext.split("\n").map((line) => GMI_REGEX.exec(line).groups) + ) + ); export function block( { text, href, title, pre, alt, h1, h2, h3, li, quote }, @@ -42,15 +46,15 @@ export function block( exts.some((ext) => new RegExp(`\.${ext}$`).test(url)); if (options.image && matchesExt(href, options.image)) { type = "img"; - props += ` src="${href}"` + props += ` src="${href}"`; props += title ? ` title="${title}"` : ""; } else if (options.audio && matchesExt(href, options.audio)) { type = "audio"; - props += ` controls src="${href}"` + props += ` controls src="${href}"`; props += title ? ` title="${title}"` : ""; } else if (options.video && matchesExt(href, options.video)) { type = "video"; - props += ` controls src="${href}"` + props += ` controls src="${href}"`; props += title ? ` title="${title}"` : ""; } else { type = "a"; diff --git a/html.spec.js b/html.spec.js index 3312d95..a896372 100644 --- a/html.spec.js +++ b/html.spec.js @@ -75,7 +75,7 @@ test("--body", () => { `); }); -test("--html en", () => { +test("--html en --author anon --description", () => { expect( toHTML(gemtext, { html: "en",