X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FPage.hs;h=6d3dff0bdb927ff15c863fd165ed49197b10dc4d;hb=396dbf64bef1796e9aaee706bc5ec4f1bcf06783;hp=2785a201df626f216f27d309b88a3d46115902b3;hpb=b444493e17ad49d60464bb5cf02898bd9198af3c;p=Rakka.git diff --git a/Rakka/Page.hs b/Rakka/Page.hs index 2785a20..6d3dff0 100644 --- a/Rakka/Page.hs +++ b/Rakka/Page.hs @@ -20,6 +20,7 @@ module Rakka.Page , mkObjectURI , mkFragmentURI , mkAuxiliaryURI + , mkRDFURI , mkRakkaURI , xmlizePage @@ -181,6 +182,13 @@ mkAuxiliaryURI baseURI basePath name } +mkRDFURI :: URI -> PageName -> URI +mkRDFURI baseURI name + = baseURI { + uriPath = foldl () "/" [uriPath baseURI, encodePageName name ++ ".rdf"] + } + + mkRakkaURI :: PageName -> URI mkRakkaURI name = URI { uriScheme = "rakka:" @@ -240,6 +248,7 @@ xmlizePage += ( eelem "page" += sattr "name" (redirName page) += sattr "redirect" (redirDest page) + += sattr "isLocked" (yesOrNo $ redirIsLocked page) += sattr "revision" (show $ redirRevision page) += sattr "lastModified" (formatW3CDateTime lastMod) )) -<< () @@ -344,7 +353,7 @@ parseEntity let (isBinary, content) = case (textData, binaryData) of (Just text, Nothing ) -> (False, L.pack $ UTF8.encode text ) - (Nothing , Just binary) -> (True , L.pack $ fromJust $ B64.decode binary) + (Nothing , Just binary) -> (True , L.pack $ fromJust $ B64.decode $ dropWhitespace binary) _ -> error "one of textData or binaryData is required" mimeType = if isBinary then @@ -370,6 +379,14 @@ parseEntity , entityContent = content , entityUpdateInfo = updateInfo } + where + dropWhitespace :: String -> String + dropWhitespace [] = [] + dropWhitespace (x:xs) + | x == ' ' || x == '\t' || x == '\n' + = dropWhitespace xs + | otherwise + = x : dropWhitespace xs parseUpdateInfo :: (ArrowXml a, ArrowChoice a) => a XmlTree UpdateInfo