html-entities 1.1.1.1 → 1.1.2
raw patch · 3 files changed
+34/−5 lines, 3 filesdep ~doctest
Dependency ranges changed: doctest
Files
- doctest/Main.hs +2/−1
- html-entities.cabal +5/−4
- library/HTMLEntities/Text.hs +27/−0
doctest/Main.hs view
@@ -23,15 +23,16 @@ "-XDataKinds", "-XDefaultSignatures", "-XDeriveDataTypeable",+ "-XDeriveFoldable", "-XDeriveFunctor", "-XDeriveGeneric",+ "-XDeriveTraversable", "-XEmptyDataDecls", "-XFlexibleContexts", "-XFlexibleInstances", "-XFunctionalDependencies", "-XGADTs", "-XGeneralizedNewtypeDeriving",- "-XImpredicativeTypes", "-XLambdaCase", "-XLiberalTypeSynonyms", "-XMultiParamTypeClasses",
html-entities.cabal view
@@ -1,7 +1,7 @@ name: html-entities version:- 1.1.1.1+ 1.1.2 synopsis: A codec library for HTML-escaped text and HTML-entities description:@@ -49,6 +49,7 @@ HTMLEntities.NameTable HTMLEntities.Prelude exposed-modules:+ HTMLEntities.Text HTMLEntities.Builder HTMLEntities.Parser HTMLEntities.Decoder@@ -60,7 +61,7 @@ ghc-options: -funbox-strict-fields default-extensions:- Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators+ Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators default-language: Haskell2010 @@ -77,11 +78,11 @@ "-with-rtsopts=-N" -funbox-strict-fields default-extensions:- Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators+ Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators default-language: Haskell2010 build-depends:- doctest == 0.10.*,+ doctest == 0.11.*, directory == 1.2.*, filepath >= 1.3 && < 1.5, base-prelude,
+ library/HTMLEntities/Text.hs view
@@ -0,0 +1,27 @@+module HTMLEntities.Text where++import HTMLEntities.Prelude+import qualified Data.Text as Text+++-- |+-- HTML-encodes the given char.+char :: Char -> Text+char =+ \case+ '<' -> "<"+ '>' -> ">"+ '&' -> "&"+ '"' -> """+ '\'' -> "'"+ x -> Text.singleton x++-- |+-- HTML-encodes the given text.+-- +-- >>> Data.Text.IO.putStrLn $ text "<a href=\"\">"+-- <a href="">+-- +text :: Text -> Text+text =+ Text.concatMap char