Server: support tabStop, indentedCodeClasses

This commit is contained in:
John MacFarlane 2022-08-13 23:16:47 -07:00
parent 6274327398
commit 2f5c75132a

View file

@ -35,6 +35,8 @@ data Params = Params
, columns :: Maybe Int , columns :: Maybe Int
, standalone :: Maybe Bool , standalone :: Maybe Bool
, template :: Maybe Text , template :: Maybe Text
, tabStop :: Maybe Int
, indentedCodeClasses :: Maybe [Text]
} deriving (Show) } deriving (Show)
instance Default Params where instance Default Params where
@ -46,6 +48,8 @@ instance Default Params where
, columns = Nothing , columns = Nothing
, standalone = Nothing , standalone = Nothing
, template = Nothing , template = Nothing
, tabStop = Nothing
, indentedCodeClasses = Nothing
} }
-- Automatically derive code to convert to/from JSON. -- Automatically derive code to convert to/from JSON.
@ -110,6 +114,9 @@ server = convert
else return Nothing else return Nothing
let readeropts = def{ readerExtensions = readerExts let readeropts = def{ readerExtensions = readerExts
, readerStandalone = isStandalone , readerStandalone = isStandalone
, readerTabStop = fromMaybe 4 (tabStop params)
, readerIndentedCodeClasses = fromMaybe []
(indentedCodeClasses params)
} }
let writeropts = def{ writerExtensions = writerExts let writeropts = def{ writerExtensions = writerExts
, writerWrapText = fromMaybe WrapAuto (wrapText params) , writerWrapText = fromMaybe WrapAuto (wrapText params)