💾 Archived View for idiomdrottning.org › gmihw captured on 2023-07-10 at 14:01:38. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-05-22)

-=-=-=-=-=-=-

gmihw

gmihw < my-snazzy-file.gmihw > my-snazzy-file.gmi

Gmihw takes hardwrapped text and softwraps it (in other words, it removes hard line breaks).

Blank lines (a.k.a. double newlines) are preserved as is. Two spaces at the end of a line are transformed into a single newline (as in Markdown).

Gmihw understands Gemini’s seven line types, and only operates on quotes and plain text lines. It doesn’t touch header lines, link lines, list lines, and pre lines.

This:

Some words
in a paragraph
> then immediately
> a quote

becomes

Some words in a paragraph
> then immediately a quote

It always inserts one space when combining lines, and it does not attempt to be aware of hyphenation.

Don’t publish hardwrapped Gemini text. Instead, use gmihw to convert it to real, softwrapped gemtext before publishing it.

A reverse filter, that turns gmi to gmihw, in case you want to edit/update old texts, is yet to be implemented.

The input file can have any line endings. The output file will have DOS style line endings, a.k.a. CRLF.

It’s available under BSD 1-clause at

git clone https://idiomdrottning.org/gmihw

The repo contains two separate implementations. gmihw.scm in Chicken Scheme (and depends on the anaphora, utf8, and srfi-13 eggs), and gmihw.c in C. Compile with

cc gmihw.c -o gmihw

Or, it’s a simple idea. Feel free to write your own implementation in your fave language.