aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 7c8a2e2a8..4ce5ba1d0 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -242,8 +242,14 @@ stripFirstAndLast str =
-- | Change CamelCase word to hyphenated lowercase (e.g., camel-case).
camelCaseToHyphenated :: String -> String
camelCaseToHyphenated [] = ""
-camelCaseToHyphenated (a:b:rest) | isLower a && isUpper b =
- a:'-':toLower b:camelCaseToHyphenated rest
+camelCaseToHyphenated (a:b:rest)
+ | isLower a
+ , isUpper b = a:'-':toLower b:camelCaseToHyphenated rest
+-- handle ABCDef = abc-def
+camelCaseToHyphenated (a:b:c:rest)
+ | isUpper a
+ , isUpper b
+ , isLower c = toLower a:'-':toLower b:camelCaseToHyphenated (c:rest)
camelCaseToHyphenated (a:rest) = toLower a:camelCaseToHyphenated rest
-- | Convert number < 4000 to uppercase roman numeral.