fix undefined links

This commit is contained in:
Talon Poole 2021-01-30 21:28:30 +00:00
parent bfb0fcab29
commit cee20a2f76
8 changed files with 9 additions and 10 deletions

View file

@ -84,7 +84,7 @@ Currently approaching a v1 release 🎉 Would you like to help test the RC? _You
Install the binary via npm. Install the binary via npm.
```sh ```sh
npm install --global gmi-web-cli@1.0.3-rc.1 npm install --global gmi-web-cli@1.0.4-rc.1
``` ```
Render .html for all the .gmi files in the current directory Render .html for all the .gmi files in the current directory

View file

@ -5,7 +5,7 @@
.nh .nh
.ad l .ad l
.\" Begin generated content: .\" Begin generated content:
.TH "gmi-web" "1" "2021-01-30" "1.0.2-rc.1" .TH "gmi-web" "1" "2021-01-30" "1.0.3-rc.1"
.P .P
.SH NAME .SH NAME
.P .P

View file

@ -1,4 +1,4 @@
gmi-web(1) "1.0.3-rc.1" gmi-web(1) "1.0.4-rc.1"
# NAME # NAME

View file

@ -5,7 +5,7 @@
.nh .nh
.ad l .ad l
.\" Begin generated content: .\" Begin generated content:
.TH "gmi.css" "5" "2021-01-30" "1.0.2-rc.1" .TH "gmi.css" "5" "2021-01-30" "1.0.3-rc.1"
.P .P
.SH NAME .SH NAME
.P .P

View file

@ -1,4 +1,4 @@
gmi.css(5) "1.0.3-rc.1" gmi.css(5) "1.0.4-rc.1"
# NAME # NAME

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "gmi-web-cli", "name": "gmi-web-cli",
"version": "1.0.2-rc.1", "version": "1.0.3-rc.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

@ -1,6 +1,6 @@
{ {
"name": "gmi-web-cli", "name": "gmi-web-cli",
"version": "1.0.3-rc.1", "version": "1.0.4-rc.1",
"description": "A bridge between HTML and Gemini", "description": "A bridge between HTML and Gemini",
"main": "cli.js", "main": "cli.js",
"bin": { "bin": {

View file

@ -65,8 +65,7 @@ function gemtext(tokens, options) {
body = body.concat(tokens.slice(0, closing).map(({ text }) => text)); body = body.concat(tokens.slice(0, closing).map(({ text }) => text));
body.push("</pre>"); body.push("</pre>");
tokens = tokens.slice(closing + 1); tokens = tokens.slice(closing + 1);
} } else if (cursor.li) {
else if (cursor.li) {
body.push(`<ul>`); body.push(`<ul>`);
const closing = tokens.findIndex((token) => !token.li); const closing = tokens.findIndex((token) => !token.li);
body = body.concat(tokens.slice(0, closing).map(line)); body = body.concat(tokens.slice(0, closing).map(line));
@ -94,7 +93,7 @@ function line(
if (video && VIDEO_EXT.test(href)) if (video && VIDEO_EXT.test(href))
return `<video controls src="${href}" title="${title}"/></video>`; return `<video controls src="${href}" title="${title}"/></video>`;
return `<a href="${href}">${escape(title) || href}</a>`; return `<a href="${href}">${title ? escape(title) : href}</a>`;
} }
if (h1) return `<h1>${escape(h1)}</h1>`; if (h1) return `<h1>${escape(h1)}</h1>`;
if (h2) return `<h2>${escape(h2)}</h2>`; if (h2) return `<h2>${escape(h2)}</h2>`;