X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Rakka.git;a=blobdiff_plain;f=Rakka%2FWiki%2FEngine.hs;h=7c4487a3ed178e20518c821861258ba2bae59c19;hp=3b9c6e9f1b0b6ab1bb02f4f286e426dbb41accff;hb=9681bedbfde02fa1bcda4fbbacba941378c7a57a;hpb=f6b697ef834373aab21e3fab64cd3d9f23ae6ab9 diff --git a/Rakka/Wiki/Engine.hs b/Rakka/Wiki/Engine.hs index 3b9c6e9..7c4487a 100644 --- a/Rakka/Wiki/Engine.hs +++ b/Rakka/Wiki/Engine.hs @@ -7,23 +7,18 @@ module Rakka.Wiki.Engine ) where -import qualified Codec.Binary.Base64 as B64 -import Codec.Binary.UTF8.String import Control.Arrow import Control.Arrow.ArrowIO import Control.Arrow.ArrowList -import qualified Data.ByteString.Lazy as L import Data.Map (Map) import qualified Data.Map as M import Data.Maybe -import Data.Time import Network.HTTP.Lucu import Network.URI import Rakka.Page import Rakka.Storage import Rakka.SystemConfig import Rakka.Utils -import Rakka.W3CDateTime import Rakka.Wiki import Rakka.Wiki.Parser import Rakka.Wiki.Formatter @@ -38,89 +33,6 @@ import Text.XML.HXT.DOM.TypeDefs type InterpTable = Map String Interpreter -{- - -- デフォルトでない場合のみ存在 - lastModified="2000-01-01T00:00:00"> - - - blah blah... - -- 存在しない場合もある - - -- 存在しない場合もある - - - - - - blah blah... - - - SKJaHKS8JK/DH8KS43JDK2aKKaSFLLS... - - --} -xmlizePage :: (ArrowXml a, ArrowChoice a, ArrowIO a) => a Page XmlTree -xmlizePage - = proc page - -> do lastMod <- arrIO (utcToLocalZonedTime . pageLastMod) -< page - ( eelem "/" - += ( eelem "page" - += sattr "name" (pageName page) - += sattr "type" (show $ pageType page) - += ( case pageLanguage page of - Just x -> sattr "lang" x - Nothing -> none - ) - += ( case pageFileName page of - Just x -> sattr "fileName" x - Nothing -> none - ) - += ( case pageType page of - MIMEType "text" "css" _ - -> sattr "isTheme" (yesOrNo $ pageIsTheme page) - MIMEType "text" "x-rakka" _ - -> sattr "isFeed" (yesOrNo $ pageIsFeed page) - _ - -> none - ) - += sattr "isLocked" (yesOrNo $ pageIsLocked page) - += sattr "isBoring" (yesOrNo $ pageIsBoring page) - += sattr "isBinary" (yesOrNo $ pageIsBinary page) - += sattr "revision" (show $ pageRevision page) - += sattr "lastModified" (formatW3CDateTime lastMod) - += ( case pageSummary page of - Just s -> eelem "summary" += txt s - Nothing -> none - ) - += ( if M.null (pageOtherLang page) then - none - else - selem "otherLang" - [ eelem "link" - += sattr "lang" lang - += sattr "page" name - | (lang, name) <- M.toList (pageOtherLang page) ] - ) - += ( if pageIsBinary page then - ( eelem "binaryData" - += txt (B64.encode $ L.unpack $ pageContent page) - ) - else - ( eelem "textData" - += txt (decode $ L.unpack $ pageContent page) - ) - ) - )) -<< () - - wikifyPage :: (ArrowXml a, ArrowChoice a) => InterpTable -> a XmlTree WikiPage wikifyPage interpTable = proc tree