mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-20 16:01:55 +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]
|
addExtra t = [t]
|
||||||
req <- parseRequest $ unpack $ makeURL slug rest
|
req <- parseRequest $ unpack $ makeURL slug rest
|
||||||
(_, res) <- acquireResponse req >>= allocateAcquire
|
(_, res) <- acquireResponse req >>= allocateAcquire
|
||||||
doc <- responseBody res
|
mstyle <- lookupGetParam "style"
|
||||||
$$ eventConduit
|
case mstyle of
|
||||||
=$ concatMapC addExtra
|
Just "plain" -> respondSource "text/html; charset=utf-8"
|
||||||
=$ mapC (Nothing, )
|
$ responseBody res .| mapC (Chunk . toBuilder)
|
||||||
=$ fromEvents
|
_ -> do
|
||||||
sendResponse $ toHtml doc
|
doc <- responseBody res
|
||||||
|
$$ eventConduit
|
||||||
|
=$ concatMapC addExtra
|
||||||
|
=$ mapC (Nothing, )
|
||||||
|
=$ fromEvents
|
||||||
|
sendResponse $ toHtml doc
|
||||||
| otherwise = redirect $ makeURL slug rest
|
| otherwise = redirect $ makeURL slug rest
|
||||||
|
|
||||||
redirectWithVersion
|
redirectWithVersion
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user