git.iko.soy/typeable/pandoc
on master help sign in
Docx reader: Ignore zero (or negative) indent

If a block has an indentation less than or equal to zero, it should not be treated as a block quote.

commit69743cd5981d7e910c5d83da18fc698c8d522e69 authorJesse Rosenthal <jrosenthal@jhu.edu> dateTue 24 Jun 2014, 14:24 (12 years ago) parenta8866bc
1 file changed+8−5
src/Text/Pandoc/Readers/Docx.hs+8−5
src/Text/Pandoc/Readers/Docx.hs+8−5
@@ -132,7 +132,6 @@ runStyleToContainers rPr =
132132
133133
134134divAttrToContainers :: [String] -> [(String, String)] -> [Container Block]
135−divAttrToContainers [] [] = []
136135divAttrToContainers (c:cs) _ | isJust (isHeaderClass c) =
137136 let n = fromJust (isHeaderClass c)
138137 in
@@ -151,10 +150,14 @@ divAttrToContainers (c:cs) kvs | c `elem` listParagraphDivs =
151150divAttrToContainers (c:cs) kvs | c `elem` blockQuoteDivs =
152151 (Container BlockQuote) : (divAttrToContainers (cs \\ blockQuoteDivs) kvs)
153152divAttrToContainers (_:cs) kvs = divAttrToContainers cs kvs
154−divAttrToContainers [] (kv:kvs) | fst kv == "indent" =
155− (Container BlockQuote) : divAttrToContainers [] kvs
156−divAttrToContainers [] (_:kvs) =
157− divAttrToContainers [] kvs
153+divAttrToContainers [] kvs | isJust (lookup "indent" kvs) =
154+ let kvs' = filter (\(k,_) -> k /= "indent") kvs
155+ in
156+ case fromJust (lookup "indent" kvs) of
157+ "0" -> divAttrToContainers [] kvs'
158+ ('-' : _) -> divAttrToContainers [] kvs'
159+ _ -> (Container BlockQuote) : divAttrToContainers [] kvs'
160+divAttrToContainers _ _ = []
158161
159162
160163parStyleToContainers :: ParagraphStyle -> [Container Block]