Loading src/Mock.hs +31 −1 Original line number Diff line number Diff line {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings, LambdaCase #-} module Mock (styles, mockAlternate, mockRandom, letterspace, toDouble) where Loading @@ -24,6 +24,7 @@ styles = [ ("lower", T.toLower), ("double", T.map toDouble), ("dedouble", T.map fromDouble), ("smallcaps", T.map toSmallCap), ("cc", mockCC), ("b", mockB), ("square", mockSquare)] Loading Loading @@ -77,6 +78,35 @@ fromDouble c = case ord c of | 120146 <= code && code <= 120171 -> chr $ code - 120146 + 97 code -> chr code toSmallCap :: Char -> Char toSmallCap = \case 'a' -> chr 7424 'b' -> chr 665 'c' -> chr 7428 'd' -> chr 7429 'e' -> chr 7431 'f' -> chr 42800 'g' -> chr 610 'h' -> chr 668 'i' -> chr 618 'j' -> chr 7434 'k' -> chr 7435 'l' -> chr 671 'm' -> chr 7437 'n' -> chr 628 'o' -> chr 7439 'p' -> chr 7448 'q' -> chr 491 'r' -> chr 640 's' -> chr 42801 't' -> chr 7451 'u' -> chr 7452 'v' -> chr 7456 'w' -> chr 7457 'y' -> chr 655 'z' -> chr 7458 c -> c -- |Replaces all occurences of lowercase "ck" and "k" in a string with "cc"s. mockCC :: T.Text -> T.Text mockCC = T.replace "k" "cc" . T.replace "ck" "cc" Loading src/Mock/Help.hs +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ styleHelp styleName = case styleName of "lower" -> "Turns all characters into lowercase ones." "double" -> "Turns characters (latin letters and numbers) into their double-struck variants (𝕖𝕩𝕒𝕞𝕡𝕝𝕖). Also known as blackboard bold." "dedouble" -> "Turns double-struck characters (like from the \"double\" style) back into normal ones." "smallcaps" -> "Turns lowercase letters into small capitals." "cc" -> "Replaces all occurences of lowercase \"c\", \"ck\" and \"k\" with \"cc\"." "b" -> "Replaces all occurences of Bs (lower- and uppercase) with B-button emojis (🅱)." "square" -> "Shows the input spaced in the first line and the tail of the input lined afterwards." Loading Loading
src/Mock.hs +31 −1 Original line number Diff line number Diff line {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings, LambdaCase #-} module Mock (styles, mockAlternate, mockRandom, letterspace, toDouble) where Loading @@ -24,6 +24,7 @@ styles = [ ("lower", T.toLower), ("double", T.map toDouble), ("dedouble", T.map fromDouble), ("smallcaps", T.map toSmallCap), ("cc", mockCC), ("b", mockB), ("square", mockSquare)] Loading Loading @@ -77,6 +78,35 @@ fromDouble c = case ord c of | 120146 <= code && code <= 120171 -> chr $ code - 120146 + 97 code -> chr code toSmallCap :: Char -> Char toSmallCap = \case 'a' -> chr 7424 'b' -> chr 665 'c' -> chr 7428 'd' -> chr 7429 'e' -> chr 7431 'f' -> chr 42800 'g' -> chr 610 'h' -> chr 668 'i' -> chr 618 'j' -> chr 7434 'k' -> chr 7435 'l' -> chr 671 'm' -> chr 7437 'n' -> chr 628 'o' -> chr 7439 'p' -> chr 7448 'q' -> chr 491 'r' -> chr 640 's' -> chr 42801 't' -> chr 7451 'u' -> chr 7452 'v' -> chr 7456 'w' -> chr 7457 'y' -> chr 655 'z' -> chr 7458 c -> c -- |Replaces all occurences of lowercase "ck" and "k" in a string with "cc"s. mockCC :: T.Text -> T.Text mockCC = T.replace "k" "cc" . T.replace "ck" "cc" Loading
src/Mock/Help.hs +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ styleHelp styleName = case styleName of "lower" -> "Turns all characters into lowercase ones." "double" -> "Turns characters (latin letters and numbers) into their double-struck variants (𝕖𝕩𝕒𝕞𝕡𝕝𝕖). Also known as blackboard bold." "dedouble" -> "Turns double-struck characters (like from the \"double\" style) back into normal ones." "smallcaps" -> "Turns lowercase letters into small capitals." "cc" -> "Replaces all occurences of lowercase \"c\", \"ck\" and \"k\" with \"cc\"." "b" -> "Replaces all occurences of Bs (lower- and uppercase) with B-button emojis (🅱)." "square" -> "Shows the input spaced in the first line and the tail of the input lined afterwards." Loading