From e4ccfeab8c55578fead30233394d531f31a429c3 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Mon, 7 Oct 2019 21:31:03 -0700
Subject: [PATCH] Shored.camelCaseToHyphenated: handle ABCDef = abc-def.

---
 src/Text/Pandoc/Shared.hs | 10 ++++++++--
 1 file 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.