2026-05-30 16:30:22 +02:00
2026-05-20 16:02:46 +02:00
2026-05-20 16:02:46 +02:00
2026-05-30 16:30:22 +02:00
2026-05-20 16:02:46 +02:00

Note

This program expects that your Gopher server treats empty lines as information lines.

It also expects the server to add the hostname and the port number at the end of links.

Compiling

You need to have Go toolchain installed:

# Debian
sudo apt install golang

# Fedora
sudo dnf install golang

Then, just clone the repo and run go build . to compile an executable.

Usage

gemtext2gophermap input.gmi output_gophermap [max line length (default 70)] [preprocessor insertion map file]

Example

input.gmi

Everything until the first <!--break--> in the map file will be put in place of the following insert-gopher tag.

<!--insert-gopher-->

The <script> tag should be removed because it is between two web-only tags.

<!--web-only-->
<script>
console.log("joj")
</script>
<!--web-only-->

> Everything after the first <!--break--> in the map file:

<!--insert-gopher-->

map.txt

<?php
echo "i" . date(DATE_RFC2822) . "\tFAKE\tNULL\t0";
?>
<!--break-->
A line from map.txt

If a line in map.txt isn't in format i /PATH host 123 it will not automatically get converted into that format, your server is expected to do that or you should write that explicitly in the map.txt file.

This has been done to allow injecting PHP scripts. (to avoid: i<?php /FAKE NULL 0)

Command

gemtext2gophermap input.gmi - 70 map.txt

If - is passed instead of input or output file name stdin or stdout will be used. Reading the map file from stdin is not supported.

Output

iEverything until the first <!--break--> in the map file will be put in /FAKE   NULL    0
iplace of the following insert-gopher tag.      /FAKE   NULL    0
<?php
echo date(DATE_RFC2822);
?>

iThe <script> tag should be removed because it is between two web-only   /FAKE   NULL    0
itags.  /FAKE   NULL    0
i> Everything after the first <!--break--> in the map file:     /FAKE   NULL    0

A line from map.txt
S
Description
A really crappy Go program to convert Gemtext (.gmi) to a Gophermap
Readme 41 KiB
Languages
Go 100%