summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-01-27 00:39:00 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-01-27 00:39:00 -0800
commitff93a8e7891d8537c713d6d1b0fd4409c5e43ebe (patch)
treecadd0d8f274436426527cd51212542d084a1c233
parent4321e27bfdb97a7df44ff2137b459278ba782d2e (diff)
Fixed table parsing with wide or combining characters.
Closes #348. Closes #108.
-rw-r--r--src/Text/Pandoc/Parsing.hs2
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 71da3a730..8185d7a14 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -502,7 +502,7 @@ gridTableWith block tableCaption headless =
gridTableSplitLine :: [Int] -> String -> [String]
gridTableSplitLine indices line = map removeFinalBar $ tail $
- splitByIndices (init indices) $ removeTrailingSpace line
+ splitStringByIndices (init indices) $ removeTrailingSpace line
gridPart :: Char -> GenParser Char st (Int, Int)
gridPart ch = do
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 2e2941b31..1fd99a3ab 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -773,7 +773,7 @@ simpleTableHeader headless = try $ do
let (lengths, lines') = unzip dashes
let indices = scanl (+) (length initSp) lines'
-- If no header, calculate alignment on basis of first row of text
- rawHeads <- liftM (tail . splitByIndices (init indices)) $
+ rawHeads <- liftM (tail . splitStringByIndices (init indices)) $
if headless
then lookAhead anyLine
else return rawContent
@@ -800,7 +800,7 @@ rawTableLine indices = do
notFollowedBy' (blanklines <|> tableFooter)
line <- many1Till anyChar newline
return $ map removeLeadingTrailingSpace $ tail $
- splitByIndices (init indices) line
+ splitStringByIndices (init indices) line
-- Parse a table line and return a list of lists of blocks (columns).
tableLine :: [Int]
@@ -862,9 +862,9 @@ multilineTableHeader headless = try $ do
let indices = scanl (+) (length initSp) lines'
rawHeadsList <- if headless
then liftM (map (:[]) . tail .
- splitByIndices (init indices)) $ lookAhead anyLine
+ splitStringByIndices (init indices)) $ lookAhead anyLine
else return $ transpose $ map
- (\ln -> tail $ splitByIndices (init indices) ln)
+ (\ln -> tail $ splitStringByIndices (init indices) ln)
rawContent
let aligns = zipWith alignType rawHeadsList lengths
let rawHeads = if headless