1 /******************************************************************************* 2 3 Html entities. Built on the basis of the xml entities. 4 5 Copyright: 6 Copyright (c) 2009-2016 dunnhumby Germany GmbH. 7 All rights reserved. 8 9 License: 10 Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. 11 Alternatively, this file may be distributed under the terms of the Tango 12 3-Clause BSD License (see LICENSE_BSD.txt for details). 13 14 *******************************************************************************/ 15 16 module ocean.text.entities.HtmlEntitySet; 17 18 19 20 import ocean.text.entities.model.IEntitySet; 21 22 import ocean.text.entities.XmlEntitySet; 23 24 import ocean.meta.types.Qualifiers; 25 26 /******************************************************************************* 27 28 Html entity set class - extends XmlEntitySet 29 30 *******************************************************************************/ 31 32 public class HtmlEntitySet : XmlEntitySet 33 { 34 /*************************************************************************** 35 36 This alias. 37 38 ***************************************************************************/ 39 40 public alias typeof(this) This; 41 42 43 /*************************************************************************** 44 45 ISO 8859-1 (Latin 1) character entities. Uses the basic xml entities, 46 plus the ISO8859_1_extra entities defined below. 47 48 ***************************************************************************/ 49 50 protected static immutable Entity[] ISO8859_1 = xml_entities ~ ISO8859_1_extra; 51 52 53 /*************************************************************************** 54 55 All html entities. Union of ISO 8859-1 (Latin 1) and -15 (Latin 9) 56 character entities. 57 58 ***************************************************************************/ 59 60 public static immutable Entity[] html_entities = ISO8859_1 ~ ISO8859_15_extra; 61 62 63 /*************************************************************************** 64 65 Extra characters of ISO 8859-1 (Latin 1) (in addition to the xml 66 entities) 67 68 ***************************************************************************/ 69 70 protected static immutable Entity[] ISO8859_1_extra = 71 [ 72 {"nbsp", 0x00A0}, // ' ' 73 {"iexcl", 0x00A1}, // '¡' 74 {"cent", 0x00A2}, // '¢' 75 {"pound", 0x00A3}, // '£' 76 {"curren", 0x00A4}, // '¤' 77 {"yen", 0x00A5}, // '¥' 78 {"brvbar", 0x00A6}, // '¦' 79 {"sect", 0x00A7}, // '§' 80 {"uml", 0x00A8}, // '¨' 81 {"copy", 0x00A9}, // '©' 82 {"ordf", 0x00AA}, // 'ª' 83 {"laquo", 0x00AB}, // '«' 84 {"not", 0x00AC}, // '¬' 85 {"shy", 0x00AD}, // '' 86 {"reg", 0x00AE}, // '®' 87 {"macr", 0x00AF}, // '¯' 88 {"deg", 0x00B0}, // '°' 89 {"plusmn", 0x00B1}, // '±' 90 {"sup2", 0x00B2}, // '²' 91 {"sup3", 0x00B3}, // '³' 92 {"acute", 0x00B4}, // '´' 93 {"micro", 0x00B5}, // 'µ' 94 {"para", 0x00B6}, // '¶' 95 {"middot", 0x00B7}, // '·' 96 {"cedil", 0x00B8}, // '¸' 97 {"sup1", 0x00B9}, // '¹' 98 {"ordm", 0x00BA}, // 'º' 99 {"raquo", 0x00BB}, // '»' 100 {"frac14", 0x00BC}, // '¼' 101 {"frac12", 0x00BD}, // '½' 102 {"frac34", 0x00BE}, // '¾' 103 {"iquest", 0x00BF}, // '¿' 104 {"Agrave", 0x00C0}, // 'À' 105 {"Aacute", 0x00C1}, // 'Á' 106 {"Acirc", 0x00C2}, // 'Â' 107 {"Atilde", 0x00C3}, // 'Ã' 108 {"Auml", 0x00C4}, // 'Ä' 109 {"Aring", 0x00C5}, // 'Å' 110 {"AElig", 0x00C6}, // 'Æ' 111 {"Ccedil", 0x00C7}, // 'Ç' 112 {"Egrave", 0x00C8}, // 'È' 113 {"Eacute", 0x00C9}, // 'É' 114 {"Ecirc", 0x00CA}, // 'Ê' 115 {"Euml", 0x00CB}, // 'Ë' 116 {"Igrave", 0x00CC}, // 'Ì' 117 {"Iacute", 0x00CD}, // 'Í' 118 {"Icirc", 0x00CE}, // 'Î' 119 {"Iuml", 0x00CF}, // 'Ï' 120 {"ETH", 0x00D0}, // 'Ð' 121 {"Ntilde", 0x00D1}, // 'Ñ' 122 {"Ograve", 0x00D2}, // 'Ò' 123 {"Oacute", 0x00D3}, // 'Ó' 124 {"Ocirc", 0x00D4}, // 'Ô' 125 {"Otilde", 0x00D5}, // 'Õ' 126 {"Ouml", 0x00D6}, // 'Ö' 127 {"times", 0x00D7}, // '×' 128 {"Oslash", 0x00D8}, // 'Ø' 129 {"Ugrave", 0x00D9}, // 'Ù' 130 {"Uacute", 0x00DA}, // 'Ú' 131 {"Ucirc", 0x00DB}, // 'Û' 132 {"Uuml", 0x00DC}, // 'Ü' 133 {"Yacute", 0x00DD}, // 'Ý' 134 {"THORN", 0x00DE}, // 'Þ' 135 {"szlig", 0x00DF}, // 'ß' 136 {"agrave", 0x00E0}, // 'à' 137 {"aacute", 0x00E1}, // 'á' 138 {"acirc", 0x00E2}, // 'â' 139 {"atilde", 0x00E3}, // 'ã' 140 {"auml", 0x00E4}, // 'ä' 141 {"aring", 0x00E5}, // 'å' 142 {"aelig", 0x00E6}, // 'æ' 143 {"ccedil", 0x00E7}, // 'ç' 144 {"egrave", 0x00E8}, // 'è' 145 {"eacute", 0x00E9}, // 'é' 146 {"ecirc", 0x00EA}, // 'ê' 147 {"euml", 0x00EB}, // 'ë' 148 {"igrave", 0x00EC}, // 'ì' 149 {"iacute", 0x00ED}, // 'í' 150 {"icirc", 0x00EE}, // 'î' 151 {"iuml", 0x00EF}, // 'ï' 152 {"eth", 0x00F0}, // 'ð' 153 {"ntilde", 0x00F1}, // 'ñ' 154 {"ograve", 0x00F2}, // 'ò' 155 {"oacute", 0x00F3}, // 'ó' 156 {"ocirc", 0x00F4}, // 'ô' 157 {"otilde", 0x00F5}, // 'õ' 158 {"ouml", 0x00F6}, // 'ö' 159 {"divide", 0x00F7}, // '÷' 160 {"oslash", 0x00F8}, // 'ø' 161 {"ugrave", 0x00F9}, // 'ù' 162 {"uacute", 0x00FA}, // 'ú' 163 {"ucirc", 0x00FB}, // 'û' 164 {"uuml", 0x00FC}, // 'ü' 165 {"yacute", 0x00FD}, // 'ý' 166 {"yuml", 0x00FF}, // 'ÿ' 167 {"thorn", 0x00FE}, // 'þ' 168 ]; 169 170 171 /*************************************************************************** 172 173 Extra characters of ISO 8859-15 (Latin 9) which are not in ISO 8859-1 174 (Latin 1) 175 176 ***************************************************************************/ 177 178 protected static immutable Entity[] ISO8859_15_extra = 179 [ 180 {"OElig", 0x0152}, // 'Œ' 181 {"OElig", 0x0153}, // 'œ' 182 {"Scaron", 0x0160}, // 'Š' 183 {"scaron", 0x0161}, // 'š' 184 {"Zcaron", 0x017D}, // 'Ž' 185 {"zcaron", 0x017E}, // 'ž' 186 {"euro", 0x20AC}, // '€' 187 ]; 188 189 190 /*************************************************************************** 191 192 Returns the list of entities. 193 194 ***************************************************************************/ 195 196 public override const(Entity)[] entities ( ) 197 { 198 return This.html_entities; 199 } 200 } 201