add --dir and update man page
This commit is contained in:
parent
b113fda0ec
commit
74e84b1ab4
9
cli.js
9
cli.js
|
@ -30,6 +30,12 @@ const cli = yargs(process.argv.slice(2))
|
|||
type: "string",
|
||||
requiresArg: true,
|
||||
},
|
||||
dir: {
|
||||
type: "string",
|
||||
choices: ["rtl", "ltr"],
|
||||
default: "ltr",
|
||||
requiresArg: true,
|
||||
},
|
||||
author: {
|
||||
type: "string",
|
||||
requiresArg: true,
|
||||
|
@ -40,6 +46,7 @@ const cli = yargs(process.argv.slice(2))
|
|||
css: {
|
||||
choices: ["gmi.css", "base", "none"],
|
||||
default: "gmi.css",
|
||||
requiresArg: true,
|
||||
},
|
||||
charset: {
|
||||
type: "string",
|
||||
|
@ -97,7 +104,7 @@ const argv = cli
|
|||
.conflicts("description", "body")
|
||||
.conflicts("html", "body")
|
||||
.group(["html", "body"], "Core:")
|
||||
.group(["author", "description", "css"], "HTML:")
|
||||
.group(["author", "description", "css", "dir"], "HTML:")
|
||||
.group(["image", "audio", "video"], "Inline Media:")
|
||||
.group(GMI_CSS_VARS, "gmi.css:")
|
||||
.alias("html", "language")
|
||||
|
|
77
gmi-web.1
77
gmi-web.1
|
@ -5,7 +5,7 @@
|
|||
.nh
|
||||
.ad l
|
||||
.\" Begin generated content:
|
||||
.TH "gmi-web" "1" "2021-02-12" "1.0.0-rc.2"
|
||||
.TH "gmi-web" "1" "2021-02-15" "1.0.0-rc.2"
|
||||
.P
|
||||
.SH NAME
|
||||
.P
|
||||
|
@ -13,41 +13,39 @@ gmi-web - a bridge between Gemini and HTML
|
|||
.P
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
\fBgmi-web\fR [--html|--body] <\fIOPTIONS\fR> < [\fIFILE\fR]
|
||||
\fBgmi-web\fR [--html \fILANG\fR|--body] <\fIOPTIONS\fR> < [\fIFILE\fR]
|
||||
.P
|
||||
\fBgmi-web\fR [--html|--body] <\fIOPTIONS\fR> [\fIFILES\fR]
|
||||
\fBgmi-web\fR [--html \fILANG\fR|--body] <\fIOPTIONS\fR> [\fIFILES\fR]
|
||||
.P
|
||||
.SH DESCRIPTION
|
||||
.P
|
||||
Convert Gemtext to semantic HTML styled in a readable, predictable
|
||||
and mobile-friendly fashion!
|
||||
Convert Gemtext to semantic HTML styled in a readable, predictable and
|
||||
mobile-friendly fashion!
|
||||
.P
|
||||
.SH OPTIONS
|
||||
.P
|
||||
\fB--html\fR \fILANG\fR
|
||||
.RS 4
|
||||
Generate a full HTML5 document with the provided \fILANG\fR.
|
||||
.P
|
||||
\fBgmi-web\fR --html en < doc.gmi
|
||||
.P
|
||||
.RE
|
||||
\fB--descriptions\fR
|
||||
.RS 4
|
||||
If this flag is set the first non-empty text line of each Gemini file will
|
||||
be used for the description <meta> tag. This will be truncated to 200
|
||||
characters using an ellipsis.
|
||||
.P
|
||||
.RE
|
||||
\fB--author\fR
|
||||
.RS 4
|
||||
If provided this will be used for the author <meta> tag on every file.
|
||||
.P
|
||||
.RE
|
||||
\fB--body\fR
|
||||
.RS 4
|
||||
Generate only the HTML for the lines of the Gemini document.
|
||||
.P
|
||||
\fBgmi-web\fR --body < doc.gmi
|
||||
.RE
|
||||
.nf
|
||||
.RS 4
|
||||
gmi-web --body < doc\&.gmi
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
\fB--html\fR \fILANG\fR
|
||||
.RS 4
|
||||
Generate a full HTML5 document with the provided \fILANG\fR. \fB--dir\fR can be used
|
||||
to adjust the document text direction from "ltr" to "rtl".
|
||||
.P
|
||||
Use \fB--descriptions\fR \fILIMIT\fR to apply the first non-empty text line of each
|
||||
file as the description <meta> tag. \fILIMIT\fR will be used to truncate the text
|
||||
with an ellipsis at that number of characters, otherwise the whole line will
|
||||
be used.
|
||||
.P
|
||||
Use \fB--author\fR \fINAME\fR to set the author <meta> tag on every file.
|
||||
.P
|
||||
.RE
|
||||
\fB--css\fR \fIMODE\fR
|
||||
|
@ -61,26 +59,35 @@ include any style information and inline elements will be wrapped in <p>.
|
|||
.RS 4
|
||||
See --help or gmi.css(5) for the complete list of customizable styles.
|
||||
.P
|
||||
\fBgmi-web\fR --html en --foreground "#555555" --background "#9EEBCF" < doc.gmi
|
||||
.P
|
||||
.RE
|
||||
.nf
|
||||
.RS 4
|
||||
gmi-web --html en \\
|
||||
--foreground "#555555" \\
|
||||
--background "#9EEBCF" < doc\&.gmi
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
\fB[--image|--audio|--video]\fR \fIEXENSIONS\fR
|
||||
.RS 4
|
||||
Include the provided \fIEXTENSIONS\fR as inline media according to the flag used.
|
||||
You can provide multiple extensions per flag or multiple flags per extension.
|
||||
.P
|
||||
\fBgmi-web\fR --image jpg png --audio mp3 --html en < doc.gmi
|
||||
.P
|
||||
\fBgmi-web\fR --image jpg --image png --audio mp3 --html en < doc.gmi
|
||||
Include media extensions inline. You can provide multiple extensions per flag
|
||||
or multiple flags per extension.
|
||||
.P
|
||||
.RE
|
||||
.nf
|
||||
.RS 4
|
||||
gmi-web --html en \\
|
||||
--image jpg \\
|
||||
--image png \\
|
||||
--audio mp3 ogg < doc\&.gmi
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
\fB--config\fR [\fIJSON\fR]
|
||||
.RS 4
|
||||
All the options documented here and by \fB--help\fR may be captured in a .json
|
||||
file and passed to \fB--config\fR instead of as flags on the command-line.
|
||||
.P
|
||||
\fBgmi-web\fR --config web.json < doc.gmi
|
||||
.P
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
.P
|
||||
|
|
|
@ -6,34 +6,34 @@ gmi-web - a bridge between Gemini and HTML
|
|||
|
||||
# SYNOPSIS
|
||||
|
||||
*gmi-web* [--html|--body] <_OPTIONS_> < [_FILE_]
|
||||
*gmi-web* [--html _LANG_|--body] <_OPTIONS_> < [_FILE_]
|
||||
|
||||
*gmi-web* [--html|--body] <_OPTIONS_> [_FILES_]
|
||||
*gmi-web* [--html _LANG_|--body] <_OPTIONS_> [_FILES_]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Convert Gemtext to semantic HTML styled in a readable, predictable
|
||||
and mobile-friendly fashion!
|
||||
Convert Gemtext to semantic HTML styled in a readable, predictable and
|
||||
mobile-friendly fashion!
|
||||
|
||||
# OPTIONS
|
||||
|
||||
*--html* _LANG_
|
||||
Generate a full HTML5 document with the provided _LANG_.
|
||||
|
||||
*gmi-web* --html en < doc.gmi
|
||||
|
||||
*--descriptions*
|
||||
If this flag is set the first non-empty text line of each Gemini file will
|
||||
be used for the description <meta> tag. This will be truncated to 200
|
||||
characters using an ellipsis.
|
||||
|
||||
*--author*
|
||||
If provided this will be used for the author <meta> tag on every file.
|
||||
|
||||
*--body*
|
||||
Generate only the HTML for the lines of the Gemini document.
|
||||
|
||||
*gmi-web* --body < doc.gmi
|
||||
```
|
||||
gmi-web --body < doc.gmi
|
||||
```
|
||||
|
||||
*--html* _LANG_
|
||||
Generate a full HTML5 document with the provided _LANG_. *--dir* can be used
|
||||
to adjust the document text direction from "ltr" to "rtl".
|
||||
|
||||
Use *--descriptions* _LIMIT_ to apply the first non-empty text line of each
|
||||
file as the description <meta> tag. _LIMIT_ will be used to truncate the text
|
||||
with an ellipsis at that number of characters, otherwise the whole line will
|
||||
be used.
|
||||
|
||||
Use *--author* _NAME_ to set the author <meta> tag on every file.
|
||||
|
||||
*--css* _MODE_
|
||||
By default this will be set to *gmi.css*. Choosing *base* will use just what
|
||||
|
@ -43,22 +43,27 @@ and mobile-friendly fashion!
|
|||
*gmi.css*
|
||||
See --help or gmi.css(5) for the complete list of customizable styles.
|
||||
|
||||
*gmi-web* --html en --foreground "#555555" --background "#9EEBCF" < doc.gmi
|
||||
```
|
||||
gmi-web --html en \\
|
||||
--foreground "#555555" \\
|
||||
--background "#9EEBCF" < doc.gmi
|
||||
```
|
||||
|
||||
*[--image|--audio|--video]* _EXENSIONS_
|
||||
Include the provided _EXTENSIONS_ as inline media according to the flag used.
|
||||
You can provide multiple extensions per flag or multiple flags per extension.
|
||||
Include media extensions inline. You can provide multiple extensions per flag
|
||||
or multiple flags per extension.
|
||||
|
||||
*gmi-web* --image jpg png --audio mp3 --html en < doc.gmi
|
||||
|
||||
*gmi-web* --image jpg --image png --audio mp3 --html en < doc.gmi
|
||||
```
|
||||
gmi-web --html en \\
|
||||
--image jpg \\
|
||||
--image png \\
|
||||
--audio mp3 ogg < doc.gmi
|
||||
```
|
||||
|
||||
*--config* [_JSON_]
|
||||
All the options documented here and by *--help* may be captured in a .json
|
||||
file and passed to *--config* instead of as flags on the command-line.
|
||||
|
||||
*gmi-web* --config web.json < doc.gmi
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
*gmi.css*(5)
|
||||
|
|
2
html.js
2
html.js
|
@ -19,7 +19,7 @@ export function html(file, options) {
|
|||
if (options.body) return body(tokens, options);
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="${options.language}" style="${options.styles}">
|
||||
<html lang="${options.language}" dir="${options.dir}" style="${options.styles}">
|
||||
<head>${head(
|
||||
Object.assign(options, {
|
||||
title: tokens[0].h1,
|
||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gmi-web-cli",
|
||||
"version": "1.0.0-rc.2",
|
||||
"version": "1.0.1-rc.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gmi-web-cli",
|
||||
"version": "1.0.0-rc.2",
|
||||
"version": "1.0.1-rc.2",
|
||||
"description": "A bridge between HTML and Gemini",
|
||||
"main": "html.js",
|
||||
"type": "module",
|
||||
|
|
Loading…
Reference in a new issue