aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-07-27 10:40:06 -0700
committerJohn MacFarlane <[email protected]>2025-07-27 10:43:46 -0700
commit8735bc03d8b9da1663f696dc348342c0e424a141 (patch)
treeb860507666ee70528e7555a16b6ab2514155f966
parentcaa2193912627938554887583d9c5d99ac4c4b67 (diff)
Docx reader: fix `stringToInteger`.
It previously converted things like `11ccc` to an integer; now it requires that the whole string be parsable as an integer. Closes #9184.
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse/Styles.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs b/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs
index 050bfecbc..a23f99c55 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse/Styles.hs
@@ -239,8 +239,8 @@ buildBasedOnList ns element rootStyle =
stringToInteger :: Text -> Maybe Integer
stringToInteger s = case Data.Text.Read.decimal s of
- Right (x,_) -> Just x
- Left _ -> Nothing
+ Right (x,t) | T.null t -> Just x
+ _ -> Nothing
checkOnOff :: NameSpaces -> Element -> QName -> Maybe Bool
checkOnOff ns rPr tag