From bf5edd9f02510a710bd888bb44e146f3c59995a5 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Sun, 7 Aug 2022 12:51:36 -0700
Subject: [PATCH] pandoc-cgi - add multidingus endpoint.

This is what babelmark expects.
---
 pandoc-cgi/PandocCGI.hs | 7 +++++++
 1 file changed, 7 insertions(+)

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.