diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-08-07 12:51:36 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-08-07 12:51:36 -0700 |
| commit | bf5edd9f02510a710bd888bb44e146f3c59995a5 (patch) | |
| tree | e0f8c295ed923b17fad8c5045298c94d0b8951c7 | |
| parent | 87391feb02cf25416851017464b94087e8da85aa (diff) | |
pandoc-cgi - add multidingus endpoint.
This is what babelmark expects.
| -rw-r--r-- | pandoc-cgi/PandocCGI.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pandoc-cgi/PandocCGI.hs b/pandoc-cgi/PandocCGI.hs index 11a3af0bb..971d000e4 100644 --- a/pandoc-cgi/PandocCGI.hs +++ b/pandoc-cgi/PandocCGI.hs @@ -43,6 +43,8 @@ $(deriveJSON defaultOptions ''Params) type API = "convert" :> ReqBody '[JSON] Params :> Post '[PlainText, JSON] Text :<|> + "multidingus" :> ReqBody '[JSON] Params :> Post '[JSON] Value + :<|> "convert-batch" :> ReqBody '[JSON] [Params] :> Post '[JSON] [Text] :<|> "version" :> Get '[PlainText, JSON] Text @@ -55,9 +57,14 @@ api = Proxy server :: Server API server = convert + :<|> multidingus -- for babelmark :<|> mapM convert :<|> pure pandocVersion where + multidingus params = do + res <- convert params + return $ toJSON $ object [ "html" .= res, "version" .= pandocVersion ] + -- We use runPure for the pandoc conversions, which ensures that -- they will do no IO. This makes the server safe to use. However, -- it will mean that features requiring IO, like RST includes, will not work. |
