I Wrote a General Gemtext Parser

=> https://notabug.org/tinyrabbit/gemtextparser

You can clone it and install with pip locally (I haven't published it to PyPI).

It's not a big deal, really. Despite the opinions aired in my last post gemtext is, as I mentioned, not hard to parse.

This module provides a general parser and validator. Where gmi2html reads a file line by line and determines how to translate what it gets to HTML, gemtextparser reads a file and determines what each line semantically is. What you do with those lines is up to you.

Oh, yeah, you can run it as a CLI program that validates given files as well. There's not many errors you can make when writing gemtext, but it catches two: unclosed preformatted block and empty lines (plain text and preformatted lines can be empty, of course).

-- CC0 ew0k, 2021-07-25

Proxy Information
Original URL
gemini://warmedal.se/~bjorn/posts/i-wrote-a-general-gemtext-parser.gmi
Status Code
Success (20)
Meta
text/gemini; lang=en
Capsule Response Time
112.010787 milliseconds
Gemini-to-HTML Time
0.347933 milliseconds

This content has been proxied by September (ba2dc).