-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | a tiny gemtext parser
--
-- gemmula is a tiny gemtext (unofficially text/gemini) parser
-- from and back into Text, attempting to be mostly
-- compliant with the Gemini hypertext format specification while
-- being somewhat practical.
@package gemmula
@version 1.2.0
-- | Parse gemtext (text/gemini) documents from and back into
-- Text.
--
-- See the Gemini hypertext format specification at
-- https://geminiprotocol.net/docs/gemtext-specification.gmi.
module Text.Gemini
-- | A gemtext document, in the form of a list of GemItems
type GemDocument = [GemItem]
-- | A gemtext item
data GemItem
-- | A regular gemtext line -- GemText <Text>
GemText :: !Text -> GemItem
-- | A gemtext link -- GemLink <Link> [Optional
-- Description]
GemLink :: !Text -> !Maybe Text -> GemItem
-- | A gemtext heading of 3 levels max -- GemHeading
-- <Level> <Text>
GemHeading :: !Int -> !Text -> GemItem
-- | An unordered gemtext list -- GemList <Lines>
--
-- Gemtext specification does not endorse grouping list items this
-- way. This approach is purely for practical reasons, such as ease of
-- conversion to unordered HTML lists.
GemList :: ![Text] -> GemItem
-- | A gemtext quote -- GemQuote <Text>
GemQuote :: !Text -> GemItem
-- | A preformatted gemtext block -- GemPre <Lines>
-- [Optional Alt Text]
GemPre :: ![Text] -> !Maybe Text -> GemItem
-- | Parse a gemtext block as a GemDocument.
--
-- The input Text must use either CRLF or LF.
decode :: Text -> GemDocument
-- | Parse a single gemtext line as GemItem.
--
-- There should not be any line breaks in the input; if present,
-- they are treated as spaces. Preformatted text blocks are regarded as
-- GemTexts as they are strictly multiline.
decodeLine :: Text -> GemItem
-- | Encode a parsed GemDocument into a gemtext block.
--
-- The output Text uses CRLF line breaks and ends with a newline.
--
-- Empty lists are ignored completely if present. See the
-- encodeItem function for additional quirks.
encode :: GemDocument -> Text
-- | Encode a single parsed GemItem into gemtext.
--
-- The output Text does not end with an additional newline,
-- and might be multiple lines, in which case it uses CRLF line breaks.
--
-- Prefixes are escaped as necessary before encoding and the spaces in
-- GemLinks are replaced with %20 to normalize them. Line
-- breaks inside the body of an item are also replaced with a space.
encodeItem :: GemItem -> Text
-- | Get the title of the GemDocument, which is the very first
-- GemHeading in the document, regardless of the level of the
-- heading.
documentTitle :: GemDocument -> Maybe Text
instance GHC.Classes.Eq Text.Gemini.GemItem
instance GHC.Show.Show Text.Gemini.GemItem