* Decodes an HTML entity. * * @param {string} entity The full entity (including the & and the ;). * @return {string} A single unicode code-point as a string. * @private
(entity)
| 659 | * @private |
| 660 | */ |
| 661 | lookupEntity_(entity) { |
| 662 | // TODO(goto): use {amp.htmlparserDecode} instead ? |
| 663 | // TODO(goto): π is different from Π |
| 664 | const name = |
| 665 | parserInterface.toLowerCase(entity.substring(1, entity.length - 1)); |
| 666 | if (Entities.hasOwnProperty(name)) { |
| 667 | return Entities[name]; |
| 668 | } |
| 669 | let m = name.match(DECIMAL_ESCAPE_RE_); |
| 670 | if (m) { |
| 671 | return String.fromCharCode(parseInt(m[1], 10)); |
| 672 | } else if (!!(m = name.match(HEX_ESCAPE_RE_))) { |
| 673 | return String.fromCharCode(parseInt(m[1], 16)); |
| 674 | } |
| 675 | // If unable to decode, return the name. |
| 676 | return name; |
| 677 | } |
| 678 | |
| 679 | /** |
| 680 | * Removes null characters on the string. |
nothing calls this directly
no outgoing calls
no test coverage detected