diff options
author | Yuchen Pei <hi@ypei.me> | 2022-09-14 13:02:00 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-09-14 13:02:00 +1000 |
commit | 5893a125ff90b51b40cc8375a2a4acf629da8935 (patch) | |
tree | 4fd82fa4a8e46b28683b47638c9f31db2063974f /app | |
parent | 1e8e3d5988d7d8f141e74ffd16ca45a1e576848a (diff) |
[server] Handle templates for headers and refs
Diffstat (limited to 'app')
-rw-r--r-- | app/Main.hs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/Main.hs b/app/Main.hs index 6ddae49..579ec20 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -65,7 +65,7 @@ import Options.Applicative ( Parser ) import Prelude hiding ( takeWhile ) import Servall.Types -import Servall.WikiParser ( parseWikiTemplates +import Servall.WikiParser ( infobox , wikiFilter ) import Servant ( (:<|>)(..) @@ -183,14 +183,7 @@ getWpSummaryFull name = fmap (TE.decodeUtf8 . BSL.toStrict) (liftIO $ getApiWpSummary name) getInfobox :: Text -> Handler (HM.HashMap Text Text) -getInfobox name = do - wiki <- getWikiFormat name - return $ maybe - HM.empty - wtFields - (find (\(WikiTemplate name _) -> name == "Infobox") - (fromRight [] (parseWikiTemplates wiki)) - ) +getInfobox name = infobox <$> getWikiFormat name searchYt :: Text -> Handler [Video] searchYt query = do |