| Copyright | (c) Sena 2023 |
|---|---|
| License | AGPL-3.0-or-later |
| Maintainer | Sena <jn-sena@proton.me> |
| Stability | unstable |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Text.Gemini
Description
A tiny text/gemini parser.
Parses Gemtext documents from and to Text. See the Section 5 of the
Gemini Protocol specification.
Gemtext Types
type GemDocument = [GemItem] Source #
A Gemtext document, in the form of an ordered list.
A Gemtext item.
Constructors
| GemText Text | A regular Gemtext line. -- |
| GemLink Text (Maybe Text) | A Gemtext link. -- |
| GemHeading Int64 Text | A Gemtext heading of 3 levels max. -- |
| GemList [Text] | A Gemtext unordered list. -- |
| GemQuote Text | A Gemtext quote. -- |
| GemPre [Text] (Maybe Text) | A Gemtext preformat. -- |
Decoding from Text
decode :: Text -> GemDocument Source #
Parse a text/gemini file as GemDocument.
The text should be supplied as an LF-ending Text.
decodeLine :: Text -> GemItem Source #
Encoding to Text
encode :: GemDocument -> Text Source #
Encode parsed GemDocument to a text/gemini file.
The output Text uses LF-endings.