diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-08-09 10:24:48 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-08-09 10:24:48 -0700 |
| commit | 59ac2933c9878e1dfdb3fa14fbccf8d316d1d2a0 (patch) | |
| tree | ae601969e3018004a0e458cca67a9207b1290704 /server | |
| parent | 30074c12e5606fdd3cd545a807c3a4de99352073 (diff) | |
server - have /babelmark accept form params rather than JSON.
Diffstat (limited to 'server')
| -rw-r--r-- | server/PandocServer.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/PandocServer.hs b/server/PandocServer.hs index 7d4a7fc44..9cdc93962 100644 --- a/server/PandocServer.hs +++ b/server/PandocServer.hs @@ -48,7 +48,7 @@ type API = :<|> "batch" :> ReqBody '[JSON] [Params] :> Post '[JSON] [Text] :<|> - "babelmark" :> ReqBody '[JSON] Params :> Get '[JSON] Value + "babelmark" :> QueryParam "text" Text :> QueryParam "from" Text :> QueryParam "to" Text :> QueryFlag "standalone" :> Get '[JSON] Value :<|> "version" :> Get '[PlainText, JSON] Text @@ -64,8 +64,11 @@ server = convert :<|> babelmark -- for babelmark which expects {"html": "", "version": ""} :<|> pure pandocVersion where - babelmark params = do - res <- convert params + babelmark text' from' to' standalone' = do + res <- convert Params{ text = fromMaybe mempty text', + from = from', to = to', + standalone = Just standalone', wrapText = Nothing, + columns = Nothing, template = Nothing } return $ toJSON $ object [ "html" .= res, "version" .= pandocVersion ] -- We use runPure for the pandoc conversions, which ensures that |
