Description
A collection of implementations of IndieWeb algorithms.
README.md
indieweb-algorithms
A collection of implementations of IndieWeb- and Microformats 2-related algorithms (based on microformats2-parser and http-link-header):
- finding all microformats of a given type (while retaining the path to them), ie. flattening the tree
- discovering authorship of an
h-entry
- discovering the representative h-card
- discovering Webmention/Micropub/IndieAuth/etc. endpoints (HTTP
Link
header,a
andlink
tags with therel
attribute) - parsing tweets on Twitter.com into microformats (like php-mf2-shim)
- detecting post types
- converting microformats to Atom feeds
Usage
Endpoints
{-# LANGUAGE OverloadedStrings #-}
import Network.HTTP.Link
import Data.Default
import Data.Maybe
import Data.Microformats2.Parser
import Data.IndieWeb.Endpoints
discoverEndpoints [ "micropub" ] (parseMf2 def $ documentRoot $ parseLBS "<link rel=micropub href='http://example.com/micropub2'>...") (fromMaybe [] $ parseLinkHeader "<http://example.com/micropub>; rel=\"micropub\"")
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.