From 6b9da0cc96fe975bfb1ebdff6536385a349e7973 Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Sun, 7 Aug 2022 19:31:00 -0700 Subject: [PATCH] pandoc-cgi: Remove /batch endpoint; instead, behave differently if passed an array of JSON objects. Rename multidingus endpoint to babelmark. --- pandoc-cgi/PandocCGI.hs | 10 +++++----- trypandoc/index.html | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pandoc-cgi/PandocCGI.hs b/pandoc-cgi/PandocCGI.hs index 971d000e4..9cecabfb2 100644 --- a/pandoc-cgi/PandocCGI.hs +++ b/pandoc-cgi/PandocCGI.hs @@ -41,11 +41,11 @@ $(deriveJSON defaultOptions ''Params) -- Get requests with either plain text or JSON, depending on the -- Accept header. type API = - "convert" :> ReqBody '[JSON] Params :> Post '[PlainText, JSON] Text + ReqBody '[JSON] Params :> Post '[PlainText, JSON] Text :<|> - "multidingus" :> ReqBody '[JSON] Params :> Post '[JSON] Value + ReqBody '[JSON] [Params] :> Post '[JSON] [Text] :<|> - "convert-batch" :> ReqBody '[JSON] [Params] :> Post '[JSON] [Text] + "babelmark" :> ReqBody '[JSON] Params :> Post '[JSON] Value :<|> "version" :> Get '[PlainText, JSON] Text @@ -57,11 +57,11 @@ api = Proxy server :: Server API server = convert - :<|> multidingus -- for babelmark :<|> mapM convert + :<|> babelmark -- for babelmark which expects {"html": "", "version": ""} :<|> pure pandocVersion where - multidingus params = do + babelmark params = do res <- convert params return $ toJSON $ object [ "html" .= res, "version" .= pandocVersion ] diff --git a/trypandoc/index.html b/trypandoc/index.html index 960b6cffa..846b51515 100644 --- a/trypandoc/index.html +++ b/trypandoc/index.html @@ -167,7 +167,7 @@ function newpage() { let params = { from: from, to: to, text: text, standalone: standalone }; // console.log(JSON.stringify(params)); - fetch("/cgi-bin/pandoc-cgi/convert", { + fetch("/cgi-bin/pandoc-cgi", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify(params)