diff --git a/hayooFrontend/src/Hayoo/Common.hs b/hayooFrontend/src/Hayoo/Common.hs index 70149e7..5fe50fa 100644 --- a/hayooFrontend/src/Hayoo/Common.hs +++ b/hayooFrontend/src/Hayoo/Common.hs @@ -35,6 +35,7 @@ module Hayoo.Common , contextQueryName , ContextQuery () , contextQueries +, escapeScript ) where import GHC.Generics (Generic) @@ -54,7 +55,7 @@ import Data.Data (Data) import Data.Scientific (Scientific) import Data.String (IsString, fromString) import Data.String.Conversions (cs, (<>)) -import Data.Text (Text, isInfixOf, splitOn, strip) +import Data.Text (Text, isInfixOf, splitOn, strip, replace) import Data.Typeable (Typeable) --import Data.Vector ((!)) @@ -121,6 +122,9 @@ getSRPackage :: SearchResult -> Text getSRPackage sr@NonPackageResult{} = resultPackage sr getSRPackage sr@PackageResult{} = resultName sr +escapeScript :: (SearchResult -> Text) -> SearchResult -> Text +escapeScript f sr = replace " - #{preEscapedToMarkup $ resultDescription result} + #{preEscapedToMarkup $ escapeScript resultDescription result} |] renderBoxedResult result@(PackageResult {}) = [Hamlet.hamlet| @@ -194,7 +194,7 @@ renderBoxedResult result@(PackageResult {}) = [Hamlet.hamlet| ^{renderBoxedResultHeading result}
- #{resultSynopsis result} + #{escapeScript resultSynopsis result} |] renderBoxedResults :: H.LimitedResult SearchResult -> Hamlet.HtmlUrl Routes