move styleTag and inlineCSS to html.js

This commit is contained in:
Talon Poole 2021-02-24 19:37:45 +00:00
parent f602022f84
commit cae50a7a93
2 changed files with 6 additions and 4 deletions

3
cli.js
View file

@ -109,9 +109,6 @@ if (!argv.html && !argv.body) {
cli.exit(1);
}
argv.inlineCSS = CSS.inline(argv);
argv.styleTag = CSS.style(argv);
if (!argv.files) {
let gemtext;
try {

View file

@ -94,12 +94,15 @@ export function body(tokens, options) {
}
export function toHTML(gemtext, options) {
options.inlineCSS = options.inlineCSS || CSS.inline(options);
options.styleTag = options.styleTag || CSS.style(options);
const tokens = tokenize(gemtext);
if (options.body) return body(tokens, options);
return `<!DOCTYPE html>
<html lang="${options.language}" dir="${
<html lang="${options.html}" dir="${
options.dir
}" style='${options.inlineCSS("html")}'>
<head>${head(
@ -152,6 +155,8 @@ function description(tokens, options) {
export const GMI_EXT = /\.gmi$/;
export function streamHTML(options) {
options.inlineCSS = options.inlineCSS || CSS.inline(options);
options.styleTag = options.styleTag || CSS.style(options);
return map((file, cb) => {
if (!GMI_EXT.test(file.path)) return cb(null);
file.contents = Buffer.from(