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/HTML | |
| 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/HTML')
| -rw-r--r-- | src/Text/Pandoc/Readers/HTML/Table.hs | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/HTML/TagCategories.hs | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/HTML/Table.hs b/src/Text/Pandoc/Readers/HTML/Table.hs index 6179ea8e7..b8091d7e9 100644 --- a/src/Text/Pandoc/Readers/HTML/Table.hs +++ b/src/Text/Pandoc/Readers/HTML/Table.hs @@ -216,7 +216,7 @@ normalize widths head' bodies foot = do let rows = headRows head' <> concatMap bodyRows bodies <> footRows foot let cellWidth (Cell _ _ _ (ColSpan cs) _) = cs let rowLength = foldr (\cell acc -> cellWidth cell + acc) 0 . rowCells - let ncols = maximum (map rowLength rows) + let ncols = fromMaybe 0 $ viaNonEmpty maximum1 (map rowLength rows) let tblType = tableType (map rowCells rows) -- fail on empty table if null rows diff --git a/src/Text/Pandoc/Readers/HTML/TagCategories.hs b/src/Text/Pandoc/Readers/HTML/TagCategories.hs index b7bd40fee..a339b2e76 100644 --- a/src/Text/Pandoc/Readers/HTML/TagCategories.hs +++ b/src/Text/Pandoc/Readers/HTML/TagCategories.hs @@ -21,17 +21,18 @@ module Text.Pandoc.Readers.HTML.TagCategories ) where -import Data.Set (Set, fromList, unions) +import Data.Set (Set) +import qualified Data.Set as Set import Data.Text (Text) eitherBlockOrInline :: Set Text -eitherBlockOrInline = fromList +eitherBlockOrInline = Set.fromList ["audio", "applet", "button", "iframe", "embed", "del", "ins", "progress", "map", "area", "noscript", "script", "object", "svg", "video", "source"] blockHtmlTags :: Set Text -blockHtmlTags = fromList +blockHtmlTags = Set.fromList ["?xml", "!DOCTYPE", "address", "article", "aside", "blockquote", "body", "canvas", "caption", "center", "col", "colgroup", "dd", "details", @@ -48,7 +49,7 @@ blockHtmlTags = fromList -- We want to allow raw docbook in markdown documents, so we -- include docbook block tags here too. blockDocBookTags :: Set Text -blockDocBookTags = fromList +blockDocBookTags = Set.fromList ["calloutlist", "bibliolist", "glosslist", "itemizedlist", "orderedlist", "segmentedlist", "simplelist", "variablelist", "caution", "important", "note", "tip", @@ -63,10 +64,10 @@ blockDocBookTags = fromList "sidebar", "title"] epubTags :: Set Text -epubTags = fromList ["case", "switch", "default"] +epubTags = Set.fromList ["case", "switch", "default"] blockTags :: Set Text -blockTags = unions [blockHtmlTags, blockDocBookTags, epubTags] +blockTags = Set.unions [blockHtmlTags, blockDocBookTags, epubTags] sectioningContent :: [Text] sectioningContent = ["article", "aside", "nav", "section"] |
