diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-08-28 13:10:48 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-28 13:10:48 -0700 |
commit | 608e402802823e9f09fd3b7c294d23f166881817 (patch) | |
tree | b4af032c2873a4a9d7ccb7a143b9fb1b31e191ed /src/Text | |
parent | c7f47d7646ac0c6872de9cc140eca075174289e3 (diff) | |
parent | 3b5a868533c7a0c0884c511e2f8a5e830e7fede2 (diff) | |
download | pandoc-608e402802823e9f09fd3b7c294d23f166881817.tar.gz |
Merge pull request #1577 from jkr/plainCells
Plain cells
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 188fa4a42..8ebe59569 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -95,6 +95,7 @@ import Control.Monad.Reader import Control.Monad.State import Control.Applicative ((<$>)) import Data.Sequence (ViewL(..), viewl) +import qualified Data.Sequence as Seq (null) readDocx :: ReaderOptions -> B.ByteString @@ -391,11 +392,21 @@ makeHeaderAnchor' (Header n (_, classes, kvs) ils) = return $ Header n (newIdent, classes, kvs) ils makeHeaderAnchor' blk = return blk +-- Rewrite a standalone paragraph block as a plain +singleParaToPlain :: Blocks -> Blocks +singleParaToPlain blks + | (Para (ils) :< seeq) <- viewl $ unMany blks + , Seq.null seeq = + singleton $ Plain ils +singleParaToPlain blks = blks + cellToBlocks :: Cell -> DocxContext Blocks cellToBlocks (Cell bps) = concatReduce <$> mapM bodyPartToBlocks bps rowToBlocksList :: Row -> DocxContext [Blocks] -rowToBlocksList (Row cells) = mapM cellToBlocks cells +rowToBlocksList (Row cells) = do + blksList <- mapM cellToBlocks cells + return $ map singleParaToPlain blksList trimLineBreaks :: [Inline] -> [Inline] trimLineBreaks [] = [] |