From 35ef522c131c726d59a683240441e99879f18cab Mon Sep 17 00:00:00 2001 From: Joseph Young Date: Sat, 11 Sep 2021 14:33:21 +0100 Subject: [PATCH 1/2] Fix encode only replacing first occurrences --- staging/src/TryPureScript.purs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/staging/src/TryPureScript.purs b/staging/src/TryPureScript.purs index 5e873c6b..92e24132 100644 --- a/staging/src/TryPureScript.purs +++ b/staging/src/TryPureScript.purs @@ -20,7 +20,7 @@ module TryPureScript import Prelude import Data.Foldable (class Foldable, foldMap) import Data.String (joinWith) -import Data.String.Common (replace) +import Data.String.Common (replaceAll) import Data.String.Pattern (Pattern(..), Replacement(..)) import Effect (Effect) @@ -28,10 +28,10 @@ foreign import setInnerHTML :: String -> Effect Unit encode :: String -> String encode = - replace (Pattern "<") (Replacement "<") - <<< replace (Pattern ">") (Replacement ">") - <<< replace (Pattern "&") (Replacement "&") - <<< replace (Pattern "\"") (Replacement """) + replaceAll (Pattern "<") (Replacement "<") + <<< replaceAll (Pattern ">") (Replacement ">") + <<< replaceAll (Pattern "&") (Replacement "&") + <<< replaceAll (Pattern "\"") (Replacement """) foreign import withConsoleImpl :: forall a From 1503222cab311030e9bdab8d2595b9ef8b0e25c7 Mon Sep 17 00:00:00 2001 From: Joseph Young Date: Sat, 11 Sep 2021 14:38:42 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86ce55fe..7d76414b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Breaking changes: New features: Bugfixes: +- Fixed `encode` not replacing all instances of special characters (#254 by @jy14898) ## [v2021-08-25.1](https://github.com/purescript/trypurescript/releases/tag/v2021-08-25.1) - 2021-08-25