Sha256: 671c126accf84229dd66c5899087dbd4d748eea1258af448b447f857b9232137

Contents?: true

Size: 1.59 KB

Versions: 4

Compression:

Stored size: 1.59 KB

Contents

///
/// HTML encode string
///
@function flint-html-encode($string) {
  $encode-map: ("%": "%25", " ": "%20", "!": "%21", '"': "%22", "#": "%23", "$": "%24", "&": "%26", "'": "%27", "(": "%28", ")": "%29", "*": "%2A", "+": "%2B", ",": "%2C", "-": "%2D", ".": "%2E", "/": "%2F", ":": "%3A", ";": "%3B", "<": "%3C", "=": "%3D", ">": "%3E", "?": "%3F", "@": "%40", "[": "%5B", "\\": "%5C", "]": "%5D", "^": "%5E", "_": "%5F", "`": "%60", "{": "%7B", "|": "%7C", "}": "%7D", "~": "%7E", "¢": "%A2", "£": "%A3", "¥": "%A5", "§": "%A7", "«": "%AB", "¬": "%AC", "¯": "%AD", "º": "%B0", "±": "%B1", "ª": "%B2", "µ": "%B5", "»": "%BB", "¼": "%BC", "½": "%BD", "¿": "%BF", "À": "%C0", "Á": "%C1", "Â": "%C2", "Ã": "%C3", "Ä": "%C4", "Å": "%C5", "Æ": "%C6", "Ç": "%C7", "È": "%C8", "É": "%C9", "Ê": "%CA", "Ë": "%CB", "Ì": "%CC", "Í": "%CD", "Î": "%CE", "Ï": "%CF", "Ð": "%D0", "Ñ": "%D1", "Ò": "%D2", "Ó": "%D3", "Ô": "%D4", "Õ": "%D5", "Ö": "%D6", "Ø": "%D8", "Ù": "%D9", "Ú": "%DA", "Û": "%DB", "Ü": "%DC", "Ý": "%DD", "Þ": "%DE", "ß": "%DF", "à": "%E0", "á": "%E1", "â": "%E2", "ã": "%E3", "ä": "%E4", "å": "%E5", "æ": "%E6", "ç": "%E7", "è": "%E8", "é": "%E9", "ê": "%EA", "ë": "%EB", "ì": "%EC", "í": "%ED", "î": "%EE", "ï": "%EF", "ð": "%F0", "ñ": "%F1", "ò": "%F2", "ó": "%F3", "ô": "%F4", "õ": "%F5", "ö": "%F6", "÷": "%F7", "ø": "%F8", "ù": "%F9", "ú": "%FA", "û": "%FB", "ü": "%FC", "ý": "%FD", "þ": "%FE", "ÿ": "%FF");

  @each $search, $replace in $encode-map {
    $string: flint-str-replace($string, $search, $replace);
  }

  @return $string;
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flint-gs-2.3.3 stylesheets/flint/functions/lib/_html-encode.scss
flint-gs-2.3.2 stylesheets/flint/functions/lib/_html-encode.scss
flint-gs-2.3.1 stylesheets/flint/functions/lib/_html-encode.scss
flint-gs-2.3.0 stylesheets/flint/functions/lib/_html-encode.scss