= Redirection {
redirName :: !PageName
, redirDest :: !PageName
+ , redirIsLocked :: !Bool
, redirRevision :: RevNum
, redirLastMod :: UTCTime
, redirUpdateInfo :: Maybe UpdateInfo
, entityIsTheme :: !Bool -- text/css 以外では無意味
, entityIsFeed :: !Bool -- text/x-rakka 以外では無意味
, entityIsLocked :: !Bool
- , entityIsBoring :: !Bool
, entityIsBinary :: !Bool
, entityRevision :: RevNum
, entityLastMod :: UTCTime
isRedirect :: Page -> Bool
-isRedirect (Redirection _ _ _ _ _) = True
-isRedirect _ = False
+isRedirect (Redirection _ _ _ _ _ _) = True
+isRedirect _ = False
isEntity :: Page -> Bool
-isEntity (Entity _ _ _ _ _ _ _ _ _ _ _ _ _ _) = True
-isEntity _ = False
+isEntity (Entity _ _ _ _ _ _ _ _ _ _ _ _ _) = True
+isEntity _ = False
pageName :: Page -> PageName
-> none
)
+= sattr "isLocked" (yesOrNo $ entityIsLocked page)
- += sattr "isBoring" (yesOrNo $ entityIsBoring page)
+= sattr "isBinary" (yesOrNo $ entityIsBinary page)
+= sattr "revision" (show $ entityRevision page)
+= sattr "lastModified" (formatW3CDateTime lastMod)
= proc (name, tree)
-> do updateInfo <- maybeA parseUpdateInfo -< tree
redirect <- maybeA (getXPathTreesInDoc "/page/@redirect/text()" >>> getText) -< tree
+ isLocked <- (withDefault (getXPathTreesInDoc "/page/@isLocked/text()" >>> getText) "no"
+ >>> parseYesOrNo) -< tree
case redirect of
Nothing -> parseEntity -< (name, tree)
Just dest -> returnA -< (Redirection {
redirName = name
, redirDest = dest
+ , redirIsLocked = isLocked
, redirRevision = undefined
, redirLastMod = undefined
, redirUpdateInfo = updateInfo
>>> parseYesOrNo) -< tree
isLocked <- (withDefault (getXPathTreesInDoc "/page/@isLocked/text()" >>> getText) "no"
>>> parseYesOrNo) -< tree
- isBoring <- (withDefault (getXPathTreesInDoc "/page/@isBoring/text()" >>> getText) "no"
- >>> parseYesOrNo) -< tree
summary <- (maybeA (getXPathTreesInDoc "/page/summary/text()"
>>> getText
let (isBinary, content)
= case (textData, binaryData) of
(Just text, Nothing ) -> (False, L.pack $ UTF8.encode text )
- (Nothing , Just binary) -> (True , L.pack $ B64.decode binary)
+ (Nothing , Just binary) -> (True , L.pack $ fromJust $ B64.decode binary)
_ -> error "one of textData or binaryData is required"
mimeType
= if isBinary then
, entityIsTheme = isTheme
, entityIsFeed = isFeed
, entityIsLocked = isLocked
- , entityIsBoring = isBoring
, entityIsBinary = isBinary
, entityRevision = undefined
, entityLastMod = undefined