diff options
author | defanor <defanor@uberspace.net> | 2017-10-29 22:46:39 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-10-29 22:49:29 +0300 |
commit | 08c21993a7f773deb26be91c99f0e12ee3d5f54a (patch) | |
tree | daca024f12f32253246bb0207c6a8cb73403096c /Pancake.hs | |
parent | c06df3b88296b30d09cfdfcdba3998da5bd5d064 (diff) |
Default to HTML on HTTP
Diffstat (limited to 'Pancake.hs')
-rw-r--r-- | Pancake.hs | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -115,10 +115,8 @@ readDoc cmd uri = do let reader = case (uriScheme uri, map toLower $ takeExtension $ uriPath uri) of -- some exceptions and special cases (might be better to make -- this configurable) - ("http:", ".php") -> html - ("https:", ".php") -> html - ("http:", "") -> html - ("https:", "") -> html + ("http:", ext) -> http ext + ("https:", ext) -> http ext ("gopher:", ext) -> case uriPath uri of ('/':'1':_) -> gopher ('/':'h':_) -> html @@ -148,6 +146,7 @@ readDoc cmd uri = do Left err -> putErrLn (show err) >> pure Nothing Right (doc, _) -> pure $ pure doc where + http ext = byExtension ext <|> html html = P.getReader "html" plain = pure . P.StringReader . const $ pure . readPlain gopher = pure . P.StringReader . const $ pure . readGopher |