import Control.Arrow.ArrowTree
import Control.Monad.Trans
import Data.Maybe
+import Data.Time
import Network.HTTP.Lucu
import Network.URI hiding (query, fragment)
import Rakka.Environment
import Rakka.Storage
import Rakka.SystemConfig
import Rakka.Utils
+import Rakka.W3CDateTime
import Rakka.Wiki.Engine
import System.FilePath
import Text.HyperEstraier hiding (getText)
to="5"
total="5">
- <page name="Page/1">
+ <page name="Page/1" lastModified="2000-01-01T00:00:00">
aaa <hit>foo</hit> bbb
</page>
setMax cond (to - from)
return cond
- mkPageElem :: ArrowXml a => a HitPage XmlTree
+ mkPageElem :: (ArrowChoice a, ArrowXml a, ArrowIO a) => a HitPage XmlTree
mkPageElem = ( eelem "page"
+= attr "name" (arr hpPageName >>> mkText)
+ += attr "lastModified" ( arrIO (utcToLocalZonedTime . hpLastMod)
+ >>>
+ arr formatW3CDateTime
+ >>>
+ mkText
+ )
+= ( arrL hpSnippet
>>>
mkSnippetTree
)
)
- mkSnippetTree :: ArrowXml a => a SnippetFragment XmlTree
+ mkSnippetTree :: (ArrowChoice a, ArrowXml a) => a SnippetFragment XmlTree
mkSnippetTree = proc fragment
-> case fragment of
- Boundary -> eelem "boundary"
- NormalText t -> txt t
- HighlightedWord w -> eelem "hit" += txt w
- -<< ()
+ Boundary -> eelem "boundary" -< ()
+ NormalText t -> mkText -< t
+ HighlightedWord w -> ( eelem "hit"
+ += mkText
+ ) -< w
searchResultToXHTML :: (ArrowXml a, ArrowChoice a, ArrowIO a) => Environment -> a XmlTree XmlTree