Commit 527141fd authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Fix #6: Implement b style

parent 2b0c759c
...@@ -4,10 +4,10 @@ cabal-version: 2.2 ...@@ -4,10 +4,10 @@ cabal-version: 2.2
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: cc61a2ec4483abb568ec0d6c64b949ecd8f2e1c8a1043eb0fe598f5764d575e5 -- hash: ec9b95839c1659b10e94e8e7a06f9cf42995aee18e1233fc5b873f59e3b122a4
name: mock name: mock
version: 3.0.0 version: 3.1.0
synopsis: GrEAt HAskeLL PrOGRaM to trANsForm tEXT synopsis: GrEAt HAskeLL PrOGRaM to trANsForm tEXT
description: Please see the README at <https://git.eisfunke.com/software/mock#readme> description: Please see the README at <https://git.eisfunke.com/software/mock#readme>
category: String category: String
......
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
module Mock (styles, mockAlternate, mockRandom, letterspace, toDouble) where module Mock (styles, mockAlternate, mockRandom, letterspace, toDouble) where
import qualified Data.Text as T
import Data.Text (Text)
import Data.Char import Data.Char
import Data.List import Data.List
import qualified Data.Text as T
import Data.Hashable import Data.Hashable
import System.Random import System.Random
-- |List of possible mock style names and their functions. -- |List of possible mock style names and their functions.
styles :: [(T.Text, T.Text -> T.Text)] styles :: [(Text, Text -> Text)]
styles = [ styles = [
("random", mockRandom), ("random", mockRandom),
("alternate", mockAlternate), ("alternate", mockAlternate),
...@@ -21,7 +22,8 @@ styles = [ ...@@ -21,7 +22,8 @@ styles = [
("upper", T.toUpper), ("upper", T.toUpper),
("lower", T.toLower), ("lower", T.toLower),
("double", T.map toDouble), ("double", T.map toDouble),
("cc", mockCC)] ("cc", mockCC),
("b", mockB)]
-- |Transforms a String into uppercase where the corresponding list is True. For False the String isn't changed. -- |Transforms a String into uppercase where the corresponding list is True. For False the String isn't changed.
toUpperBy :: [Bool] -> T.Text -> T.Text toUpperBy :: [Bool] -> T.Text -> T.Text
...@@ -60,3 +62,7 @@ toDouble c = c ...@@ -60,3 +62,7 @@ toDouble c = c
-- |Replaces all occurences of lowercase "ck" and "k" in a string with "cc"s. -- |Replaces all occurences of lowercase "ck" and "k" in a string with "cc"s.
mockCC :: T.Text -> T.Text mockCC :: T.Text -> T.Text
mockCC = T.replace "k" "cc" . T.replace "ck" "cc" mockCC = T.replace "k" "cc" . T.replace "ck" "cc"
-- |Repaclaces all occurences of "b" and "B" with B button emojis.
mockB :: Text -> Text
mockB = T.replace "b" "🅱️" . T.replace "B" "🅱️"
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