import Data.Map (Map)
import qualified Data.Map as M
+import Data.Maybe
import Rakka.Page
import Rakka.SystemConfig
import Rakka.Wiki
, spanInterp
, divInterp
, pageNameInterp
--- , otherLangsInterp
+ , otherLangsInterp
]
= \ ctx _ -> return $ Text (ctxPageName ctx)
}
-{-
+
otherLangsInterp :: Interpreter
otherLangsInterp
= BlockCommandInterpreter {
-> 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