summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Parsing.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-07-24 09:06:13 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-07-24 09:06:13 -0700
commitbab816cefef1165326bbf97b665769c6d0e50487 (patch)
tree35d1c22dfa21dc9ae581f0d4389cab8da25f5041 /src/Text/Pandoc/Parsing.hs
parentce72d6aba83981dee3deb012373bd11e7432142a (diff)
Refactored table parsers, captions now not part of core tableWith.
Diffstat (limited to 'src/Text/Pandoc/Parsing.hs')
-rw-r--r--src/Text/Pandoc/Parsing.hs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index e7ca8ccf3..c04db4d60 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -532,22 +532,17 @@ tableWith :: Parsec [Char] ParserState ([[Block]], [Alignment], [Int])
-> ([Int] -> Parsec [Char] ParserState [[Block]])
-> Parsec [Char] ParserState sep
-> Parsec [Char] ParserState end
- -> Parsec [Char] ParserState [Inline]
-> Parsec [Char] ParserState Block
-tableWith headerParser rowParser lineParser footerParser captionParser = try $ do
- caption' <- option [] captionParser
+tableWith headerParser rowParser lineParser footerParser = try $ do
(heads, aligns, indices) <- headerParser
lines' <- rowParser indices `sepEndBy1` lineParser
footerParser
- caption <- if null caption'
- then option [] captionParser
- else return caption'
state <- getState
let numColumns = stateColumns state
let widths = if (indices == [])
then replicate (length aligns) 0.0
else widthsFromIndices numColumns indices
- return $ Table caption aligns widths heads lines'
+ return $ Table [] aligns widths heads lines'
-- Calculate relative widths of table columns, based on indices
widthsFromIndices :: Int -- Number of columns on terminal
@@ -581,11 +576,10 @@ widthsFromIndices numColumns' indices =
-- which may be grid, separated by blank lines, and
-- ending with a footer (dashed line followed by blank line).
gridTableWith :: Parsec [Char] ParserState Block -- ^ Block parser
- -> Parsec [Char] ParserState [Inline] -- ^ Caption parser
-> Bool -- ^ Headerless table
-> Parsec [Char] ParserState Block
-gridTableWith block tableCaption headless =
- tableWith (gridTableHeader headless block) (gridTableRow block) (gridTableSep '-') gridTableFooter tableCaption
+gridTableWith block headless =
+ tableWith (gridTableHeader headless block) (gridTableRow block) (gridTableSep '-') gridTableFooter
gridTableSplitLine :: [Int] -> String -> [String]
gridTableSplitLine indices line = map removeFinalBar $ tail $