summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2022-08-07 19:31:00 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2022-08-07 19:31:40 -0700
commit6b9da0cc96fe975bfb1ebdff6536385a349e7973 (patch)
treebd30dde18d156c1c17920aaea2aa884bc0085261
parent18484cbf47feb2ffa2d08db0f30107dcfdcf31f8 (diff)
pandoc-cgi:
Remove /batch endpoint; instead, behave differently if passed an array of JSON objects. Rename multidingus endpoint to babelmark.
-rw-r--r--pandoc-cgi/PandocCGI.hs10
-rw-r--r--trypandoc/index.html2
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)