RC
This commit is contained in:
parent
6ec48f2605
commit
b383f03f94
3
cli.js
3
cli.js
|
@ -30,8 +30,9 @@ const GMI_CSS_VARS = [
|
|||
|
||||
require("yargs")
|
||||
.scriptName("gmi-web")
|
||||
.config()
|
||||
.command(
|
||||
"$0 [--lang] [files..]",
|
||||
"$0 [files..]",
|
||||
"Convert .gmi to .html. See gmi-web(1) for more details.",
|
||||
(yargs) =>
|
||||
yargs
|
||||
|
|
30
gmi-web.1
30
gmi-web.1
|
@ -35,6 +35,12 @@ name.
|
|||
\fBgmi-web\fR --lang "en" --foreground "#FFFFF" --background "#00000" $(find . -name *.gmi)
|
||||
.P
|
||||
.RE
|
||||
\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.
|
||||
.P
|
||||
.RE
|
||||
\fB--images\fR \fB--audio\fR \fB--video\fR
|
||||
.RS 4
|
||||
Include the respective media inline.
|
||||
|
@ -42,7 +48,7 @@ Include the respective media inline.
|
|||
.RE
|
||||
\fB--no-css\fR
|
||||
.RS 4
|
||||
Use only the bare-minimum <style>
|
||||
Use only the bare minimum <style>
|
||||
.P
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
|
@ -55,6 +61,28 @@ gmi-web --lang en $(find \&. -name *\&.gmi)
|
|||
.fi
|
||||
.RE
|
||||
.P
|
||||
To use \fB--config\fR you will need a .json file with the flags you want to be
|
||||
included.
|
||||
.P
|
||||
.nf
|
||||
.RS 4
|
||||
{
|
||||
"language": "en",
|
||||
"foreground": "#137752",
|
||||
"background": "#F4F4F4"
|
||||
}
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
Then give the path to \fBgmi-web\fR --config.
|
||||
.P
|
||||
.nf
|
||||
.RS 4
|
||||
gmi-web --config /path/to/my\&.json $(find \&. -name *\&.gmi)
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
.P
|
||||
.SH SEE ALSO
|
||||
.P
|
||||
\fBgmi.css\fR(5)
|
||||
|
|
|
@ -24,11 +24,15 @@ and mobile-friendly fashion!
|
|||
|
||||
*gmi-web* --lang "en" --foreground "#FFFFF" --background "#00000" $(find . -name \*.gmi)
|
||||
|
||||
*--config* [_JSON_]
|
||||
All the options documented here and by *--help* may be captured in a .json
|
||||
file and passed to *--config*.
|
||||
|
||||
*--images* *--audio* *--video*
|
||||
Include the respective media inline.
|
||||
|
||||
*--no-css*
|
||||
Use only the bare-minimum <style>
|
||||
Use only the bare minimum <style>
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
@ -38,6 +42,24 @@ Render .html for all the .gmi files in the current directory
|
|||
gmi-web --lang en $(find . -name \*.gmi)
|
||||
```
|
||||
|
||||
To use *--config* you will need a .json file with the flags you want to be
|
||||
included.
|
||||
|
||||
```
|
||||
{
|
||||
"language": "en",
|
||||
"foreground": "#137752",
|
||||
"background": "#F4F4F4"
|
||||
}
|
||||
```
|
||||
|
||||
Then give the path to *gmi-web* --config.
|
||||
|
||||
```
|
||||
gmi-web --config /path/to/my.json $(find . -name \*.gmi)
|
||||
```
|
||||
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
*gmi.css*(5)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gmi-web",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"description": "A bridge between the HTML and Gemini",
|
||||
"main": "cli.js",
|
||||
"bin": {
|
||||
|
|
22
tokenize.js
22
tokenize.js
|
@ -1,19 +1,17 @@
|
|||
const GMI_EXT = /\.gmi$/;
|
||||
const GMI_REGEX = require("./gmi.regex");
|
||||
const tokenize = (exports.tokenize = (file) =>
|
||||
JSON.stringify(
|
||||
file.contents
|
||||
.toString("utf8")
|
||||
.split("\n")
|
||||
.map((line) => GMI_REGEX.exec(line).groups),
|
||||
null,
|
||||
2
|
||||
));
|
||||
module.exports = (file, cb) => {
|
||||
if (!GMI_EXT.test(file.path)) return cb(null, file);
|
||||
|
||||
file.contents = Buffer.from(tokenize(file));
|
||||
file.path = file.path.replace(GMI_EXT, ".tokens.json");
|
||||
file.contents = Buffer.from(
|
||||
JSON.stringify(
|
||||
file.contents
|
||||
.toString("utf8")
|
||||
.split("\n")
|
||||
.map((line) => GMI_REGEX.exec(line).groups),
|
||||
null,
|
||||
2
|
||||
)
|
||||
);
|
||||
|
||||
cb(null, file);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue