doc-driven

This commit is contained in:
Talon Poole 2021-01-29 19:55:24 +00:00
parent d587b5001d
commit ab7f953a73
6 changed files with 69 additions and 57 deletions

View file

@ -67,23 +67,13 @@ A reference implementation of what has been discussed above!
```sh
npm install -g git+https://codeberg.org/talon/gmi-web.git
man gmi-web
```
### example
```
gmi-web [--css] [files..]
Convert .gmi to .html. See gmi-web(1) for more details.
Positionals:
files The *.gmi files to convert [required]
Options:
--version Show version number [boolean]
--help Show help [boolean]
--images Include images [boolean] [default: false]
--audio Include audio [boolean] [default: false]
--video Include video [boolean] [default: false]
--css Include gmi.css [boolean] [default: true]
gmi-web -r ~/gmi /srv/html
```
## gmi.css
@ -111,7 +101,11 @@ Or maybe by adding a style to the `<html>` element.
<html style="--foreground:#555555; --background:#9EEBCF;">
```
When using `gmi-web(1)` they can be customized by the `--style` flag.
When using `gmi-web(1)` they can be customized by providing _OPTIONS_ of the same name as the CSS variable.
```sh
gmi-web --foreground "#FFFFF" --background "#00000" \*.gmi
```
# License

9
cli.js
View file

@ -8,7 +8,7 @@ const toHTML = require("./to-html");
require("yargs")
.scriptName("gmi-web")
.command(
"$0 [--css] <files..>",
"$0 <files..>",
"Convert .gmi to .html. See gmi-web(1) for more details.",
(yargs) =>
yargs
@ -31,8 +31,8 @@ require("yargs")
default: false,
description: "Include video",
})
.option("silent", {
alias: "s",
.option("verbose", {
alias: "v",
type: "boolean",
default: false,
description: "No logging to stdout",
@ -43,12 +43,13 @@ require("yargs")
description: "Include gmi.css",
}),
(argv) => {
if (argv.verbose) console.log(argv);
fs.src(argv.files)
.pipe(map(tokenize))
.pipe(
map(
toHTML({
css: argv.css,
css: !argv.noCss,
inline: {
images: argv.images,
audio: argv.audio,

View file

@ -5,47 +5,58 @@
.nh
.ad l
.\" Begin generated content:
.TH "gmi-web" "1" "2021-01-29" "0.1.0"
.TH "gmi-web" "1" "2021-01-29" "1.0.0"
.P
.SH NAME
.P
gmi-web - A bridge between Gemini and HTML
gmi-web - A bridge between Gemini and HTML.
.P
.SH SYNOPSIS
.P
\fBgmi-web\fR [\fIOPTIONS\fR...] [\fIFILES\fR...]
\fBgmi-web\fR [\fIOPTIONS\fR] <\fIFILES\fR>
.P
\fBgmi-web\fR --recursive [\fIOPTIONS\fR] <\fIDIR\fR> [\fIOUT\fR]
.P
.SH DESCRIPTION
.P
Convert your Gemini \fIFILES\fR to semantic HTML styled in a readable, predictable
Convert Gemtext to semantic HTML styled in a readable, predictable
and mobile-friendly fashion!
.P
.SH OPTIONS
.P
\fBCSS variables\fR
.RS 4
Any variable documented in \fBgmi.css(5)\fR can be set via \fIOPTIONS\fR of the same name.
.P
\fBgmi-web\fR --foreground "#FFFFF" --background "#00000" *.gmi
.P
.RE
\fB--recursive\fR <\fIDIR\fR> [\fIOUT\fR]
.RS 4
Recursively generate HTML for a \fIDIR\fR. Use \fIOUT\fR to put the .html somewhere
other than \fIDIR\fR.
.P
\fBgmi-web\fR --recursive capsule /srv/html/
.P
.RE
\fB--no-css\fR
.RS 4
Use only the bare-minimum <style>
.P
.RE
\fB--images\fR \fB--audio\fR \fB--video\fR
.RS 4
Include the respective media inline.
.P
.RE
\fB--no-css\fR
\fB--verbose\fR
.RS 4
Do not include gmi.css in the rendered HTML markup.
Enable internal logs for debugging mostly.
.P
.RE
\fB--silent\fR
.RS 4
Do not log anything to stdout
.SH SEE ALSO
.P
.RE
.SH EXAMPLES
.P
The following example will create .html converted files next to their .gmi counterparts on the filesystem.
.P
.nf
.RS 4
$ gmi-web gmi/*\&.gmi
.fi
.RE
\fBgmi.css\fR(5)
.P
.SH AUTHORS
.P

View file

@ -1,36 +1,46 @@
gmi-web(1) "0.1.0"
gmi-web(1) "1.0.0"
# NAME
gmi-web - A bridge between Gemini and HTML
gmi-web - A bridge between Gemini and HTML.
# SYNOPSIS
*gmi-web* [_OPTIONS_...] [_FILES_...]
*gmi-web* [_OPTIONS_] <_FILES_>
*gmi-web* --recursive [_OPTIONS_] <_DIR_> [_OUT_]
# DESCRIPTION
Convert your Gemini _FILES_ to semantic HTML styled in a readable, predictable
Convert Gemtext to semantic HTML styled in a readable, predictable
and mobile-friendly fashion!
# OPTIONS
*CSS variables*
Any variable documented in *gmi.css*(5) can be set via _OPTIONS_ of the same
name.
*gmi-web* --foreground "#FFFFF" --background "#00000" \*.gmi
*--recursive* <_DIR_> [_OUT_]
Recursively generate HTML for a _DIR_. Use _OUT_ to put the .html somewhere
other than _DIR_.
*gmi-web* --recursive capsule /srv/html/
*--no-css*
Use only the bare-minimum <style>
*--images* *--audio* *--video*
Include the respective media inline.
*--no-css*
Do not include gmi.css in the rendered HTML markup.
*--verbose*
Enable internal logs for debugging mostly.
*--silent*
Do not log anything to stdout
# SEE ALSO
# EXAMPLES
The following example will create .html converted files next to their .gmi counterparts on the filesystem.
```
$ gmi-web gmi/*.gmi
```
*gmi.css*(5)
# AUTHORS

View file

@ -66,8 +66,6 @@ Or maybe by adding a style tag to the <html> element.
.fi
.RE
.P
When using \fBgmi-web\fR(1) they can be customized by the \fB--style\fR flag.
.P
.SH SEE ALSO
.P
\fBgmi-web\fR(1)

View file

@ -53,8 +53,6 @@ Or maybe by adding a style tag to the <html> element.
<html style="--foreground:#555555; --background:#9EEBCF;">
```
When using *gmi-web*(1) they can be customized by the *--style* flag.
# SEE ALSO
*gmi-web*(1)