From 485a088a55dfebf9687a5a96fda6f083bdd9723f Mon Sep 17 00:00:00 2001 From: pho Date: Fri, 22 Feb 2008 22:34:47 +0900 Subject: [PATCH] /search.xml should contain lastMod darcs-hash:20080222133447-62b54-8f0aacc9290d9193c6dc051c6d68dc9c2ba965cf.gz --- Rakka/Resource/Search.hs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Rakka/Resource/Search.hs b/Rakka/Resource/Search.hs index 7c2acae..20f51c6 100644 --- a/Rakka/Resource/Search.hs +++ b/Rakka/Resource/Search.hs @@ -11,6 +11,7 @@ import Control.Arrow.ArrowList 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 @@ -19,6 +20,7 @@ import Rakka.Resource import Rakka.Storage import Rakka.SystemConfig import Rakka.Utils +import Rakka.W3CDateTime import Rakka.Wiki.Engine import System.FilePath import Text.HyperEstraier hiding (getText) @@ -55,7 +57,7 @@ maxSectionWindowSize = 10 to="5" total="5"> - + aaa foo bbb @@ -101,22 +103,29 @@ handleSearch env 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 -- 2.40.0