packages feed

dixi 0.5.0.0 → 0.5.1.0

raw patch · 3 files changed

+27/−27 lines, 3 filesdep +timezone-olsondep +timezone-seriesdep −tzdep ~eitherdep ~lensdep ~transformers

Dependencies added: timezone-olson, timezone-series

Dependencies removed: tz

Dependency ranges changed: either, lens, transformers, warp

Files

Dixi/Config.hs view
@@ -11,16 +11,15 @@ import Control.Monad ((<=<)) import Data.Aeson import Data.Default-import Data.Maybe (fromMaybe, catMaybes)+import Data.Maybe (catMaybes) import Data.Monoid (Last (..), Monoid (..)) import Data.Time (UTCTime, formatTime) import Data.Time.Locale.Compat-import Data.Time.Zones.All (toTZName, fromTZName, tzByLabel, TZLabel (..))-import Data.Time.Zones (utcToLocalTimeTZ)+import Data.Time.LocalTime.TimeZone.Olson+import Data.Time.LocalTime.TimeZone.Series import GHC.Generics import Text.Pandoc hiding (Format, readers) import Text.Pandoc.Error-import qualified Data.ByteString.Char8 as B  import Dixi.Pandoc.Wikilinks @@ -63,7 +62,7 @@  defaultConfig :: Config defaultConfig = Config 8000 "state"-                       (TimeConfig (B.unpack $ toTZName Etc__UTC) "%T, %F")+                       (TimeConfig "Etc/UTC" "%T, %F")                        (Format "org")                        ("http://localhost:8000")                        ["wikilinks"]@@ -91,15 +90,16 @@               = [("wikilinks", EndoIO $ wikilinks url)                 ] -configToRenders :: Config -> Renders-configToRenders cfg@(Config {..}) = Renders {..}-  where renderTime (Last Nothing) = "(never)"-        renderTime (Last (Just t)) = let label = fromMaybe Etc__UTC (fromTZName $ B.pack $ timezone time)-                                      in formatTime defaultTimeLocale (format time) $ utcToLocalTimeTZ (tzByLabel label) t-        pandocReader | Format f <- readerFormat -          = case lookup f readers of-              Just r -> r-              Nothing -> readOrg-        pandocWriterOptions = def { writerSourceURL = Just url }+configToRenders :: Config -> IO Renders+configToRenders cfg@(Config {..}) = do+  olsonData <- getTimeZoneSeriesFromOlsonFile ("/usr/share/zoneinfo/" ++ timezone time)+  let renderTime (Last Nothing) = "(never)"+      renderTime (Last (Just t)) = formatTime defaultTimeLocale (format time) $ utcToLocalTime' olsonData t+      pandocReader | Format f <- readerFormat +        = case lookup f readers of+            Just r -> r+            Nothing -> readOrg+      pandocWriterOptions = def { writerSourceURL = Just url } -        pandocProcessors = mconcat $ catMaybes $ map (flip lookup $ allProcessors cfg) processors+      pandocProcessors = mconcat $ catMaybes $ map (flip lookup $ allProcessors cfg) processors+  return $ Renders {..}
Main.hs view
@@ -40,8 +40,8 @@ spacesToUScores :: T.Text -> T.Text spacesToUScores = T.pack . map (\x -> if x == ' ' then '_' else x) . T.unpack -page :: AcidState Database -> Config -> Key -> Server PageAPI-page db cfg (spacesToUScores -> key)+page :: AcidState Database -> Renders -> Key -> Server PageAPI+page db renders (spacesToUScores -> key)   =  latest   |: history   where@@ -77,9 +77,8 @@      rp k v p = return (RP renders k v p) -    renders = configToRenders cfg -server :: AcidState Database -> Config -> Server Dixi+server :: AcidState Database -> Renders -> Server Dixi server db cfg =  page db cfg               |: page db cfg "Main_Page" @@ -109,4 +108,4 @@      db <- openLocalStateFrom storage emptyDB      createCheckpoint db      createArchive    db-     run port $ serve dixi $ server db cfg+     run port . serve dixi . server db =<< configToRenders cfg
dixi.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/  name:                dixi-version:             0.5.0.0+version:             0.5.1.0 synopsis:            A wiki implemented with a firm theoretical foundation. description:         This project is a simple wiki developed based on a                      firm theoretical foundation.@@ -54,24 +54,25 @@                      , pandoc >= 1.15 &&  < 1.16 , pandoc-types >= 1.12 && < 1.13                      , servant >= 0.4 && < 0.5                      , acid-state >= 0.12 && <0.14 , safecopy >= 0.8.3 && < 0.9-                     , lens >= 4.12 && < 4.14, servant-server >= 0.4 && < 0.5+                     , lens >= 4.7 && < 4.14, servant-server >= 0.4 && < 0.5                      , blaze-html >= 0.8 && < 0.9 , servant-blaze >= 0.4 && < 0.5, blaze-markup >= 0.7 && <0.8                      , shakespeare >= 2.0 && < 2.1                      , containers >= 0.5 && < 0.6 , text >= 1.2 && < 1.3                      , vector >= 0.10 && <0.12-                     , transformers >= 0.4 && < 0.5-                     , warp >= 3.1 && <3.2+                     , transformers >= 0.3 && < 0.5+                     , warp >= 3.0 && <3.2                      , data-default >= 0.5 && <0.6-                     , either >= 4.4 && <4.5+                     , either >= 4.3 && <4.5                      , template-haskell                      , yaml >= 0.8 && < 0.9                      , aeson >= 0.8 && <  0.11                      , directory >= 1.0 && < 1.3                      , time >= 1.4 && < 1.6                      , time-locale-compat >= 0.1 && < 0.2-                     , tz >= 0.0 && < 0.1                      , bytestring >= 0.10 && < 0.11                      , network-uri >= 2.6 && < 2.7 +                     , timezone-olson >= 0.1 && < 0.2+                     , timezone-series >= 0.1 && < 0.2    -- hs-source-dirs:         default-language:    Haskell2010