diff options
| author | John MacFarlane <[email protected]> | 2021-03-11 15:49:27 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2021-03-13 15:05:37 -0800 |
| commit | 8be95ad8e5150d5cab66c4abdf59baaf4670c6c8 (patch) | |
| tree | 9655036efbaabda6a2a7802dc971c7fba5a987ca /src/Text/Pandoc/Readers/DocBook.hs | |
| parent | 35b66a76718205c303f416bf0afc01c098e8a171 (diff) | |
Use custom Prelude based on relude.relude
The Prelude now longer exports partial functions, so
a large number of uses of these functions in the
code base have been rewritten.
A .ghci file has been added; this is necessary for
ghci to work properly with the custom Prelude.
Currently there are lots of compiler warnings.
We should either fix these or go to using a custom
Prelude that changes less than relude.
Diffstat (limited to 'src/Text/Pandoc/Readers/DocBook.hs')
| -rw-r--r-- | src/Text/Pandoc/Readers/DocBook.hs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs index d38b07864..bf538e807 100644 --- a/src/Text/Pandoc/Readers/DocBook.hs +++ b/src/Text/Pandoc/Readers/DocBook.hs @@ -25,8 +25,8 @@ import qualified Data.Text.Lazy as TL import Control.Monad.Except (throwError) import Text.HTML.TagSoup.Entity (lookupEntity) import Text.Pandoc.Error (PandocError(..)) -import Text.Pandoc.Builder -import Text.Pandoc.Class.PandocMonad (PandocMonad, report) +import Text.Pandoc.Builder as B +import Text.Pandoc.Class as P (PandocMonad, report) import Text.Pandoc.Options import Text.Pandoc.Logging (LogMessage(..)) import Text.Pandoc.Shared (crFilter, safeRead, extractSpaces) @@ -544,7 +544,7 @@ readDocBook _ inp = do parseXMLContents (TL.fromStrict . handleInstructions $ crFilter inp) (bs, st') <- flip runStateT (def{ dbContent = tree }) $ mapM parseBlock tree - return $ Pandoc (dbMeta st') (toList . mconcat $ bs) + return $ Pandoc (dbMeta st') (B.toList . mconcat $ bs) -- We treat certain processing instructions by converting them to tags -- beginning "pi-". @@ -714,8 +714,8 @@ trimNl = T.dropAround (== '\n') -- assumes Blocks start with a Para; if not, does nothing. addToStart :: Inlines -> Blocks -> Blocks addToStart toadd bs = - case toList bs of - (Para xs : rest) -> para (toadd <> fromList xs) <> fromList rest + case B.toList bs of + (Para xs : rest) -> para (toadd <> B.fromList xs) <> B.fromList rest _ -> bs -- function that is used by both mediaobject (in parseBlock) @@ -949,9 +949,8 @@ parseBlock (Elem e) = (x >= '0' && x <= '9') || x == '.') w if n > 0 then Just n else Nothing - let numrows = case bodyrows of - [] -> 0 - xs -> maximum $ map length xs + let numrows = fromMaybe 0 $ + viaNonEmpty maximum1 $ map length bodyrows let aligns = case colspecs of [] -> replicate numrows AlignDefault cs -> map toAlignment cs |
