Commit bf280c7d authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Add dedouble style.

parent 8b050990
......@@ -22,6 +22,7 @@ styles = [
("upper", T.toUpper),
("lower", T.toLower),
("double", T.map toDouble),
("dedouble", T.map fromDouble),
("cc", mockCC),
("b", mockB),
("square", mockSquare),
......@@ -61,6 +62,21 @@ toDouble c
| 97 <= ord c && ord c <= 122 = chr $ ord c - 97 + 120146 -- Lowercase letter
toDouble c = c
fromDouble :: Char -> Char
fromDouble c = case ord c of
8450 -> 'C'
8461 -> 'H'
8469 -> 'N'
8473 -> 'P'
8474 -> 'Q'
8477 -> 'R'
8484 -> 'Z'
code
| 120792 <= code && code <= 120801 -> chr $ code - 120792 + 48
| 120120 <= code && code <= 120145 -> chr $ code - 120120 + 65
| 120146 <= code && code <= 120171 -> chr $ code - 120146 + 97
code -> chr code
-- |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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment