diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-10-07 21:31:03 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-10-07 21:31:03 -0700 |
commit | e4ccfeab8c55578fead30233394d531f31a429c3 (patch) | |
tree | 62c220df81cdc8a65aa9cc95718e23d78f56ed81 /src/Text | |
parent | 8fb9a0d168517462860d6916c1f882958520988b (diff) | |
download | pandoc-e4ccfeab8c55578fead30233394d531f31a429c3.tar.gz |
Shored.camelCaseToHyphenated: handle ABCDef = abc-def.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 10 |
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. |