diff options
Diffstat (limited to 'server')
| -rw-r--r-- | server/PandocServer.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/PandocServer.hs b/server/PandocServer.hs index 2c0ecf997..1a7520e27 100644 --- a/server/PandocServer.hs +++ b/server/PandocServer.hs @@ -13,6 +13,7 @@ import Data.Aeson.TH import Network.Wai import Servant import Text.Pandoc +import Text.Pandoc.Citeproc (processCitations) import qualified Text.Pandoc.UTF8 as UTF8 import Data.Text (Text) import qualified Data.Text as T @@ -53,6 +54,7 @@ data Params = Params , defaultImageExtension :: Maybe Text , trackChanges :: Maybe TrackChanges , stripComments :: Maybe Bool + , citeproc :: Maybe Bool } deriving (Show) instance Default Params where @@ -71,6 +73,7 @@ instance Default Params where , defaultImageExtension = Nothing , trackChanges = Nothing , stripComments = Nothing + , citeproc = Nothing } -- Automatically derive code to convert to/from JSON. @@ -163,7 +166,11 @@ server = convert let writer = case writerSpec of TextWriter w -> w writeropts ByteStringWriter w -> fmap (encodeBase64 . toStrict) . w writeropts - reader (text params) >>= writer + reader (text params) >>= + (if citeproc params == Just True + then processCitations + else return) >>= + writer handleErr (Right t) = return t handleErr (Left err) = throwError $ |
