htmldefs.pp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. {
  2. $Id: htmldefs.pp,v 1.2 2006/01/03 23:33:23 lukvdl Exp $
  3. This file is part of the Free Component Library
  4. HTML definitions and utility functions
  5. Copyright (c) 2000-2002 by
  6. Areca Systems GmbH / Sebastian Guenther, [email protected]
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. unit HTMLDefs;
  14. {$MODE objfpc}
  15. {$H+}
  16. interface
  17. type
  18. THTMLCData = string;
  19. THTMLID = string;
  20. THTMLName = string;
  21. THTMLIDRef = string;
  22. THTMLIDRefs = string;
  23. THTMLNumber = longint;
  24. THTMLText = THTMLCData;
  25. THTMLCharsets = THTMLCData;
  26. THTMLContentTypes = THTMLCData;
  27. THTMLURI = string;
  28. THTMLCharacter = char;
  29. THTMLDir = (dirEmpty,dirLeftToRight,dirRightToLeft);
  30. THTMLalign = (alEmpty,alleft,alcenter,alright,aljustify,alchar);
  31. THTMLvalign = (vaEmpty,vatop,vamiddle,vabottom,vabaseline);
  32. THTMLframe = (frEmpty,frvoid,frabove,frbelow,frhsides,frvsides,frlefthandsise,frrighthandside,frbox,frborder);
  33. THTMLrules = (ruEmpty,runone,rugroups,rurows,rucols,ruall);
  34. THTMLvaluetype = (vtEmpty,vtdata,vtref,vtobject);
  35. THTMLshape = (shEmpty,shdefault,shrect,shcircle,shpoly);
  36. THTMLinputtype = (itEmpty,ittext,itpassword,itcheckbox,itradio,itsubmit,itreset,itfile,ithidden,itimage,itbutton);
  37. THTMLbuttontype = (btEmpty,btsubmit,btreset,btbutton);
  38. THTMLColor = (
  39. clHTMLBlack, clHTMLSilver, clHTMLGray, clHTMLWhite, clHTMLMaroon,
  40. // #000000 #C0C0C0 #808080 #FFFFFF #800000
  41. clHTMLRed, clHTMLPurple, clHTMLFuchsia,clHTMLGreen, clHTMLLime, clHTMLOlive,
  42. // #FF0000 #800080 #FF00FF #008000 #00FF00 #808000
  43. clHTMLYellow,clHTMLNavy, clHTMLBlue, clHTMLTeal, clHTMLAqua
  44. // #FFFF00 #000080 #0000FF #008080 #00FFFF
  45. );
  46. THTMLAttributeTag = (
  47. atabbr, atacceptcharset, ataccept, ataccesskey, ataction, atalign, atalt, atarchive,
  48. ataxis, atborder, atcellpadding, atcellspacing, atchar, atcharoff, atcharset,
  49. atchecked, atcite, atclass, atclassid, atcodebase, atcodetype, atcols,
  50. atcolspan, atcontent, atcoords, atdata, atdatetime, atdeclare,atdefer,
  51. atdir, atdisabled, atenctype, atfor, atframe, atframeborder, atheaders,
  52. atheight, athref, athreflang, athttpequiv, atid, atismap, atlabel, atlang,
  53. atlongdesc, atmarginheight, atmarginwidth, atmaxlength, atmedia, atmethod,
  54. atmultiple, atname, atnohref, atnoresize, atonblur, atonchange, atonclick,
  55. atondblclick, atonfocus, atonkeydown, atonkeypress, atonkeyup, atonload,
  56. atonmousedown, atonmousemove, atonmouseout, atonmouseover, atonmouseup,
  57. atonreset, atonselect, atonsubmit, atonunload, atprofile, atreadonly,
  58. atrel, atrev, atrows, atrowspan, atrules, atscheme, atscope, atscrolling,
  59. atselected, atshape, atsize, atspan, atsrc, atstandby, atstyle, atsummary,
  60. attabindex, attarget, attitle, attype, atusemap, atvalign, atvalue,
  61. atvaluetype, atwidth
  62. );
  63. THTMLAttributeSet = set of THTMLAttributeTag;
  64. THTMLElementTag = (
  65. eta, etabbr, etacronym, etaddress, etapplet, etarea, etb, etbase,
  66. etbasefont, etbdo, etbig, etblockquote, etbody, etbr, etbutton,
  67. etcaption, etcenter, etcite, etcode, etcol, etcolgroup, etdd, etdel,
  68. etdfn, etdir, etdiv, etdl, etdt, etem, etfieldset, etfont, etform,
  69. etframe, etframeset, eth1, eth2, eth3, eth4, eth5, eth6, ethead, ethr,
  70. ethtml, eti, etiframe, etimg, etinput, etins, etisindex, etkbd, etlabel,
  71. etlegend, etli, etlink, etmap, etmenu, etmeta, etnoframes, etnoscript,
  72. etobject, etol, etoptgroup, etoption, etp, etparam, etpre, etq, ets,
  73. etsamp, etscript, etselect, etsmall, etspan, etstrike, etstrong,
  74. etstyle, etsub, etsup, ettable, ettbody, ettd, ettextarea, ettfoot,
  75. etth, etthead, ettitle, ettr, ettt, etu, etul, etvar,
  76. etText, etUnknown
  77. );
  78. THTMLElementTagSet = set of THTMLElementTag;
  79. THTMLElementFlag = (
  80. efSubelementContent, // may have subelements
  81. efPCDATAContent, // may have PCDATA content
  82. efPreserveWhitespace, // preserve all whitespace
  83. efDeprecated, // can be dropped in future versions
  84. efNoChecks // Checks (attributes,subtags,...) can only be implemented in descendants
  85. );
  86. THTMLElementFlags = set of THTMLElementFlag;
  87. PHTMLElementProps = ^THTMLElementProps;
  88. THTMLElementProps = record
  89. Name: String;
  90. Flags: THTMLElementFlags;
  91. Attributes: THTMLAttributeSet;
  92. end;
  93. const
  94. BooleanAttributes = [atchecked,atdeclare,atdefer,atdisabled,atnohref,atnoresize,
  95. atmultiple,atreadonly,atselected];
  96. efSubcontent = [efSubelementContent, efPCDATAContent];
  97. atsi18n = [atlang, atdir];
  98. atscoreattrs = [atid,atclass,atstyle,attitle];
  99. atsevents = [atonclick,atondblclick,atonmousedown,atonmouseup,atonmouseover,
  100. atonmousemove,atonmouseout,atonkeypress,atonkeydown,atonkeyup];
  101. atsattrs = atsevents + atscoreattrs + atsi18n;
  102. atscellhalign = [atalign, atchar, atcharoff];
  103. { etsStructured := [];
  104. etsDivisions := [];
  105. etsLists := [];
  106. etsLinks := [];
  107. etsObjects := [etImg, etObject, etApplet, etMap, etArea];
  108. etsForms := [etForm];
  109. etsText = etsStructured + etsDivisions + etsLists + etsLinks + etsObjects +
  110. etsForms +
  111. etTable + etText + etScript + ; }
  112. HTMLElementProps: array[THTMLElementTag] of THTMLElementProps = (
  113. (Name: 'a'; Flags: efSubcontent;
  114. Attributes: atsattrs+[atcharset,attype,atname,athref,athreflang,atrel,atrev,
  115. ataccesskey,atshape,atcoords,attabindex,atonfocus,atonblur]),
  116. (Name: 'abbr'; Flags: efSubcontent; Attributes: atsattrs),
  117. (Name: 'acronym'; Flags: efSubcontent; Attributes: atsattrs),
  118. (Name: 'address'; Flags: efSubcontent; Attributes: atsattrs),
  119. (Name: 'applet'; Flags: efSubcontent+[efDeprecated];
  120. Attributes: atscoreattrs+[atcodebase,atarchive,atalt,atname,atwidth,atheight]),
  121. (Name: 'area'; Flags: [];
  122. Attributes: atsattrs+[atshape,atcoords,athref,atnohref,atalt,attabindex,
  123. ataccesskey,atonfocus,atonblur]),
  124. (Name: 'b'; Flags: efSubcontent; Attributes: atsattrs),
  125. (Name: 'base'; Flags: []; Attributes: [athref]),
  126. (Name: 'basefont'; Flags: [efDeprecated]; Attributes: [atid]),
  127. (Name: 'bdo'; Flags: efSubcontent; Attributes: atscoreattrs+[atlang,atdir]),
  128. (Name: 'big'; Flags: efSubcontent; Attributes: atsattrs),
  129. (Name: 'blockquote';Flags: [efSubelementContent]; Attributes: atsattrs+[atcite]),
  130. (Name: 'body'; Flags: [efSubelementContent];
  131. Attributes: atsAttrs+[atonload, atonunload]),
  132. (Name: 'br'; Flags: []; Attributes: atscoreattrs),
  133. (Name: 'button'; Flags: efSubcontent;
  134. Attributes: atsattrs+[atname,atvalue,attype,atdisabled,attabindex,
  135. ataccesskey,atonfocus,atonblur]),
  136. (Name: 'caption'; Flags: efSubcontent; Attributes: atsattrs),
  137. (Name: 'center'; Flags: [efSubelementContent,efDeprecated]; Attributes: []),
  138. (Name: 'cite'; Flags: efSubcontent; Attributes: atsattrs),
  139. (Name: 'code'; Flags: efSubcontent; Attributes: atsattrs),
  140. (Name: 'col'; Flags: [];
  141. Attributes: atsattrs+atscellhalign+[atvalign,atspan,atwidth]),
  142. (Name: 'colgroup'; Flags: [efSubelementContent];
  143. Attributes: atsattrs+atscellhalign+[atvalign,atspan,atwidth]),
  144. (Name: 'dd'; Flags: efSubcontent; Attributes: atsattrs),
  145. (Name: 'del'; Flags: [efSubelementContent]; Attributes: atsattrs+[atcite,atdatetime]),
  146. (Name: 'dfn'; Flags: efSubcontent; Attributes: atsattrs),
  147. (Name: 'dir'; Flags: [efSubelementContent,efDeprecated]; Attributes: atsattrs),
  148. (Name: 'div'; Flags: [efSubelementContent]; Attributes: atsattrs),
  149. (Name: 'dl'; Flags: [efSubelementContent]; Attributes: atsattrs),
  150. (Name: 'dt'; Flags: [efPCDataContent]; Attributes: atsattrs),
  151. (Name: 'em'; Flags: efSubcontent; Attributes: atsattrs),
  152. (Name: 'fieldset'; Flags: efSubcontent; Attributes: atsattrs),
  153. (Name: 'font'; Flags: efSubcontent+[efDeprecated]; Attributes: atscoreattrs+atsi18n),
  154. (Name: 'form'; Flags: [efSubelementContent];
  155. Attributes: atsattrs+[ataction,atmethod,atenctype,atonsubmit,atonreset,atacceptcharset]),
  156. (Name: 'frame'; Flags: [];
  157. Attributes: atscoreattrs+[atlongdesc,atname,atsrc,atframeborder,
  158. atmarginwidth,atmarginheight,atnoresize,atscrolling]),
  159. (Name: 'frameset'; Flags: efSubcontent;
  160. Attributes: atsCoreattrs+[atrows,atcols,atonload,atonunload]),
  161. (Name: 'h1'; Flags: efSubcontent; Attributes: atsattrs),
  162. (Name: 'h2'; Flags: efSubcontent; Attributes: atsattrs),
  163. (Name: 'h3'; Flags: efSubcontent; Attributes: atsattrs),
  164. (Name: 'h4'; Flags: efSubcontent; Attributes: atsattrs),
  165. (Name: 'h5'; Flags: efSubcontent; Attributes: atsattrs),
  166. (Name: 'h6'; Flags: efSubcontent; Attributes: atsattrs),
  167. (Name: 'head'; Flags: [efSubelementContent]; Attributes: atsi18n+[atprofile]),
  168. (Name: 'hr'; Flags: []; Attributes: atscoreattrs+atsevents),
  169. (Name: 'html'; Flags: [efSubelementContent]; Attributes: atsi18n),
  170. (Name: 'i'; Flags: efSubcontent; Attributes: atsattrs),
  171. (Name: 'iframe'; Flags: [efSubelementContent];
  172. Attributes: atscoreattrs+[atlongdesc,atname,atsrc,atframeborder,atmarginwidth,
  173. atmarginheight,atscrolling,atalign,atheight,atwidth]),
  174. (Name: 'img'; Flags: [];
  175. Attributes: atsattrs+[atsrc,atalt,atlongdesc,atheight,atwidth,atusemap,atismap]),
  176. (Name: 'input'; Flags: [];
  177. Attributes: atsattrs+[attype,atname,atvalue,atchecked,atdisabled,
  178. atreadonly,atsize,atmaxlength,atsrc,atalt,atusemap,attabindex,
  179. ataccesskey,atonfocus,atonblur,atonselect,atonchange,ataccept]),
  180. (Name: 'ins'; Flags: [efSubelementContent]; Attributes: atsattrs+[atcite,atdatetime]),
  181. (Name: 'isindex'; Flags: [efDeprecated]; Attributes: atscoreattrs+atsi18n),
  182. (Name: 'kbd'; Flags: efSubcontent; Attributes: atsattrs),
  183. (Name: 'label'; Flags: efSubcontent;
  184. Attributes: atsattrs+[atfor,ataccesskey,atonfocus,atonblur]),
  185. (Name: 'legend'; Flags: efSubcontent; Attributes: atsattrs+[ataccesskey]),
  186. (Name: 'li'; Flags: efSubcontent; Attributes: atsattrs),
  187. (Name: 'link'; Flags: [];
  188. Attributes: atsattrs+[atcharset,athref,athreflang,attype,atrel,atrev,atmedia]),
  189. (Name: 'map'; Flags: [efSubelementContent]; Attributes: atsattrs+[atname]),
  190. (Name: 'menu'; Flags: [efSubelementContent,efDeprecated]; Attributes: atsattrs),
  191. (Name: 'meta'; Flags: []; Attributes: atsi18n+[athttpequiv,atname,atcontent,atscheme]),
  192. (Name: 'noframes'; Flags: efSubcontent; Attributes: atsattrs),
  193. (Name: 'noscript'; Flags: efSubcontent; Attributes: atsattrs),
  194. (Name: 'object'; Flags: efSubcontent;
  195. Attributes: atsattrs+[atdeclare,atclassid,atcodebase,atdata,attype,atcodetype,
  196. atarchive,atstandby,atheight,atwidth,atusemap,atname,attabindex]),
  197. (Name: 'ol'; Flags: [efSubelementContent]; Attributes: atsattrs),
  198. (Name: 'optgroup'; Flags: efSubcontent; Attributes: atsattrs+[atdisabled,atlabel]),
  199. (Name: 'option'; Flags: efSubcontent;
  200. Attributes: atsattrs+[atselected,atdisabled,atlabel,atvalue]),
  201. (Name: 'p'; Flags: efSubcontent; Attributes: atsattrs),
  202. (Name: 'param'; Flags: []; Attributes: [atid,atname,atvalue,atvaluetype,attype]),
  203. (Name: 'pre'; Flags: efSubcontent + [efPreserveWhitespace]; Attributes: atsattrs),
  204. (Name: 'q'; Flags: efSubcontent; Attributes: atsattrs+[atcite]),
  205. (Name: 's'; Flags: efSubcontent+[efDeprecated]; Attributes: atsattrs),
  206. (Name: 'samp'; Flags: efSubcontent; Attributes: atsattrs),
  207. (Name: 'script'; Flags: [efPCDATAContent]; Attributes: [atcharset,attype,atsrc,atdefer]),
  208. (Name: 'select'; Flags: [efSubelementContent];
  209. Attributes: atsattrs+[atname,atsize,atmultiple,atdisabled,attabindex,atonfocus,
  210. atonblur,atonchange]),
  211. (Name: 'small'; Flags: efSubcontent; Attributes: atsattrs),
  212. (Name: 'span'; Flags: efSubcontent; Attributes: atsattrs),
  213. (Name: 'strike'; Flags: efSubcontent+[efDeprecated]; Attributes: atsattrs),
  214. (Name: 'strong'; Flags: efSubcontent; Attributes: atsattrs),
  215. (Name: 'style'; Flags: [efPCDATAContent];
  216. Attributes: atsi18n+[attype,atmedia,attitle]),
  217. (Name: 'sub'; Flags: efSubcontent; Attributes: atsattrs),
  218. (Name: 'sup'; Flags: efSubcontent; Attributes: atsattrs),
  219. (Name: 'table'; Flags: [efSubelementContent];
  220. Attributes: atsattrs+[atsummary,atwidth,atborder,atframe,atrules,atcellspacing,atcellpadding]),
  221. (Name: 'tbody'; Flags: [efSubelementContent]; Attributes: atsattrs+atscellhalign+[atvalign]),
  222. (Name: 'td'; Flags: efSubcontent;
  223. Attributes: atsattrs+atscellhalign+[atvalign,atabbr,ataxis,atheaders,atscope,atrowspan,atcolspan]),
  224. (Name: 'textarea'; Flags: [efPCDATAContent];
  225. Attributes: atsattrs+[atname,atrows,atcols,atdisabled,atreadonly,attabindex,
  226. ataccesskey,atonfocus,atonblur,atonselect,atonchange]),
  227. (Name: 'tfoot'; Flags: [efSubelementContent]; Attributes: atsattrs+atscellhalign+[atvalign]),
  228. (Name: 'th'; Flags: efSubcontent;
  229. Attributes: atsattrs+atscellhalign+[atvalign,atabbr,ataxis,atheaders,atscope,atrowspan,atcolspan]),
  230. (Name: 'thead'; Flags: [efSubelementContent]; Attributes: atsattrs+atscellhalign+[atvalign]),
  231. (Name: 'title'; Flags: efSubcontent; Attributes: atsi18n),
  232. (Name: 'tr'; Flags: [efSubelementContent];
  233. Attributes: atsattrs+atscellhalign+[atvalign]),
  234. (Name: 'tt'; Flags: efSubcontent; Attributes: atsattrs),
  235. (Name: 'u'; Flags: efSubcontent+[efDeprecated]; Attributes: atsattrs),
  236. (Name: 'ul'; Flags: [efSubelementContent]; Attributes: atsattrs),
  237. (Name: 'var'; Flags: efSubcontent; Attributes: atsattrs),
  238. (Name: 'text'; Flags: efSubcontent; Attributes: []),
  239. (Name: 'unknown'; Flags: efSubcontent+[efNoChecks]; Attributes: [])
  240. );
  241. HTMLAttributeTag : array [THTMLAttributeTag] of string = (
  242. 'abbr', 'accept-charset', 'accept', 'accesskey', 'action', 'align', 'alt', 'archive',
  243. 'axis', 'border', 'cellpadding', 'cellspacing', 'char', 'charoff', 'charset',
  244. 'checked', 'cite', 'class', 'classid', 'codebase', 'codetype', 'cols',
  245. 'colspan', 'content', 'coords', 'data', 'datetime', 'declare', 'defer',
  246. 'dir', 'disabled', 'enctype', 'for', 'frame', 'frameborder', 'headers',
  247. 'height', 'href', 'hreflang', 'http-equiv', 'id', 'ismap', 'label', 'lang',
  248. 'longdesc', 'marginheight', 'marginwidth', 'maxlength', 'media', 'method',
  249. 'multiple', 'name', 'nohref', 'noresize', 'onblur', 'onchange', 'onclick',
  250. 'ondblclick', 'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload',
  251. 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup',
  252. 'onreset', 'onselect', 'onsubmit', 'onunload', 'profile', 'readonly',
  253. 'rel', 'rev', 'rows', 'rowspan', 'rules', 'scheme', 'scope', 'scrolling',
  254. 'selected', 'shape', 'size', 'span', 'src', 'standby', 'style', 'summary',
  255. 'tabindex', 'target', 'title', 'type', 'usemap', 'valign', 'value',
  256. 'valuetype', 'width');
  257. HTMLColor : array [THTMLColor] of string =
  258. ('Black', 'Silver', 'Gray', 'White', 'Maroon', 'Red', 'Purple', 'Fuchsia',
  259. 'Green', 'Lime', 'Olive', 'Yellow', 'Navy', 'Blue', 'Teal', 'Aqua');
  260. HTMLDir : array [THTMLDir] of string = ('','LTR','RTL');
  261. HTMLAlign : array [THTMLalign] of string = ('','left','center','right','justify','char');
  262. HTMLvalign : array [THTMLvalign] of string = ('','top','middle','bottom','baseline');
  263. HTMLframe : array [THTMLframe] of string =
  264. ('','void','above','below','hsides','vsides','lhs','rhs','box','border');
  265. HTMLrules : array [THTMLrules] of string = ('','none','groups','rows','cols','all');
  266. HTMLvaluetype : array [THTMLvaluetype] of string = ('','data','ref','object');
  267. HTMLshape : array [THTMLshape] of string = ('','default','rect','circle','poly');
  268. HTMLinputtype : array [THTMLinputtype] of string = ('','text','password','checkbox',
  269. 'radio','submit','reset','file','hidden','image','button');
  270. HTMLbuttontype : array [THTMLbuttontype] of string = ('','submit','reset','button');
  271. // ISO8859-1 mapping:
  272. HTMLEntities: array[#160..#255] of String = (
  273. // 160-191
  274. 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect',
  275. 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr',
  276. 'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot',
  277. 'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest',
  278. // 192-223
  279. 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil',
  280. 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml',
  281. 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times',
  282. 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig',
  283. // 224-255
  284. 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil',
  285. 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml',
  286. 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide',
  287. 'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml');
  288. UnicodeHTMLEntities: array[0..141] of String = (
  289. 'Alpha', // #913
  290. 'Beta', // #914
  291. 'Gamma', // #915
  292. 'Delta', // #916
  293. 'Epsilon', // #917
  294. 'Zeta', // #918
  295. 'Eta', // #919
  296. 'Theta', // #920
  297. 'Iota', // #921
  298. 'Kappa', // #922
  299. 'Lambda', // #923
  300. 'Mu', // #924
  301. 'Nu', // #925
  302. 'Xi', // #926
  303. 'Omicron', // #927
  304. 'Pi', // #928
  305. 'Rho', // #929
  306. 'Sigma', // #931
  307. 'Tau', // #932
  308. 'Upsilon', // #933
  309. 'Phi', // #934
  310. 'Chi', // #935
  311. 'Psi', // #936
  312. 'Omega', // #937
  313. 'alpha', // #945
  314. 'beta', // #946
  315. 'gamma', // #947
  316. 'delta', // #948
  317. 'epsilon', // #949
  318. 'zeta', // #950
  319. 'eta', // #951
  320. 'theta', // #952
  321. 'iota', // #953
  322. 'kappa', // #954
  323. 'lambda', // #955
  324. 'mu', // #956
  325. 'nu', // #957
  326. 'xi', // #958
  327. 'omicron', // #959
  328. 'pi', // #960
  329. 'rho', // #961
  330. 'sigmaf', // #962
  331. 'sigma', // #963
  332. 'tau', // #964
  333. 'upsilon', // #965
  334. 'phi', // #966
  335. 'chi', // #967
  336. 'psi', // #968
  337. 'omega', // #969
  338. 'thetasym', // #977
  339. 'upsih', // #978
  340. 'piv', // #982
  341. 'ensp', // #8194
  342. 'emsp', // #8195
  343. 'thinsp', // #8201
  344. 'zwnj', // #8204
  345. 'zwj', // #8205
  346. 'lrm', // #8206
  347. 'rlm', // #8207
  348. 'ndash', // #8211
  349. 'mdash', // #8212
  350. 'lsquo', // #8216
  351. 'rsquo', // #8217
  352. 'sbquo', // #8218
  353. 'ldquo', // #8220
  354. 'rdquo', // #8221
  355. 'bdquo', // #8222
  356. 'dagger', // #8224
  357. 'Dagger', // #8225
  358. 'bull', // #8226
  359. 'hellip', // #8230
  360. 'permil', // #8240
  361. 'prime', // #8242
  362. 'lsaquo', // #8249
  363. 'rsaquo', // #8250
  364. 'oline', // #8254
  365. 'frasl', // #8260
  366. 'image', // #8465
  367. 'weierp', // #8472
  368. 'real', // #8476
  369. 'trade', // #8482
  370. 'alefsym', // #8501
  371. 'larr', // #8592
  372. 'uarr', // #8593
  373. 'rarr', // #8594
  374. 'darr', // #8595
  375. 'harr', // #8596
  376. 'crarr', // #8629
  377. 'lArr', // #8656
  378. 'uArr', // #8657
  379. 'rArr', // #8658
  380. 'dArr', // #8659
  381. 'hArr', // #8660
  382. 'forall', // #8704
  383. 'part', // #8706
  384. 'exist', // #8707
  385. 'empty', // #8709
  386. 'nabla', // #8711
  387. 'isin', // #8712
  388. 'notin', // #8713
  389. 'ni', // #8715
  390. 'prod', // #8719
  391. 'sum', // #8721
  392. 'minus', // #8722
  393. 'lowast', // #8727
  394. 'radic', // #8730
  395. 'prop', // #8733
  396. 'infin', // #8734
  397. 'ang', // #8736
  398. 'and', // #8743
  399. 'or', // #8744
  400. 'cap', // #8745
  401. 'cup', // #8746
  402. 'int', // #8747
  403. 'there4', // #8756
  404. 'sim', // #8764
  405. 'cong', // #8773
  406. 'asymp', // #8776
  407. 'ne', // #8800
  408. 'equiv', // #8801
  409. 'le', // #8804
  410. 'ge', // #8805
  411. 'sub', // #8834
  412. 'sup', // #8835
  413. 'nsub', // #8836
  414. 'sube', // #8838
  415. 'supe', // #8839
  416. 'oplus', // #8853
  417. 'otimes', // #8855
  418. 'perp', // #8869
  419. 'sdot', // #8901
  420. 'lceil', // #8968
  421. 'rceil', // #8969
  422. 'lfloor', // #8970
  423. 'rfloor', // #8971
  424. 'lang', // #9001
  425. 'rang', // #9002
  426. 'loz', // #9674
  427. 'spades', // #9824
  428. 'clubs', // #9827
  429. 'hearts', // #9829
  430. 'diams' // #9830
  431. );
  432. function ResolveHTMLEntityReference(const Name: String;
  433. var Entity: Char): Boolean;
  434. implementation
  435. uses SysUtils;
  436. function ResolveHTMLEntityReference(const Name: String;
  437. var Entity: Char): Boolean;
  438. var
  439. Ent: Char;
  440. i: Integer;
  441. begin
  442. if Name = 'quot' then
  443. begin
  444. Entity := '"';
  445. Result := True;
  446. end else if Name = 'apos' then
  447. begin
  448. Entity := '''';
  449. Result := True;
  450. end else if Name = 'amp' then
  451. begin
  452. Entity := '&';
  453. Result := True;
  454. end else if Name = 'lt' then
  455. begin
  456. Entity := '<';
  457. Result := True;
  458. end else if Name = 'gt' then
  459. begin
  460. Entity := '>';
  461. Result := True;
  462. end else if (Length(Name) > 0) and (Name[1] = '#') then
  463. begin
  464. for i := 2 to Length(Name) do
  465. if (Name[i] < '0') or (Name[i] > '9') then
  466. break;
  467. if i > 2 then
  468. begin
  469. Entity := Chr(StrToInt(Copy(Name, 2, i - 1)));
  470. Result := True;
  471. end else
  472. Result := False;
  473. end else
  474. begin
  475. for Ent := Low(HTMLEntities) to High(HTMLEntities) do
  476. if HTMLEntities[Ent] = Name then
  477. begin
  478. Entity := Ent;
  479. Result := True;
  480. exit;
  481. end;
  482. Result := False;
  483. end;
  484. end;
  485. end.
  486. {
  487. $Log: htmldefs.pp,v $
  488. Revision 1.2 2006/01/03 23:33:23 lukvdl
  489. + TH: properties forgotten added
  490. Revision 1.1 2005/11/22 21:04:37 michael
  491. + Initial import
  492. Revision 1.4 2005/02/14 17:13:18 peter
  493. * truncate log
  494. }