Skip to content

Commit 74891cf

Browse files
committed
Smaller documentation fixes + bump version to 0.3.9.2
1 parent 8284671 commit 74891cf

File tree

23 files changed

+209
-166
lines changed

23 files changed

+209
-166
lines changed

Text/Atom/Feed.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
--------------------------------------------------------------------
22
-- |
33
-- Module : Text.Atom.Feed
4-
-- Copyright : (c) Galois, Inc. 2008
4+
-- Copyright : (c) Galois, Inc. 2008,
5+
-- (c) Sigbjorn Finne 2009-
56
-- License : BSD3
67
--
7-
-- Maintainer: Sigbjorn Finne <sof@galois.com>
8+
-- Maintainer: Sigbjorn Finne <sof@forkIO.com>
89
-- Stability : provisional
9-
-- Portability:
10+
-- Portability: portable
1011
--
1112
--------------------------------------------------------------------
1213

@@ -253,7 +254,7 @@ nullSource = Source
253254
, sourceUpdated = Nothing
254255
, sourceOther = []
255256
}
256-
257+
257258
nullPerson :: Person
258259
nullPerson = Person
259260
{ personName = ""

Text/Atom/Feed/Export.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
--------------------------------------------------------------------
22
-- |
33
-- Module : Text.Atom.Feed.Export
4-
-- Copyright : (c) Galois, Inc. 2008
4+
-- Copyright : (c) Galois, Inc. 2008,
5+
-- (c) Sigbjorn Finne 2009-
56
-- License : BSD3
67
--
7-
-- Maintainer: Sigbjorn Finne <sof@galois.com>
8+
-- Maintainer: Sigbjorn Finne <sof@forkIO.com>
89
-- Stability : provisional
10+
-- Portability:: portable
911
-- Description: Convert from Atom to XML
1012
--
13+
-- Convert from Atom to XML
14+
--
1115
--------------------------------------------------------------------
1216

1317

Text/Atom/Feed/Import.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
--------------------------------------------------------------------
22
-- |
33
-- Module : Text.Atom.Feed.Import
4-
-- Copyright : (c) Galois, Inc. 2007-2008
4+
-- Copyright : (c) Galois, Inc. 2007-2008,
5+
-- (c) Sigbjorn Finne 2009-
56
-- License : BSD3
67
--
7-
-- Maintainer: Sigbjorn Finne <sof@galois.com>
8+
-- Maintainer: Sigbjorn Finne <sof@forkIO.com>
89
-- Stability : provisional
10+
-- Portability:: portable
911
-- Description: Convert from XML to Atom
1012
--
13+
-- Convert from XML to Atom
14+
--
1115
--------------------------------------------------------------------
1216

1317
module Text.Atom.Feed.Import where
@@ -214,7 +218,7 @@ pEntry e =
214218

215219
-- let's have them all (including xml:base and xml:lang + xmlns: stuff)
216220
known_attrs = []
217-
221+
218222
pContent :: XML.Element -> Maybe EntryContent
219223
pContent e =
220224
case pAttr "type" e of
@@ -247,7 +251,7 @@ pInReplyTo :: [XML.Element] -> Maybe InReplyTo
247251
pInReplyTo es = do
248252
t <- pQNode (atomThreadName "reply-to") es
249253
case pQAttr (atomThreadName "ref") t of
250-
Just ref ->
254+
Just ref ->
251255
return InReplyTo
252256
{ replyToRef = ref
253257
, replyToHRef = pQAttr (atomThreadName "href") t

Text/Atom/Feed/Link.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
--------------------------------------------------------------------
22
-- |
33
-- Module : Text.Atom.Feed.Link
4-
-- Copyright : (c) Galois, Inc. 2008
4+
-- Copyright : (c) Galois, Inc. 2008,
5+
-- (c) Sigbjorn Finne 2009-
56
-- License : BSD3
67
--
7-
-- Maintainer: Sigbjorn Finne <sof@galois.com>
8+
-- Maintainer: Sigbjorn Finne <sof@forkIO.com>
89
-- Stability : provisional
9-
-- Portability:
10+
-- Portability: portable
1011
--
1112
--------------------------------------------------------------------
1213

@@ -25,7 +26,7 @@ module Text.Atom.Feed.Link
2526
-- The Atom standard encourages that such typed links to
2627
-- be registered with IANA if they have wider applicability,
2728
-- and the 'LinkRelation' data type encodes the currently
28-
-- registered link types (derived from:
29+
-- registered link types (derived from:
2930
-- http:\/\/www.iana.org\/assignments\/link-relations.html
3031
-- on 2007-10-28]
3132
--
@@ -51,7 +52,7 @@ data LinkRelation -- relevant RFC:
5152
deriving (Eq, Show)
5253

5354
showLinkRelation :: LinkRelation -> String
54-
showLinkRelation lr =
55+
showLinkRelation lr =
5556
case lr of
5657
LinkAlternate -> "alternate"
5758
LinkCurrent -> "current"

Text/Atom/Feed/Validate.hs

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
--------------------------------------------------------------------
22
-- |
33
-- Module : Text.Atom.Feed.Validate
4-
-- Copyright : (c) Galois, Inc. 2008
4+
-- Copyright : (c) Galois, Inc. 2008,
5+
-- (c) Sigbjorn Finne 2009-
56
-- License : BSD3
67
--
7-
-- Maintainer: Sigbjorn Finne <sof@galois.com>
8+
-- Maintainer: Sigbjorn Finne <sof@forkIO.com>
89
-- Stability : provisional
9-
-- Portability:
10+
-- Portability: portable
1011
--
1112
--------------------------------------------------------------------
1213
module Text.Atom.Feed.Validate where
@@ -41,7 +42,7 @@ flattenT (VLeaf xs) = xs
4142
flattenT (VNode as bs) = as ++ concatMap flattenT bs
4243

4344
validateEntry :: Element -> ValidatorResult
44-
validateEntry e =
45+
validateEntry e =
4546
mkTree []
4647
[ checkEntryAuthor e
4748
, checkCats e
@@ -60,107 +61,107 @@ validateEntry e =
6061

6162
-- Sec 4.1.2, check #1
6263
checkEntryAuthor :: Element -> ValidatorResult
63-
checkEntryAuthor e =
64+
checkEntryAuthor e =
6465
case pNodes "author" (elChildren e) of
65-
[] -> -- required
66+
[] -> -- required
6667
case pNode "summary" (elChildren e) of
6768
Nothing -> demand "Required 'author' element missing (no 'summary' either)"
68-
Just e1 ->
69+
Just e1 ->
6970
case pNode "author" (elChildren e1) of
7071
Just a -> checkAuthor a
7172
_ -> demand "Required 'author' element missing"
7273
xs -> mkTree [] $ map checkAuthor xs
73-
74+
7475

7576
-- Sec 4.1.2, check #2
7677
checkCats :: Element -> ValidatorResult
7778
checkCats e = mkTree [] $ map checkCat (pNodes "category" (elChildren e))
7879

7980
checkContents :: Element -> ValidatorResult
80-
checkContents e =
81+
checkContents e =
8182
case pNodes "content" (elChildren e) of
8283
[] -> valid
8384
[c] -> mkTree [] $ [checkContent c]
8485
cs -> mkTree (flattenT (demand ("at most one 'content' element expected inside 'entry', found: " ++ show (length cs))))
8586
(map checkContent cs)
86-
87-
87+
88+
8889
checkContributor :: Element -> ValidatorResult
8990
checkContributor _e = valid
9091

9192
checkContentLink :: Element -> ValidatorResult
92-
checkContentLink e =
93+
checkContentLink e =
9394
case pNodes "content" (elChildren e) of
94-
[] ->
95+
[] ->
9596
case pNodes "link" (elChildren e) of
9697
[] -> demand ("An 'entry' element with no 'content' element must have at least one 'link-rel' element")
97-
xs ->
98+
xs ->
9899
case filter (=="alternate") $ mapMaybe (pAttr "rel") xs of
99100
[] -> demand ("An 'entry' element with no 'content' element must have at least one 'link-rel' element")
100101
_ -> valid
101102
_ -> valid
102103

103104
checkLinks :: Element -> ValidatorResult
104-
checkLinks e =
105+
checkLinks e =
105106
case pNodes "link" (elChildren e) of
106-
xs ->
107-
case map fst $ filter (\ (_,n) -> n =="alternate") $
107+
xs ->
108+
case map fst $ filter (\ (_,n) -> n =="alternate") $
108109
mapMaybe (\ ex -> fmap (\x -> (ex,x)) $ pAttr "rel" ex) xs of
109-
xs1 ->
110-
let
110+
xs1 ->
111+
let
111112
jmb (Just x) (Just y) = Just (x,y)
112113
jmb _ _ = Nothing
113114
in
114115
case mapMaybe (\ ex -> pAttr "type" ex `jmb` pAttr "hreflang" ex) xs1 of
115-
xs2 ->
116+
xs2 ->
116117
case any (\ x -> length x > 1) (group xs2) of
117118
True -> demand ("An 'entry' element cannot have duplicate 'link-rel-alternate-type-hreflang' elements")
118119
_ -> valid
119120

120121
checkId :: Element -> ValidatorResult
121-
checkId e =
122+
checkId e =
122123
case pNodes "id" (elChildren e) of
123124
[] -> demand "required field 'id' missing from 'entry' element"
124125
[_] -> valid
125126
xs -> demand ("only one 'id' field expected in 'entry' element, found: " ++ show (length xs))
126127

127128
checkPublished :: Element -> ValidatorResult
128-
checkPublished e =
129+
checkPublished e =
129130
case pNodes "published" (elChildren e) of
130131
[] -> valid
131132
[_] -> valid
132133
xs -> demand ("expected at most one 'published' field in 'entry' element, found: " ++ show (length xs))
133134

134135
checkRights :: Element -> ValidatorResult
135-
checkRights e =
136+
checkRights e =
136137
case pNodes "rights" (elChildren e) of
137138
[] -> valid
138139
[_] -> valid
139140
xs -> demand ("expected at most one 'rights' field in 'entry' element, found: " ++ show (length xs))
140141

141142
checkSource :: Element -> ValidatorResult
142-
checkSource e =
143+
checkSource e =
143144
case pNodes "source" (elChildren e) of
144145
[] -> valid
145146
[_] -> valid
146147
xs -> demand ("expected at most one 'source' field in 'entry' element, found: " ++ show (length xs))
147148

148149
checkSummary :: Element -> ValidatorResult
149-
checkSummary e =
150+
checkSummary e =
150151
case pNodes "summary" (elChildren e) of
151152
[] -> valid
152153
[_] -> valid
153154
xs -> demand ("expected at most one 'summary' field in 'entry' element, found: " ++ show (length xs))
154155

155156
checkTitle :: Element -> ValidatorResult
156-
checkTitle e =
157+
checkTitle e =
157158
case pNodes "title" (elChildren e) of
158159
[] -> demand "required field 'title' missing from 'entry' element"
159160
[_] -> valid
160161
xs -> demand ("only one 'title' field expected in 'entry' element, found: " ++ show (length xs))
161162

162163
checkUpdated :: Element -> ValidatorResult
163-
checkUpdated e =
164+
checkUpdated e =
164165
case pNodes "updated" (elChildren e) of
165166
[] -> demand "required field 'updated' missing from 'entry' element"
166167
[_] -> valid
@@ -173,7 +174,7 @@ checkCat e = mkTree []
173174
, checkLabel e
174175
]
175176
where
176-
checkScheme e' =
177+
checkScheme e' =
177178
case pAttrs "scheme" e' of
178179
[] -> valid
179180
(_:xs)
@@ -190,16 +191,16 @@ checkCat e = mkTree []
190191
checkContent :: Element -> ValidatorResult
191192
checkContent e = mkTree (flattenT (mkTree [] [type_valid, src_valid]))
192193
[case ty of
193-
"text" ->
194+
"text" ->
194195
case onlyElems (elContent e) of
195196
[] -> valid
196197
_ -> demand ("content with type 'text' cannot have child elements, text only.")
197-
"html" ->
198+
"html" ->
198199
case onlyElems (elContent e) of
199200
[] -> valid
200201
_ -> demand ("content with type 'html' cannot have child elements, text only.")
201202

202-
"xhtml" ->
203+
"xhtml" ->
203204
case onlyElems (elContent e) of
204205
[] -> valid
205206
[_] -> valid -- ToDo: check that it is a 'div'.
@@ -208,22 +209,22 @@ checkContent e = mkTree (flattenT (mkTree [] [type_valid, src_valid]))
208209
{-
209210
case parseMIMEType ty of
210211
Nothing -> valid
211-
Just mt
212+
Just mt
212213
| isXmlType mt -> valid
213-
| otherwise ->
214+
| otherwise ->
214215
case onlyElems (elContent e) of
215-
[] -> valid -- check
216+
[] -> valid -- check
216217
_ -> demand ("content with MIME type '" ++ ty ++ "' must only contain base64 data")]
217218
-}
218219
where
219-
types = pAttrs "type" e
220-
(ty, type_valid) =
220+
types = pAttrs "type" e
221+
(ty, type_valid) =
221222
case types of
222223
[] -> ("text", valid)
223224
[t] -> checkTypeA t
224225
(t:ts) -> (t, demand ("Expected at most one 'type' attribute, found: " ++ show (1+length ts)))
225226

226-
src_valid =
227+
src_valid =
227228
case pAttrs "src" e of
228229
[] -> valid
229230
[_] ->
@@ -244,7 +245,7 @@ checkContent e = mkTree (flattenT (mkTree [] [type_valid, src_valid]))
244245
{-
245246
case parseMIMEType v of
246247
Nothing -> ("text", demand ("Invalid/unknown type value " ++ v))
247-
Just mt ->
248+
Just mt ->
248249
case mimeType mt of
249250
Multipart{} -> ("text", demand "Multipart MIME types not a legal 'type'")
250251
_ -> (v, valid)
@@ -253,7 +254,7 @@ checkContent e = mkTree (flattenT (mkTree [] [type_valid, src_valid]))
253254
std_types = [ "text", "xhtml", "html"]
254255

255256
checkTerm :: Element -> ValidatorResult
256-
checkTerm e =
257+
checkTerm e =
257258
case pNodes "term" (elChildren e) of
258259
[] -> demand "required field 'term' missing from 'category' element"
259260
[_] -> valid
@@ -263,32 +264,32 @@ checkAuthor :: Element -> ValidatorResult
263264
checkAuthor e = checkPerson e
264265

265266
checkPerson :: Element -> ValidatorResult
266-
checkPerson e =
267+
checkPerson e =
267268
mkTree (flattenT $ checkName e)
268269
[ checkEmail e
269270
, checkUri e
270271
]
271-
272+
272273
checkName :: Element -> ValidatorResult
273-
checkName e =
274+
checkName e =
274275
case pNodes "name" (elChildren e) of
275276
[] -> demand "required field 'name' missing from 'author' element"
276277
[_] -> valid
277278
xs -> demand ("only one 'name' expected in 'author' element, found: " ++ show (length xs))
278-
279+
279280
checkEmail :: Element -> ValidatorResult
280-
checkEmail e =
281+
checkEmail e =
281282
case pNodes "email" (elChildren e) of
282283
[] -> valid
283-
(_:xs)
284+
(_:xs)
284285
| null xs -> valid
285286
| otherwise -> demand ("at most one 'email' expected in 'author' element, found: " ++ show (1+length xs))
286-
287+
287288
checkUri :: Element -> ValidatorResult
288-
checkUri e =
289+
checkUri e =
289290
case pNodes "email" (elChildren e) of
290291
[] -> valid
291-
(_:xs)
292+
(_:xs)
292293
| null xs -> valid
293294
| otherwise -> demand ("at most one 'uri' expected in 'author' element, found: " ++ show (1+length xs))
294295

0 commit comments

Comments
 (0)