GitHub - valpackett/microformats2-parser: A Microformats 2 parser for Haskell | now on https://codeberg.org/valpackett/microformats2-parser - GH used for Actions only (original) (raw)

Hackage unlicense

microformats2-parser

Microformats 2 parser for Haskell! #IndieWeb

Also check out http-link-header because you often need to read links from the Link header!

DEMO PAGE

Usage

Look at the API docs on Hackage for more info, here's a quick overview:

{-# LANGUAGE OverloadedStrings #-}

import Data.Microformats2.Parser import Data.Default import Network.URI

parseMf2 def $ documentRoot $ parseLBS "

Yay!

"

parseMf2 (def { baseUri = parseURI "https://where.i.got/that/page/from/" }) $ documentRoot $ parseLBS "<base href="base/">

Yay!

"

The def is the default configuration.

The configuration includes:

parseMf2 will return an Aeson Value structured like canonical microformats2 JSON.lens-aeson is a good way to navigate it.

Development

Use stack to build.
Use ghci to run tests quickly with :test (see the .ghci file).

$ stack build

$ stack test

$ stack ghci

License

This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.