This commit is contained in:
Talon Poole 2021-02-16 20:32:27 +00:00
parent 1b45b53262
commit c02c6474a8
11 changed files with 9 additions and 230 deletions

View file

@ -6,3 +6,5 @@ indent_size = 2
indent_style = space indent_style = space
[*.scd] [*.scd]
indent_style = tab indent_style = tab
[Makefile]
indent_style = tab

5
.gitignore vendored
View file

@ -1,5 +1,2 @@
node_modules/ node_modules/
capsule/ gmi-web.1
gmi.js
gmi.min.js
example/test.html

View file

@ -1 +0,0 @@
example/

View file

@ -119,8 +119,7 @@ See the gmi-web(1) man page for more information
# gmi.css # gmi.css
Optimized for readability, predictability and mobile-friendliness. Optimized for readability, predictability and mobile-friendliness. Ships with a handful of customizable variables.
Ships with a handful of customizable variables. See `man 5 gmi.css`.
The `--foreground` and `--background` variables will be inverted when The `--foreground` and `--background` variables will be inverted when
`prefers-color-scheme` is "dark" which is a system-level preference on `prefers-color-scheme` is "dark" which is a system-level preference on

View file

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html lang="en" style="undefined">
<head>
<meta name="color-scheme" content="dark light">
<style>:root{--body-width:48rem;--foreground:black;--background:white;--p-size:1.25rem;--p-indent:0rem;--p-line-height:1.5;--a-size:var(--p-size);--pre-size:1rem;--pre-line-height:1;--h1-size:3rem;--h2-size:2.25rem;--h3-size:1.5rem;--heading-line-height:1.25;--ul-size:var(--p-size);--ul-line-height:1.25;--blockquote-size:var(--p-size);--blockquote-line-height:1.25;--mono:Consolas,monaco,monospace;--serif:georgia,times,serif;--sans-serif:-apple-system,BlinkMacSystemFont,"avenir next",avenir,helvetica,"helvetica neue",ubuntu,roboto,noto,"segoe ui",arial,sans-serif}body{max-width:var(--body-width);padding:.5rem;margin:0 auto}a,audio,blockquote,h1,h2,h3,img,p,pre,ul,video{display:block;max-width:100%;margin:0;padding:0;overflow-wrap:anywhere}h1,h2,h3{font-family:var(--sans-serif);line-height:var(--heading-line-height)}p{font-size:var(--p-size);font-family:var(--serif);text-indent:var(--p-indent);line-height:var(--p-line-height)}a::before{font-size:var(--p-size);font-family:var(--mono);content:"⇒";padding-right:0.25rem;vertical-align:middle}a{font-size:var(--p-size);font-family:var(--serif);text-decoration:none}pre{font-size:var(--pre-size);font-family:var(--mono);line-height:var(--pre-line-height);padding:1.25rem;overflow-y:auto}h1{font-size:var(--h1-size)}h2{font-size:var(--h2-size)}h3{font-size:var(--h3-size)}ul{font-size:var(--p-size);font-family:var(--serif);line-height:var(--ul-line-height);list-style-type:none}li::before{font-size:var(--p-size);font-family:var(--mono);content:"*";vertical-align:middle;padding-right:0.5rem}blockquote{font-size:var(--p-size);font-family:var(--serif);line-height:var(--blockquote-line-height);padding-left:0.75rem}pre+blockquote{padding-top:0.5rem;padding-bottom:0.5rem}a,blockquote,body,h1,h2,h3,html,p,pre::-moz-selection,pre::selection,ul{color:var(--foreground);background-color:var(--background)}blockquote{border-left:.5rem solid var(--foreground)}::-moz-selection,::selection,a:hover,pre{color:var(--background);background-color:var(--foreground)}@media (prefers-color-scheme:dark){a,blockquote,body,h1,h2,h3,html,p,pre::-moz-selection,pre::selection,ul{color:var(--background);background-color:var(--foreground)}blockquote{border-left:.5rem solid var(--background)}::-moz-selection,::selection,a:hover,pre{color:var(--foreground);background-color:var(--background)}}</style>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="utf-8">
<meta language="en">
<title>heading 1</title>
</head>
<body>
<h1>heading 1</h1>
<h2>heading 2</h2>
<h3>heading 3</h3>
<p>checkout this empty line:</p>
<p><br></p>
<ul>
<li>and</li>
<li>this</li>
<li>list</li>
</ul>
<p><br></p>
<blockquote>here&#39;s what a blockquote is like</blockquote>
<p><br></p>
<pre title="pre tags can have title text">
preformatted text
means that it already has formatting
which means it should show
as is
</pre>
<p><br></p>
<p>&lt;b&gt;watch out!&lt;/b&gt; a gemtext line could have html in it that you&#39;ll need to escape!</p>
<p><br></p>
<a href="https://codeberg.org/talon/gmi-web">https://codeberg.org/talon/gmi-web</a>
<a href="https://codeberg.org/talon/gmi-web">links can have text too</a>
<img src="https://www.learningcontainer.com/wp-content/uploads/2020/07/Large-Sample-Image-download-for-Testing.jpg" title="JPG image that can render inline!"/>
<audio controls src="https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3" title="MP3 audio that can render inline!"></audio>
<video controls src="https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4" title="MP4 Video that can render inline!"/></video>
<p><br></p>
<h3>w/ no &quot;titles&quot;</h3>
<img src="https://www.learningcontainer.com/wp-content/uploads/2020/07/Large-Sample-Image-download-for-Testing.jpg"/>
<audio controls src="https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3"></audio>
<video controls src="https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4"/></video>
</body>
</html>

View file

@ -1,33 +0,0 @@
# heading 1
## heading 2
### heading 3
checkout this empty line:
* and
* this
* list
> here's what a blockquote is like
```pre tags can have title text
preformatted text
means that it already has formatting
which means it should show
as is
```
<b>watch out!</b> a gemtext line could have html in it that you'll need to escape!
=> https://codeberg.org/talon/gmi-web
=> https://codeberg.org/talon/gmi-web links can have text too
=> https://www.learningcontainer.com/wp-content/uploads/2020/07/Large-Sample-Image-download-for-Testing.jpg JPG image that can render inline!
=> https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3 MP3 audio that can render inline!
=> https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4 MP4 Video that can render inline!
### w/ no "titles"
=> https://www.learningcontainer.com/wp-content/uploads/2020/07/Large-Sample-Image-download-for-Testing.jpg
=> https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3
=> https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4

117
gmi-web.1
View file

@ -1,117 +0,0 @@
.\" Generated by scdoc 1.10.1
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "gmi-web" "1" "2021-02-16" "1.0.4-rc.2"
.P
.SH NAME
.P
gmi-web - a bridge between Gemini and HTML
.P
.SH SYNOPSIS
.P
\fBgmi-web\fR \fIOPTIONS\fR < \fIFILE\fR
.P
\fBgmi-web\fR \fIOPTIONS\fR \fIFILES\fR
.P
.SH DESCRIPTION
.P
Convert Gemtext to semantic HTML styled in a readable, predictable and
mobile-friendly fashion!
.P
.SH OPTIONS
.P
\fB--body\fR
.RS 4
Generate just the HTML for the lines of the Gemini document.
.P
.RE
\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.
.P
Use \fB--author\fR \fINAME\fR to set the author <meta> tag on every file.
.P
.RE
\fB--css\fR [\fIMODE\fR|\fIFILE\fR]
.RS 4
By default this will be set to \fBfull\fR enabling a handful of customizable
variables. See \fB--help\fR for the complete list.
.P
.RE
.nf
.RS 4
gmi-web --html en \\
--foreground "#555555" \\
--background "#9EEBCF" < doc\&.gmi
.fi
.RE
.P
.RS 4
Choosing \fBcore\fR will use just what is needed to fix vertical layout issues
with CSS 2.1's Normal Flow and inline elements. Pointing to a .css \fIFILE\fR
will use those styles.
.P
Choosing \fBnone\fR will not include any style information including when paired
with \fB--body\fR where it will not apply the core inline styles.
.P
.RE
\fB[--image|--audio|--video]\fR \fIEXTENSIONS\fR
.RS 4
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
.RE
.SH AUTHORS
.P
Maintained by Talon Poole <code@talon.computer>. Up-to-date sources can be
found at https://codeberg.org/talon/gmi-web
.P
.SH COPYRIGHT
This is free and unencumbered software released into the public domain.
.P
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
.P
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
.P
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
.P
For more information, please refer to <http://unlicense.org/>

View file

@ -1,8 +1,8 @@
gmi-web(1) "1.0.5-rc.2" gmi-web(1) "1.0.7-rc.2"
# NAME # NAME
gmi-web - a bridge between Gemini and HTML gmi-web - A bridge between Gemini and HTML
# SYNOPSIS # SYNOPSIS

10
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "gmi-web-cli", "name": "gmi-web-cli",
"version": "1.0.4-rc.2", "version": "1.0.6-rc.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -58,14 +58,6 @@
"get-intrinsic": "^1.0.2" "get-intrinsic": "^1.0.2"
} }
}, },
"clean-css": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.0.1.tgz",
"integrity": "sha512-F1zAGOowUCg8yxT0O4UR+nmbMauf3YwbiUS60CPxpzJU7ulpamGzQomFrJSK4w/HqHtMmQKSHJUNue+dQQYQdg==",
"requires": {
"source-map": "~0.6.0"
}
},
"cliui": { "cliui": {
"version": "7.0.4", "version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",

View file

@ -1,6 +1,6 @@
{ {
"name": "gmi-web-cli", "name": "gmi-web-cli",
"version": "1.0.5-rc.2", "version": "1.0.7-rc.2",
"description": "A bridge between HTML and Gemini", "description": "A bridge between HTML and Gemini",
"main": "html.js", "main": "html.js",
"type": "module", "type": "module",
@ -8,8 +8,7 @@
"gmi-web": "cli.js" "gmi-web": "cli.js"
}, },
"man": [ "man": [
"./gmi-web.1", "./gmi-web.1"
"./gmi.css.5"
], ],
"files": [ "files": [
"UNLICENSE", "UNLICENSE",
@ -24,7 +23,6 @@
"prepare": "prettier --write ." "prepare": "prettier --write ."
}, },
"dependencies": { "dependencies": {
"clean-css": "^5.0.1",
"css": "^3.0.0", "css": "^3.0.0",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"map-stream": "0.0.7", "map-stream": "0.0.7",

10
test.sh
View file

@ -1,10 +0,0 @@
rm -rf "example/test.html"
./cli.js --image jpg --audio mp3 --video mp4 --html en "example/*.gmi"
if cmp -s "example/test.html" "example/expected.html"; then
printf "PASS: test.html matches expected.html!\n"
else
printf "FAIL: test.html DOES NOT match expected.html!\n"
cmp "example/test.html" "example/expected.html"
diff "example/test.html" "example/expected.html"
exit 1
fi