From b1d2f7140be9bcc5889391dec0af4215a5aab8b3 Mon Sep 17 00:00:00 2001 From: Talon Poole Date: Mon, 15 Feb 2021 21:40:59 +0000 Subject: [PATCH] body core styles --- cli.js | 1 - gmi-web.1.scd | 3 ++- html.js | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cli.js b/cli.js index f848ec4..43b955f 100755 --- a/cli.js +++ b/cli.js @@ -70,7 +70,6 @@ const cli = yargs(process.argv.slice(2)) const CSS_VARS = CSS.rootVariables(CSS.FULL); Object.keys(CSS_VARS).map((key) => { cli.option(key, { default: CSS_VARS[key] }); - cli.conflicts(key, "body"); return key; }); diff --git a/gmi-web.1.scd b/gmi-web.1.scd index b6beacb..084aad5 100644 --- a/gmi-web.1.scd +++ b/gmi-web.1.scd @@ -18,7 +18,8 @@ mobile-friendly fashion! # OPTIONS *--body* - Generate only the HTML for the lines of the Gemini document. + Generate only the HTML for the lines of the Gemini document. Use *--css* none + to turn off the core inline styles. *--html* _LANG_ Generate a full HTML5 document with the provided _LANG_. *--dir* can be used diff --git a/html.js b/html.js index 3603b4b..371f1ad 100644 --- a/html.js +++ b/html.js @@ -57,24 +57,27 @@ export function head(options) { function line( { text, href, title, pre, alt, h1, h2, h3, li, quote }, - { image, audio, video, css } = {} + { image, audio, video, css, body } = {} ) { if (text) return `

${escape(text)}

`; - const matchesExt = (url, exts) => - exts.some((ext) => new RegExp(`\.${ext}$`).test(url)); if (href) { const titleProp = title ? ` title="${title}"` : ""; + const FIX_NORMAL_FLOW = body && css ? ` style="display: block; max-width: 100%;"` : "" + const matchesExt = (url, exts) => + exts.some((ext) => new RegExp(`\.${ext}$`).test(url)); + if (image && matchesExt(href, image)) { - return ``; + return ``; } if (audio && matchesExt(href, audio)) { - return ``; + return ``; + } + if (video && matchesExt(href, video)) { + return ``; } - if (video && matchesExt(href, video)) - return ``; - return `${title ? escape(title) : href}`; + return `${title ? escape(title) : href}`; } if (h1) return `

${escape(h1)}

`;