module Text.Atom.Feed.Link
( LinkRelation(..)
, showLinkRelation
, showLinkAttr
) where
import Prelude.Compat
data LinkRelation
= LinkAlternate
| LinkCurrent
| LinkEnclosure
| LinkEdit
| LinkEditMedia
| LinkFirst
| LinkLast
| LinkLicense
| LinkNext
| LinkNextArchive
| LinkPayment
| LinkPrevArchive
| LinkPrevious
| LinkRelated
| LinkReplies
| LinkSelf
| LinkVia
| LinkOther String
deriving (LinkRelation -> LinkRelation -> Bool
(LinkRelation -> LinkRelation -> Bool)
-> (LinkRelation -> LinkRelation -> Bool) -> Eq LinkRelation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LinkRelation -> LinkRelation -> Bool
$c/= :: LinkRelation -> LinkRelation -> Bool
== :: LinkRelation -> LinkRelation -> Bool
$c== :: LinkRelation -> LinkRelation -> Bool
Eq, Int -> LinkRelation -> ShowS
[LinkRelation] -> ShowS
LinkRelation -> String
(Int -> LinkRelation -> ShowS)
-> (LinkRelation -> String)
-> ([LinkRelation] -> ShowS)
-> Show LinkRelation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LinkRelation] -> ShowS
$cshowList :: [LinkRelation] -> ShowS
show :: LinkRelation -> String
$cshow :: LinkRelation -> String
showsPrec :: Int -> LinkRelation -> ShowS
$cshowsPrec :: Int -> LinkRelation -> ShowS
Show)
showLinkRelation :: LinkRelation -> String
showLinkRelation :: LinkRelation -> String
showLinkRelation lr :: LinkRelation
lr =
case LinkRelation
lr of
LinkAlternate -> "alternate"
LinkCurrent -> "current"
LinkEnclosure -> "enclosure"
LinkEdit -> "edit"
LinkEditMedia -> "edit-media"
LinkFirst -> "first"
LinkLast -> "last"
LinkLicense -> "license"
LinkNext -> "next"
LinkNextArchive -> "next-archive"
LinkPayment -> "payment"
LinkPrevArchive -> "prev-archive"
LinkPrevious -> "previous"
LinkRelated -> "related"
LinkReplies -> "replies"
LinkSelf -> "self"
LinkVia -> "via"
LinkOther s :: String
s -> String
s
showLinkAttr :: LinkRelation -> String -> String
showLinkAttr :: LinkRelation -> ShowS
showLinkAttr lr :: LinkRelation
lr s :: String
s = LinkRelation -> String
showLinkRelation LinkRelation
lr String -> ShowS
forall a. [a] -> [a] -> [a]
++ '=' Char -> ShowS
forall a. a -> [a] -> [a]
: '"' Char -> ShowS
forall a. a -> [a] -> [a]
: (Char -> String) -> ShowS
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Char -> String
escQ String
s String -> ShowS
forall a. [a] -> [a] -> [a]
++ "\""
where
escQ :: Char -> String
escQ '"' = "&dquot;"
escQ x :: Char
x = [Char
x]