From: pho Date: Thu, 25 Oct 2007 02:35:10 +0000 (+0900) Subject: Implemented X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=8d43862784caf5fc187c948c89e7ef58551f5642;p=Rakka.git Implemented darcs-hash:20071025023510-62b54-1b0bf8d9916e3bc5b96afd6cefed891bd0225f0e.gz --- diff --git a/Rakka/SystemConfig.hs b/Rakka/SystemConfig.hs index 9e8be67..de33f91 100644 --- a/Rakka/SystemConfig.hs +++ b/Rakka/SystemConfig.hs @@ -156,7 +156,7 @@ instance SysConfValue BaseURI where PortNumber num -> fromIntegral num defaultURI - = "http://" ++ host ++ + = "http://" ++ host ++ -- FIXME: consider IPv6 address (if port == 80 then "" else ':' : show port) ++ "/" diff --git a/Rakka/Wiki/Interpreter/Base.hs b/Rakka/Wiki/Interpreter/Base.hs index 3d38c2c..d36b80d 100644 --- a/Rakka/Wiki/Interpreter/Base.hs +++ b/Rakka/Wiki/Interpreter/Base.hs @@ -5,6 +5,7 @@ module Rakka.Wiki.Interpreter.Base import Data.Map (Map) import qualified Data.Map as M +import Data.Maybe import Rakka.Page import Rakka.SystemConfig import Rakka.Wiki @@ -16,7 +17,7 @@ interpreters = [ lineBreakInterp , spanInterp , divInterp , pageNameInterp --- , otherLangsInterp + , otherLangsInterp ] @@ -51,7 +52,7 @@ pageNameInterp = InlineCommandInterpreter { = \ ctx _ -> return $ Text (ctxPageName ctx) } -{- + otherLangsInterp :: Interpreter otherLangsInterp = BlockCommandInterpreter { @@ -63,14 +64,23 @@ otherLangsInterp -> return EmptyBlock Just linkTable - -> do Languages langTable <- getSysConf (ctxSysConf ctx) (Languages undefined) + -> do Languages langTable <- getSysConf (ctxSysConf ctx) let merged = mergeTables langTable (M.toList linkTable) - -- FIXME + return $ List $ mkLangList merged } where mergeTables :: Map LanguageTag LanguageName -> [(LanguageTag, PageName)] -> [(LanguageName, PageName)] mergeTables _ [] = [] - mergeTables m (x:xs) = fromMaybe x (M.lookup x m) : mergeTables m xs --} \ No newline at end of file + mergeTables m (x:xs) = let (langTag, pageName) = x + langName = fromMaybe langTag (M.lookup langTag m) + in + (langName, pageName) : mergeTables m xs + + mkLangList :: [(LanguageName, PageName)] -> ListElement + mkLangList xs = ListElement Bullet (map mkLangLink xs) + + mkLangLink :: (LanguageName, PageName) -> ListItem + mkLangLink (langName, pageName) + = [Right (PageLink (Just pageName) Nothing (Just langName))] \ No newline at end of file