entities.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. var freeze = require('./conventions').freeze;
  2. /**
  3. * The entities that are predefined in every XML document.
  4. *
  5. * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
  6. * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
  7. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
  8. */
  9. exports.XML_ENTITIES = freeze({amp:'&', apos:"'", gt:'>', lt:'<', quot:'"'})
  10. /**
  11. * A map of currently 241 entities that are detected in an HTML document.
  12. * They contain all entries from `XML_ENTITIES`.
  13. *
  14. * @see XML_ENTITIES
  15. * @see DOMParser.parseFromString
  16. * @see DOMImplementation.prototype.createHTMLDocument
  17. * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec
  18. * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
  19. * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
  20. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
  21. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
  22. */
  23. exports.HTML_ENTITIES = freeze({
  24. lt: '<',
  25. gt: '>',
  26. amp: '&',
  27. quot: '"',
  28. apos: "'",
  29. Agrave: "À",
  30. Aacute: "Á",
  31. Acirc: "Â",
  32. Atilde: "Ã",
  33. Auml: "Ä",
  34. Aring: "Å",
  35. AElig: "Æ",
  36. Ccedil: "Ç",
  37. Egrave: "È",
  38. Eacute: "É",
  39. Ecirc: "Ê",
  40. Euml: "Ë",
  41. Igrave: "Ì",
  42. Iacute: "Í",
  43. Icirc: "Î",
  44. Iuml: "Ï",
  45. ETH: "Ð",
  46. Ntilde: "Ñ",
  47. Ograve: "Ò",
  48. Oacute: "Ó",
  49. Ocirc: "Ô",
  50. Otilde: "Õ",
  51. Ouml: "Ö",
  52. Oslash: "Ø",
  53. Ugrave: "Ù",
  54. Uacute: "Ú",
  55. Ucirc: "Û",
  56. Uuml: "Ü",
  57. Yacute: "Ý",
  58. THORN: "Þ",
  59. szlig: "ß",
  60. agrave: "à",
  61. aacute: "á",
  62. acirc: "â",
  63. atilde: "ã",
  64. auml: "ä",
  65. aring: "å",
  66. aelig: "æ",
  67. ccedil: "ç",
  68. egrave: "è",
  69. eacute: "é",
  70. ecirc: "ê",
  71. euml: "ë",
  72. igrave: "ì",
  73. iacute: "í",
  74. icirc: "î",
  75. iuml: "ï",
  76. eth: "ð",
  77. ntilde: "ñ",
  78. ograve: "ò",
  79. oacute: "ó",
  80. ocirc: "ô",
  81. otilde: "õ",
  82. ouml: "ö",
  83. oslash: "ø",
  84. ugrave: "ù",
  85. uacute: "ú",
  86. ucirc: "û",
  87. uuml: "ü",
  88. yacute: "ý",
  89. thorn: "þ",
  90. yuml: "ÿ",
  91. nbsp: "\u00a0",
  92. iexcl: "¡",
  93. cent: "¢",
  94. pound: "£",
  95. curren: "¤",
  96. yen: "¥",
  97. brvbar: "¦",
  98. sect: "§",
  99. uml: "¨",
  100. copy: "©",
  101. ordf: "ª",
  102. laquo: "«",
  103. not: "¬",
  104. shy: "­­",
  105. reg: "®",
  106. macr: "¯",
  107. deg: "°",
  108. plusmn: "±",
  109. sup2: "²",
  110. sup3: "³",
  111. acute: "´",
  112. micro: "µ",
  113. para: "¶",
  114. middot: "·",
  115. cedil: "¸",
  116. sup1: "¹",
  117. ordm: "º",
  118. raquo: "»",
  119. frac14: "¼",
  120. frac12: "½",
  121. frac34: "¾",
  122. iquest: "¿",
  123. times: "×",
  124. divide: "÷",
  125. forall: "∀",
  126. part: "∂",
  127. exist: "∃",
  128. empty: "∅",
  129. nabla: "∇",
  130. isin: "∈",
  131. notin: "∉",
  132. ni: "∋",
  133. prod: "∏",
  134. sum: "∑",
  135. minus: "−",
  136. lowast: "∗",
  137. radic: "√",
  138. prop: "∝",
  139. infin: "∞",
  140. ang: "∠",
  141. and: "∧",
  142. or: "∨",
  143. cap: "∩",
  144. cup: "∪",
  145. 'int': "∫",
  146. there4: "∴",
  147. sim: "∼",
  148. cong: "≅",
  149. asymp: "≈",
  150. ne: "≠",
  151. equiv: "≡",
  152. le: "≤",
  153. ge: "≥",
  154. sub: "⊂",
  155. sup: "⊃",
  156. nsub: "⊄",
  157. sube: "⊆",
  158. supe: "⊇",
  159. oplus: "⊕",
  160. otimes: "⊗",
  161. perp: "⊥",
  162. sdot: "⋅",
  163. Alpha: "Α",
  164. Beta: "Β",
  165. Gamma: "Γ",
  166. Delta: "Δ",
  167. Epsilon: "Ε",
  168. Zeta: "Ζ",
  169. Eta: "Η",
  170. Theta: "Θ",
  171. Iota: "Ι",
  172. Kappa: "Κ",
  173. Lambda: "Λ",
  174. Mu: "Μ",
  175. Nu: "Ν",
  176. Xi: "Ξ",
  177. Omicron: "Ο",
  178. Pi: "Π",
  179. Rho: "Ρ",
  180. Sigma: "Σ",
  181. Tau: "Τ",
  182. Upsilon: "Υ",
  183. Phi: "Φ",
  184. Chi: "Χ",
  185. Psi: "Ψ",
  186. Omega: "Ω",
  187. alpha: "α",
  188. beta: "β",
  189. gamma: "γ",
  190. delta: "δ",
  191. epsilon: "ε",
  192. zeta: "ζ",
  193. eta: "η",
  194. theta: "θ",
  195. iota: "ι",
  196. kappa: "κ",
  197. lambda: "λ",
  198. mu: "μ",
  199. nu: "ν",
  200. xi: "ξ",
  201. omicron: "ο",
  202. pi: "π",
  203. rho: "ρ",
  204. sigmaf: "ς",
  205. sigma: "σ",
  206. tau: "τ",
  207. upsilon: "υ",
  208. phi: "φ",
  209. chi: "χ",
  210. psi: "ψ",
  211. omega: "ω",
  212. thetasym: "ϑ",
  213. upsih: "ϒ",
  214. piv: "ϖ",
  215. OElig: "Œ",
  216. oelig: "œ",
  217. Scaron: "Š",
  218. scaron: "š",
  219. Yuml: "Ÿ",
  220. fnof: "ƒ",
  221. circ: "ˆ",
  222. tilde: "˜",
  223. ensp: " ",
  224. emsp: " ",
  225. thinsp: " ",
  226. zwnj: "‌",
  227. zwj: "‍",
  228. lrm: "‎",
  229. rlm: "‏",
  230. ndash: "–",
  231. mdash: "—",
  232. lsquo: "‘",
  233. rsquo: "’",
  234. sbquo: "‚",
  235. ldquo: "“",
  236. rdquo: "”",
  237. bdquo: "„",
  238. dagger: "†",
  239. Dagger: "‡",
  240. bull: "•",
  241. hellip: "…",
  242. permil: "‰",
  243. prime: "′",
  244. Prime: "″",
  245. lsaquo: "‹",
  246. rsaquo: "›",
  247. oline: "‾",
  248. euro: "€",
  249. trade: "™",
  250. larr: "←",
  251. uarr: "↑",
  252. rarr: "→",
  253. darr: "↓",
  254. harr: "↔",
  255. crarr: "↵",
  256. lceil: "⌈",
  257. rceil: "⌉",
  258. lfloor: "⌊",
  259. rfloor: "⌋",
  260. loz: "◊",
  261. spades: "♠",
  262. clubs: "♣",
  263. hearts: "♥",
  264. diams: "♦"
  265. });
  266. /**
  267. * @deprecated use `HTML_ENTITIES` instead
  268. * @see HTML_ENTITIES
  269. */
  270. exports.entityMap = exports.HTML_ENTITIES