diff options
| author | John MacFarlane <[email protected]> | 2022-01-13 11:58:33 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-01-13 11:58:33 -0800 |
| commit | 0d1ba3dce33b8d5d30d7cf8febfa8ea3060b5dfd (patch) | |
| tree | 2e9ad9fd73a8f1b5ef2d94283a96bedc793b75b1 | |
| parent | 09b773e1ad2dc78156c3fcbdca76ba44759e1504 (diff) | |
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
| -rw-r--r-- | src/Text/Pandoc/App/Opt.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index e1d9edcc9..4f5474c4f 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -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 |
