mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-11 19:58:28 +01:00
Support ?style=plain on haddocks
This commit is contained in:
parent
950cb7ef6d
commit
eac18f4b1b
@ -50,12 +50,17 @@ getHaddockR slug rest
|
||||
addExtra t = [t]
|
||||
req <- parseRequest $ unpack $ makeURL slug rest
|
||||
(_, res) <- acquireResponse req >>= allocateAcquire
|
||||
doc <- responseBody res
|
||||
$$ eventConduit
|
||||
=$ concatMapC addExtra
|
||||
=$ mapC (Nothing, )
|
||||
=$ fromEvents
|
||||
sendResponse $ toHtml doc
|
||||
mstyle <- lookupGetParam "style"
|
||||
case mstyle of
|
||||
Just "plain" -> respondSource "text/html; charset=utf-8"
|
||||
$ responseBody res .| mapC (Chunk . toBuilder)
|
||||
_ -> do
|
||||
doc <- responseBody res
|
||||
$$ eventConduit
|
||||
=$ concatMapC addExtra
|
||||
=$ mapC (Nothing, )
|
||||
=$ fromEvents
|
||||
sendResponse $ toHtml doc
|
||||
| otherwise = redirect $ makeURL slug rest
|
||||
|
||||
redirectWithVersion
|
||||
|
||||
Loading…
Reference in New Issue
Block a user