diff options
author | hubertp-lshift <hubertp@lshift.de> | 2016-11-01 10:07:39 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-11-01 10:07:39 +0100 |
commit | 01a21dd43fe170ba215b83179f6e10d51e77f3f5 (patch) | |
tree | 0b2e706018b02dff55382090cdcd807139713d0f /src/Text/Pandoc/Readers | |
parent | e08ffa562a36cfa3b7f3ed31dcc9c92979462d75 (diff) | |
download | pandoc-01a21dd43fe170ba215b83179f6e10d51e77f3f5.tar.gz |
[odt] Infer tables' header props from rows (#3199)
ODT reader simply provided an empty header list
which meant that the contents of the whole table,
even if not empty, was simply ignored.
While we still do not infer headers we at least have
to provide default properties of columns.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Odt/ContentReader.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Odt/ContentReader.hs b/src/Text/Pandoc/Readers/Odt/ContentReader.hs index 42f018157..8093cc779 100644 --- a/src/Text/Pandoc/Readers/Odt/ContentReader.hs +++ b/src/Text/Pandoc/Readers/Odt/ContentReader.hs @@ -695,7 +695,7 @@ read_citation = matchingElement NsText "bibliography-mark" ( findAttrWithDefault NsText "identifier" "" ) ( readAttrWithDefault NsText "number" 0 ) ) - ( matchChildContent [] read_plain_text ) + ( matchChildContent [] read_plain_text ) where makeCitation :: String -> Int -> [Citation] makeCitation citeId num = [Citation citeId [] [] NormalCitation num 0] @@ -708,10 +708,17 @@ read_citation = matchingElement NsText "bibliography-mark" -- read_table :: BlockMatcher read_table = matchingElement NsTable "table" - $ liftA (simpleTable []) + $ liftA simpleTable' $ matchChildContent' [ read_table_row ] +-- | A simple table without a caption or headers +-- | Infers the number of headers from rows +simpleTable' :: [[Blocks]] -> Blocks +simpleTable' [] = simpleTable [] [] +simpleTable' (x : rest) = simpleTable (fmap (const defaults) x) (x : rest) + where defaults = fromList [] + -- read_table_row :: ElementMatcher [[Blocks]] read_table_row = matchingElement NsTable "table-row" |