diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-06-01 12:08:28 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-06-01 12:08:28 +0200 |
commit | 9396f1fb6766cc4b08fb7b7c97ef2c02e9f0f700 (patch) | |
tree | 82486016ca569221513184e11a7f9f024090652a /src | |
parent | af6e8414c7d39d80831720d35a6d0d5f6e09bbd5 (diff) | |
download | pandoc-9396f1fb6766cc4b08fb7b7c97ef2c02e9f0f700.tar.gz |
LaTeX reader: handle some width specifiers on table columns.
Currently we only handle the form `0.9\linewidth`.
Anything else would have to be converted to a percentage,
using some kind arbitrary assumptions about line widths.
See #3709.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index a69c17ebc..b65ae15ad 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -1451,14 +1451,24 @@ parseAligns = try $ do <|> xAlign <|> mAlign <|> bAlign let alignPrefix = char '>' >> braced let alignSuffix = char '<' >> braced + let colWidth = try $ do + char '{' + ds <- many1 (oneOf "0123456789.") + spaces + string "\\linewidth" + char '}' + case safeRead ds of + Just w -> return w + Nothing -> return 0.0 let alignSpec = do spaces pref <- option "" alignPrefix spaces al <- alignChar - let parseWidth :: String -> Double - parseWidth _ = 0.00 -- TODO actually parse the width - width <- parseWidth <$> option "" braced + width <- colWidth <|> option 0.0 (do s <- braced + pos <- getPosition + report $ SkippedContent s pos + return 0.0) spaces suff <- option "" alignSuffix return (al, width, (pref, suff)) |