aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-06-24 13:41:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-06-24 13:41:19 -0700
commit5ba47605276cf52aeef06043b47a04ca05bd0339 (patch)
treed1fabd2b038e3de1cf6fbd21be44efa0aa3b9cca /src/Text/Pandoc
parent98ca2e512c48e532f778fd1401245c1dbcf55c9d (diff)
parent69743cd5981d7e910c5d83da18fc698c8d522e69 (diff)
downloadpandoc-5ba47605276cf52aeef06043b47a04ca05bd0339.tar.gz
Merge pull request #1370 from jkr/fix-zero-indent
Docx reader: Ignore zero (or negative) indent
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Docx.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
index 59fb7b37f..b787ca9fb 100644
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -132,7 +132,6 @@ runStyleToContainers rPr =
divAttrToContainers :: [String] -> [(String, String)] -> [Container Block]
-divAttrToContainers [] [] = []
divAttrToContainers (c:cs) _ | isJust (isHeaderClass c) =
let n = fromJust (isHeaderClass c)
in
@@ -151,10 +150,14 @@ divAttrToContainers (c:cs) kvs | c `elem` listParagraphDivs =
divAttrToContainers (c:cs) kvs | c `elem` blockQuoteDivs =
(Container BlockQuote) : (divAttrToContainers (cs \\ blockQuoteDivs) kvs)
divAttrToContainers (_:cs) kvs = divAttrToContainers cs kvs
-divAttrToContainers [] (kv:kvs) | fst kv == "indent" =
- (Container BlockQuote) : divAttrToContainers [] kvs
-divAttrToContainers [] (_:kvs) =
- divAttrToContainers [] kvs
+divAttrToContainers [] kvs | isJust (lookup "indent" kvs) =
+ let kvs' = filter (\(k,_) -> k /= "indent") kvs
+ in
+ case fromJust (lookup "indent" kvs) of
+ "0" -> divAttrToContainers [] kvs'
+ ('-' : _) -> divAttrToContainers [] kvs'
+ _ -> (Container BlockQuote) : divAttrToContainers [] kvs'
+divAttrToContainers _ _ = []
parStyleToContainers :: ParagraphStyle -> [Container Block]