ipfs-chromium
Loading...
Searching...
No Matches
html_escape.h
1#ifndef IPFS_HTML_ESCAPE_H_
2#define IPFS_HTML_ESCAPE_H_
3
4#include <string_view>
5
6constexpr std::string_view html_escape(char& c) {
7 switch (c) {
8 case '"':
9 return "&quot;";
10 case '\'':
11 return "&apos;";
12 case '<':
13 return "&lt;";
14 case '>':
15 return "&gt;";
16 case '&':
17 return "&amp;";
18 default:
19 return {&c, 1UL};
20 }
21}
22
23#endif // IPFS_HTML_ESCAPE_H_