When reading defaults file, stop at a line ....

This line signals the end of a YAML document.
This restores the behavior we got with HsYaml.
yaml complains about content past this line.
See https://github.com/jgm/pandoc/issues/4627#issuecomment-1012438765
This commit is contained in:
John MacFarlane 2022-01-13 11:58:33 -08:00
parent 09b773e1ad
commit 0d1ba3dce3

View file

@ -52,6 +52,7 @@ import Data.Text (Text, unpack)
import Data.Default (def)
import qualified Data.Text as T
import qualified Data.Map as M
import qualified Data.ByteString.Char8 as B8
import Text.Pandoc.Definition (Meta(..), MetaValue(..))
import Data.Aeson (defaultOptions, Options(..), Result(..), fromJSON, camelTo2)
import Data.Aeson.TH (deriveJSON)
@ -692,7 +693,7 @@ applyDefaults opt file = do
setVerbosity $ optVerbosity opt
modify $ \defsState -> defsState{ curDefaults = Just file }
inp <- readFileStrict file
case decodeEither' inp of
case decodeEither' (B8.unlines . takeWhile (/= "...") . B8.lines $ inp) of
Right f -> f opt
Left err' -> throwError $
PandocParseError