summaryrefslogtreecommitdiffstats
path: root/src/styles/abstracts/functions/_encode.scss
blob: 43501858c56f15ccc0c62924ad24ceb4aaafd2a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@use "str-replace" as fun;

/// Encode a SVG.
/// @param {String} $svg A complete svg (`<svg>...</svg>`).
/// @return The encoded svg, ready to use for background-image.
@function encode-svg($svg) {
  $svg-encoding: (("<", "%3C"), (">", "%3E"), ("#", "%23"));

  @each $char, $encoded in $svg-encoding {
    $svg: fun.str-replace($svg, $char, $encoded);
  }

  @return "data:image/svg+xml;utf8," + $svg;
}
span>/[(){}[\]:,.]/, }; velocity.variable.inside = { string: velocity['string'], function: { pattern: /([^\w-])[a-z][\w-]*(?=\()/, lookbehind: true, }, number: velocity['number'], boolean: velocity['boolean'], punctuation: velocity['punctuation'], }; Prism.languages.insertBefore('velocity', 'comment', { unparsed: { pattern: /(^|[^\\])#\[\[[\s\S]*?\]\]#/, lookbehind: true, greedy: true, inside: { punctuation: /^#\[\[|\]\]#$/, }, }, 'velocity-comment': [ { pattern: /(^|[^\\])#\*[\s\S]*?\*#/, lookbehind: true, greedy: true, alias: 'comment', }, { pattern: /(^|[^\\])##.*/, lookbehind: true, greedy: true, alias: 'comment', }, ], directive: { pattern: /(^|[^\\](?:\\\\)*)#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})(?:\s*\((?:[^()]|\([^()]*\))*\))?/i, lookbehind: true, inside: { keyword: { pattern: /^#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})|\bin\b/, inside: { punctuation: /[{}]/, }, }, rest: velocity, }, }, variable: velocity['variable'], }); Prism.languages.velocity['tag'].inside['attr-value'].inside.rest = Prism.languages.velocity; })(Prism);