Initial Commit
[packages] / xemacs-packages / x-symbol / lisp / x-symbol-sgml.el
1 ;;; x-symbol-sgml.el --- token language "SGML entity" for package x-symbol
2
3 ;; Copyright (C) 1996-1999, 2002, 2003 Free Software Foundation, Inc.
4 ;;
5 ;; Author: Christoph Wedler <wedler@users.sourceforge.net>
6 ;; Maintainer: (Please use `M-x x-symbol-package-bug' to contact the maintainer)
7 ;; Version: 4.5
8 ;; Keywords: WYSIWYG, HTML, wp, math, internationalization
9 ;; X-URL: http://x-symbol.sourceforge.net/
10
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15 ;;
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20 ;;
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program; if not, write to the Free Software
23 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
25 ;;; Commentary:
26
27 ;; If you want to use package x-symbol, please visit the URL (use
28 ;; \\[x-symbol-package-web]) and read the info (use \\[x-symbol-package-info]).
29
30 ;; Token language sgml is registered in x-symbol-hooks.
31
32 ;;; Code:
33
34 (provide 'x-symbol-sgml)
35
36
37 ;;;===========================================================================
38 ;;;  Auto-style
39 ;;;===========================================================================
40
41 (defcustom x-symbol-sgml-auto-style
42   '((not (memq major-mode '(sgml-mode xml-mode)))
43     (x-symbol-auto-coding-alist x-symbol-sgml-auto-coding-alist)
44     x-symbol-coding (not x-symbol-mode)
45     x-symbol-mode x-symbol-mode)
46   "Values for X-Symbol's buffer-local variables with language `sgml'.
47 See language access `x-symbol-LANG-auto-style'."
48   :group 'x-symbol-sgml
49   :group 'x-symbol-mode
50   :type 'x-symbol-auto-style)
51
52 (defcustom x-symbol-sgml-auto-coding-alist
53   '(("<meta\\s-+http-equiv\\s-*=\\s-*\"content-type\"\\s-*content\\s-*=\\s-*\"text/html\\s-*;\\s-*charset\\s-*=\\s-*\\([A-Za-z0-9---]+\\)\"\\s-*>" 1
54      ("iso-8859-1" . iso-8859-1)
55      ("iso-8859-2" . iso-8859-2)
56      ("iso-8859-3" . iso-8859-3)
57      ("iso-8859-9" . iso-8859-9)
58      ("iso-8859-15" . iso-8859-15)))
59   "*Alist used to determine the file coding with language `sgml'.
60 Used in the default value of `x-symbol-sgml-auto-style'.  See variable
61 `x-symbol-auto-coding-alist' for details."
62   :group 'x-symbol-sgml
63   :group 'x-symbol-mode
64   :type 'x-symbol-auto-coding)
65
66
67 ;;;===========================================================================
68 ;;;  Miscellaneous variables
69 ;;;===========================================================================
70
71 (defface x-symbol-sgml-symbol-face
72   '((((class color) (background light))
73      (:foreground "orange4")))
74   "*Face used for entities with name representing non-Latin-1 characters.
75 Used in `x-symbol-sgml-class-face-alist'."
76   :group 'x-symbol-sgml
77   :group 'x-symbol-info-general)
78
79 (defface x-symbol-sgml-noname-face
80   '((((class color) (background light))
81      (:foreground "red4")))
82   "*Face used for Latin-N character entities without name.
83 Used in `x-symbol-sgml-class-face-alist'."
84   :group 'x-symbol-sgml
85   :group 'x-symbol-info-general)
86
87 (defcustom x-symbol-sgml-modeline-name "sgml"
88   "Modeline name of token language `sgml'.
89 See language access `x-symbol-LANG-modeline-name'."
90   :group 'x-symbol-sgml
91   :type 'string)
92
93 (defcustom x-symbol-sgml-header-groups-alist
94   '(("Operator" bigop operator)
95     ("Relation" relation)
96     ("Arrow, Punctuation" arrow triangle shape
97      white line dots punctuation quote parenthesis)
98     ("Symbol" symbol currency mathletter setsymbol)
99     ("Greek Letter" greek greek1)
100     ("Misc. Letter" letter slash)
101     ("Cedilla, Ogonek" cedilla ogonek)
102     ("Dotaccent, Ring" dotaccent ring)
103     ("Tilde, Breve" tilde breve)
104     ("Circumflex, Caron" circumflex caron)
105     ("Diaeresis, Umlaut" diaeresis hungarumlaut)
106     ("Acute, Grave" acute grave))
107   "Header/submenu specification of the specific menu for language `sgml'.
108 See language access `x-symbol-LANG-header-groups-alist'."
109   :group 'x-symbol-sgml
110   :group 'x-symbol-input-init
111   :type 'x-symbol-headers)
112
113 (defcustom x-symbol-sgml-class-alist
114   '((symbol)
115     (noname "SGML char-ref" (x-symbol-emph-info-face))
116     (VALID "SGML entity" (x-symbol-info-face))
117     (INVALID "no SGML entity" (x-symbol-emph-info-face)))
118   "Token classes displayed by info in echo area, for language `sgml'.
119 See language access `x-symbol-LANG-class-alist'."
120   :group 'x-symbol-sgml
121   :group 'x-symbol-info-strings
122   :type 'x-symbol-class-info)
123
124 (defcustom x-symbol-sgml-class-face-alist
125   '((symbol x-symbol-sgml-symbol-face (x-symbol-sgml-symbol-face))
126     (noname x-symbol-sgml-noname-face (x-symbol-sgml-noname-face)))
127   "Color scheme in language specific grid and info, for language `sgml'.
128 See language access `x-symbol-LANG-class-face-alist'."
129   :group 'x-symbol-sgml
130   :group 'x-symbol-input-init
131   :group 'x-symbol-info-general
132   :type 'x-symbol-class-faces)
133
134 (defcustom x-symbol-sgml-electric-ignore nil
135   "Specification restricting input method ELECTRIC with language `sgml'.
136 See language access `x-symbol-LANG-electric-ignore'."
137   :group 'x-symbol-sgml
138   :group 'x-symbol-input-control
139   :type 'x-symbol-function-or-regexp)
140
141 (defvar x-symbol-sgml-token-list 'x-symbol-sgml-token-list-name
142   "Symbol specifying the token definition for language `sgml'.
143 Allowed values are
144  - `x-symbol-sgml-token-list-name': the canonical token for a character
145    is a entity references,
146  - `x-symbol-sgml-token-list-code': the canonical token for a character
147    is a character references,
148  - `x-symbol-sgml-token-list-netscape': the canonical token for a
149    Latin-1 character is a entity references, for others, it is a
150    character references.  Bug workaround for Netscape, v4.6 or lower.
151
152 The value is used by function `x-symbol-sgml-default-token-list' which
153 is used for the definition of the conversion tables.  See
154 `x-symbol-sgml-token-grammar'.")
155
156 (defvar x-symbol-sgml-token-grammar
157   '(x-symbol-make-grammar
158     :decode-regexp "&[#0-9A-Za-z]+;"
159     :token-list x-symbol-sgml-default-token-list)
160   "Grammar of token language `sgml'.
161 See language access `x-symbol-LANG-token-grammar'.")
162
163 (defvar x-symbol-sgml-user-table nil
164   "User table defining SGML entities, used in `x-symbol-sgml-table'.")
165
166 (defvar x-symbol-sgml-generated-data nil
167   "Generated data for token language `sgml'.
168 See language access `x-symbol-LANG-generated-data'.")
169
170
171 ;;;===========================================================================
172 ;;;  Image support
173 ;;;===========================================================================
174
175 (defcustom x-symbol-sgml-master-directory 'ignore
176   "Function returning the directory of the master file or nil.
177 See `x-symbol-image-parse-buffer'."
178   :group 'x-symbol-sgml
179   :group 'x-symbol-image-language
180   :type 'function)
181
182 (defcustom x-symbol-sgml-image-searchpath '("./")
183   "Search path for implicitly relative image file names.
184 See language access `x-symbol-LANG-image-searchpath'."
185   :group 'x-symbol-sgml
186   :group 'x-symbol-image-language
187   :type '(repeat directory))
188
189 (defcustom x-symbol-sgml-image-cached-dirs '("images/" "pictures/")
190   "Directory parts of images stored in the memory cache.
191 See language access `x-symbol-LANG-image-cached-dirs'."
192   :group 'x-symbol-sgml
193   :group 'x-symbol-image-language
194   :type '(repeat string))
195
196 (defcustom x-symbol-sgml-image-file-truename-alist
197   '(("\\`file:" . "")
198     ("\\`[A-Za-z]+:"))
199   "Alist used to determine the file name of an image URL.
200 Each element looks like
201   (REGEXP) or
202   (REGEXP . NEWTEXT) or
203   (REGEXP FUNCTION ARG...)
204 If the the image file name is matched by REGEXP, the corresponding
205 element is processed, if no REGEXP matches, the image file name is used
206 as it is.  With the first form, the image command will not be
207 highlighted.  With the second form, replace text matched by REGEXP with
208 NEWTEXT, see `replace-match' for details.  With the third form,
209 FUNCTION, call FUNCTION with the image file name and the remaining
210 arguments ARGs to get the true file name.
211
212 E.g., I add the following element to this variable:
213   (\"\\\\`http://www\\\\.fmi\\\\.uni-passau\\\\.de/~wedler/\" \. \"~/public_html/\")"
214   :group 'x-symbol-sgml
215   :group 'x-symbol-image-language
216   :type '(repeat (cons :format "%v"
217                        :value ("" . "") ; doesn't work (custom bug?)
218                        regexp
219                        (choice ;;:value ""
220                                (const :tag "Not highlighted" nil)
221                                (string :tag "Replace match with")
222                                (cons :tag "Call"
223                                      function
224                                      (repeat :tag "With arguments" sexp))))))
225
226 (defcustom x-symbol-sgml-image-keywords
227   '("\\.\\(gif\\|png\\|jpe?g\\)\\'"
228     ("<img[ \t][^\n>]*src=\"\\([^\n\"]+\\)\"[^\n>]*>"
229      x-symbol-sgml-image-file-truename 1))
230   "Keywords for image insertion commands of language `sgml'.
231 See language access `x-symbol-LANG-image-keywords'."
232   :group 'x-symbol-sgml
233   :group 'x-symbol-image-language
234   :type 'x-symbol-image-keywords)
235
236 (defun x-symbol-sgml-image-file-truename (num)
237   "Return true image file name for last match.
238 Return text matched by the NUMth regexp group of the corresponding
239 keyword regexp, after being processed according to
240 `x-symbol-sgml-image-file-truename-alist'."
241   (x-symbol-match-in-alist (setq num (match-string num))
242                            x-symbol-sgml-image-file-truename-alist
243                            num t))
244
245
246 ;;;===========================================================================
247 ;;;  Super- and Subscripts
248 ;;;===========================================================================
249
250 (defcustom x-symbol-sgml-subscript-matcher 'x-symbol-sgml-subscript-matcher
251   "Function matching super-/subscripts for language `sgml'.
252 See language access `x-symbol-LANG-subscript-matcher'."
253   :group 'x-symbol-sgml
254   :type 'function)
255
256 (defcustom x-symbol-sgml-font-lock-regexp "<su[bp]>"
257   "Regexp matching the start tag of SGML's super- and subscripts.
258 See also `x-symbol-sgml-font-lock-alist'."
259   :group 'x-symbol-sgml
260   :type 'regexp)
261
262 (defcustom x-symbol-sgml-font-lock-limit-regexp "\n\\|</?su[bp]>"
263   "Regexp matching the end tag of SGML's super- and subscripts.
264 This regexp should match the end of line and the closing tags in
265 `x-symbol-sgml-font-lock-alist'."
266   :group 'x-symbol-sgml
267   :type 'regexp)
268
269 (defcustom x-symbol-sgml-font-lock-contents-regexp "[^ \t\n\240]"
270   "*Regexp matching the super- and subscript contents.
271 This regexp should match the text between the opening and closing super-
272 or subscript tag."
273   :group 'x-symbol-sgml
274   :type 'regexp)
275
276 (defcustom x-symbol-sgml-font-lock-alist
277   '(("<sub>" . "</sub>") ("<sup>" . "</sup>"))
278   "Alist for correct tag pairs for HTML's super- and subscripts.
279 Each element looks like (OPEN . CLOSE).  All keys OPEN in this alist
280 should be matched by `x-symbol-sgml-font-lock-regexp', all CLOSEs should
281 be matched by `x-symbol-sgml-font-lock-limit-regexp'."
282   :group 'x-symbol-sgml
283   :type '(repeat (cons :format "%v"
284                        (string :tag "Open tag")
285                        (string :tag "Close tag"))))
286
287
288 ;;;===========================================================================
289 ;;;  The tables
290 ;;;===========================================================================
291
292 (defun x-symbol-sgml-default-token-list (tokens)
293   (mapcar #'list
294           (and (car tokens)
295                (memq x-symbol-sgml-token-list
296                      '(x-symbol-sgml-token-list-name
297                        x-symbol-sgml-token-list-code
298                        x-symbol-sgml-token-list-netscape))
299                (if (or (eq x-symbol-sgml-token-list
300                            'x-symbol-sgml-token-list-name)
301                        (and (eq x-symbol-sgml-token-list
302                                 'x-symbol-sgml-token-list-netscape)
303                             (< (car tokens) 256)))
304                    (append (cdr tokens) (list (format "&#%d;" (car tokens))))
305                  (cons (format "&#%d;" (car tokens)) (cdr tokens))))))
306
307 ;; http://www.w3.org/TR/REC-html40/sgml/entities.html
308 ;; (query-replace-regexp "<!ENTITY[ \t]*\\([A-Za-z][A-Za-z0-9]*\\)[ \t]*CDATA[ \t]*\"&#\\([0-9]+\\);\"[ \t]*--\\(.+\\) -->[ \t]*.*$" " (\\1 () \\2 \"&\\1;\") ; \\3")
309
310 (defvar x-symbol-sgml-latin1-table
311   '((nobreakspace () 160 "&nbsp;")
312     (exclamdown () 161 "&iexcl;")
313     (cent () 162 "&cent;")
314     (sterling () 163 "&pound;")
315     (currency () 164 "&curren;")
316     (yen () 165 "&yen;")
317     (brokenbar () 166 "&brvbar;" "&brkbar;")
318     (section () 167 "&sect;")
319     (diaeresis () 168 "&uml;" "&die;")
320     (copyright () 169 "&copy;")
321     (ordfeminine () 170 "&ordf;")
322     (guillemotleft () 171 "&laquo;")
323     (notsign () 172 "&not;")
324     (hyphen () 173 "&shy;")
325     (registered () 174 "&reg;")
326     (macron () 175 "&macr;" "&hibar;")
327     (degree () 176 "&deg;")
328     (plusminus () 177 "&plusmn;")
329     (twosuperior () 178 "&sup2;")
330     (threesuperior () 179 "&sup3;")
331     (acute () 180 "&acute;")
332     (mu1 () 181 "&micro;")
333     (paragraph () 182 "&para;")
334     (periodcentered () 183 "&middot;")
335     (cedilla () 184 "&cedil;")
336     (onesuperior () 185 "&sup1;")
337     (masculine () 186 "&ordm;")
338     (guillemotright () 187 "&raquo;")
339     (onequarter () 188 "&frac14;")
340     (onehalf () 189 "&frac12;")
341     (threequarters () 190 "&frac34;")
342     (questiondown () 191 "&iquest;")
343     (Agrave () 192 "&Agrave;")
344     (Aacute () 193 "&Aacute;")
345     (Acircumflex () 194 "&Acirc;")
346     (Atilde () 195 "&Atilde;")
347     (Adiaeresis () 196 "&Auml;")
348     (Aring () 197 "&Aring;")
349     (AE () 198 "&AElig;")
350     (Ccedilla () 199 "&Ccedil;")
351     (Egrave () 200 "&Egrave;")
352     (Eacute () 201 "&Eacute;")
353     (Ecircumflex () 202 "&Ecirc;")
354     (Ediaeresis () 203 "&Euml;")
355     (Igrave () 204 "&Igrave;")
356     (Iacute () 205 "&Iacute;")
357     (Icircumflex () 206 "&Icirc;")
358     (Idiaeresis () 207 "&Iuml;")
359     (ETH () 208 "&ETH;") ; "&Dstrok;" for Dbar (U0110) = latin2#208?
360     (Ntilde () 209 "&Ntilde;")
361     (Ograve () 210 "&Ograve;")
362     (Oacute () 211 "&Oacute;")
363     (Ocircumflex () 212 "&Ocirc;")
364     (Otilde () 213 "&Otilde;")
365     (Odiaeresis () 214 "&Ouml;")
366     (multiply () 215 "&times;")
367     (Ooblique () 216 "&Oslash;")
368     (Ugrave () 217 "&Ugrave;")
369     (Uacute () 218 "&Uacute;")
370     (Ucircumflex () 219 "&Ucirc;")
371     (Udiaeresis () 220 "&Uuml;")
372     (Yacute () 221 "&Yacute;")
373     (THORN () 222 "&THORN;")
374     (ssharp () 223 "&szlig;")
375     (agrave () 224 "&agrave;")
376     (aacute () 225 "&aacute;")
377     (acircumflex () 226 "&acirc;")
378     (atilde () 227 "&atilde;")
379     (adiaeresis () 228 "&auml;")
380     (aring () 229 "&aring;")
381     (ae () 230 "&aelig;")
382     (ccedilla () 231 "&ccedil;")
383     (egrave () 232 "&egrave;")
384     (eacute () 233 "&eacute;")
385     (ecircumflex () 234 "&ecirc;")
386     (ediaeresis () 235 "&euml;")
387     (igrave () 236 "&igrave;")
388     (iacute () 237 "&iacute;")
389     (icircumflex () 238 "&icirc;")
390     (idiaeresis () 239 "&iuml;")
391     (eth () 240 "&eth;")
392     (ntilde () 241 "&ntilde;")
393     (ograve () 242 "&ograve;")
394     (oacute () 243 "&oacute;")
395     (ocircumflex () 244 "&ocirc;")
396     (otilde () 245 "&otilde;")
397     (odiaeresis () 246 "&ouml;")
398     (division () 247 "&divide;")
399     (oslash () 248 "&oslash;")
400     (ugrave () 249 "&ugrave;")
401     (uacute () 250 "&uacute;")
402     (ucircumflex () 251 "&ucirc;")
403     (udiaeresis () 252 "&uuml;")
404     (yacute () 253 "&yacute;")
405     (thorn () 254 "&thorn;")
406     (ydiaeresis () 255 "&yuml;"))
407   "Table defining SGML entities, see `x-symbol-sgml-table'.")
408
409 (defvar x-symbol-sgml-latinN-table
410   '((Aogonek (noname) 260)
411     (breve (noname) 728)
412     (Lslash (noname) 321)
413     (Lcaron (noname) 317)
414     (Sacute (noname) 346)
415     (Scaron (symbol) 352 "&Scaron;")
416     (Scedilla (noname) 350)
417     (Tcaron (noname) 356)
418     (Zacute (noname) 377)
419     (Zcaron (noname) 381)
420     (Zdotaccent (noname) 379)
421     (aogonek (noname) 261)
422     (ogonek (noname) 731)
423     (lslash (noname) 322)
424     (lcaron (noname) 318)
425     (sacute (noname) 347)
426     (caron (noname) 711)
427     (scaron (symbol) 353 "&scaron;")
428     (scedilla (noname) 351)
429     (tcaron (noname) 357)
430     (zacute (noname) 378)
431     (hungarumlaut (noname) 733)
432     (zcaron (noname) 382)
433     (zdotaccent (noname) 380)
434     (Racute (noname) 340)
435     (Abreve (noname) 258)
436     (Lacute (noname) 313)
437     (Cacute (noname) 262)
438     (Ccaron (noname) 268)
439     (Eogonek (noname) 280)
440     (Ecaron (noname) 282)
441     (Dcaron (noname) 270)
442     (Dbar (noname) 272)
443     (Nacute (noname) 323)
444     (Ncaron (noname) 327)
445     (Ohungarumlaut (noname) 336)
446     (Rcaron (noname) 344)
447     (Uring (noname) 366)
448     (Uhungarumlaut (noname) 368)
449     (Tcedilla (noname) 354)
450     (racute (noname) 341)
451     (abreve (noname) 259)
452     (lacute (noname) 314)
453     (cacute (noname) 263)
454     (ccaron (noname) 269)
455     (eogonek (noname) 281)
456     (ecaron (noname) 283)
457     (dcaron (noname) 271)
458     (dbar (noname) 273)
459     (nacute (noname) 324)
460     (ncaron (noname) 328)
461     (ohungarumlaut (noname) 337)
462     (rcaron (noname) 345)
463     (uring (noname) 367)
464     (uhungarumlaut (noname) 369)
465     (tcedilla (noname) 355)
466     (dotaccent (noname) 729)
467     (Hbar (noname) 294)
468     (Hcircumflex (noname) 292)
469     (Idotaccent (noname) 304)
470     (Gbreve (noname) 286)
471     (Jcircumflex (noname) 308)
472     (hbar (noname) 295)
473     (hcircumflex (noname) 293)
474     (dotlessi (noname) 305)
475     (gbreve (noname) 287)
476     (jcircumflex (noname) 309)
477     (Cdotaccent (noname) 266)
478     (Ccircumflex (noname) 264)
479     (Gdotaccent (noname) 288)
480     (Gcircumflex (noname) 284)
481     (Ubreve (noname) 364)
482     (Scircumflex (noname) 348)
483     (cdotaccent (noname) 267)
484     (ccircumflex (noname) 265)
485     (gdotaccent (noname) 289)
486     (gcircumflex (noname) 285)
487     (ubreve (noname) 365)
488     (scircumflex (noname) 349)
489     (euro (symbol) 8364 "&euro;")
490     (OE (symbol) 338 "&OElig;")
491     (oe (symbol) 339 "&oelig;")
492     (Ydiaeresis (symbol) 376 "&Yuml;"))
493   "Table defining SGML entities, see `x-symbol-sgml-table'.")
494
495 (defvar x-symbol-sgml-xsymb0-table
496   '((Delta (symbol) 916 "&Delta;")
497     (Phi (symbol) 934 "&Phi;")
498     (Gamma (symbol) 915 "&Gamma;")
499     (theta1 (symbol) 977 "&thetasym;")
500     (Lambda (symbol) 923 "&Lambda;")
501     (Pi (symbol) 928 "&Pi;")
502     (Theta (symbol) 920 "&Theta;")
503     (Sigma (symbol) 931 "&Sigma;")
504     (sigma1 (symbol) 962 "&sigmaf;")
505     (Omega (symbol) 937 "&Omega;")
506     (Xi (symbol) 926 "&Xi;")
507     (Psi (symbol) 936 "&Psi;")
508     (alpha (symbol) 945 "&alpha;")
509     (beta (symbol) 946 "&beta;")
510     (chi (symbol) 967 "&chi;")
511     (delta (symbol) 948 "&delta;")
512     (epsilon (symbol) 949 "&epsilon;")
513     (phi (symbol) 966 "&phi;")
514     (gamma (symbol) 947 "&gamma;")
515     (eta (symbol) 951 "&eta;")
516     (iota (symbol) 953 "&iota;")
517     (kappa (symbol) 954 "&kappa;")
518     (lambda (symbol) 955 "&lambda;")
519     (mu (symbol) 956 "&mu;")
520     (nu (symbol) 957 "&nu;")
521     (pi (symbol) 960 "&pi;")
522     (theta (symbol) 952 "&theta;")
523     (rho (symbol) 961 "&rho;")
524     (sigma (symbol) 963 "&sigma;")
525     (tau (symbol) 964 "&tau;")
526     (upsilon (symbol) 965 "&upsilon;")
527     (omega1 (symbol) 982 "&piv;")
528     (omega (symbol) 969 "&omega;")
529     (xi (symbol) 958 "&xi;")
530     (psi (symbol) 968 "&psi;")
531     (zeta (symbol) 950 "&zeta;")
532     (Upsilon1 (symbol) 978 "&upsih;")
533
534     (florin (symbol) 402 "&fnof;")
535     (bullet (symbol) 8226 "&bull;")
536     (ellipsis (symbol) 8230 "&hellip;")
537     (minute (symbol) 8242 "&prime;")
538     (second (symbol) 8243 "&Prime;")
539     (radicalex (symbol) 8254 "&oline;")
540     (fraction (symbol) 8260 "&frasl;")
541     (weierstrass (symbol) 8472 "&weierp;")
542     (Ifraktur (symbol) 8465 "&image;")
543     (Rfraktur (symbol) 8476 "&real;")
544     (trademark (symbol) 8482 "&trade;")
545     (aleph (symbol) 8501 "&alefsym;")
546     (arrowleft (symbol) 8592 "&larr;")
547     (arrowup (symbol) 8593 "&uarr;")
548     (arrowright (symbol) 8594 "&rarr;")
549     (arrowdown (symbol) 8595 "&darr;")
550     (arrowboth (symbol) 8596 "&harr;")
551     (carriagereturn (symbol) 8629 "&crarr;")
552     (arrowdblleft (symbol) 8656 "&lArr;")
553     (arrowdblup (symbol) 8657 "&uArr;")
554     (arrowdblright (symbol) 8658 "&rArr;")
555     (arrowdbldown (symbol) 8659 "&dArr;")
556     (arrowdblboth (symbol) 8660 "&hArr;")
557
558     (partialdiff (symbol) 8706 "&part;")
559     (emptyset (symbol) 8709 "&empty;")
560     (gradient (symbol) 8711 "&nabla;")
561     (element (symbol) 8712 "&isin;")
562     (notelement (symbol) 8713 "&notin;")
563     (suchthat (symbol) 8715 "&ni;")
564     (product (symbol) 8719 "&prod;")
565     (summation (symbol) 8721 "&sum;")
566     (minus1 (symbol) 8722 "&minus;")
567     (asterisk1 (symbol) 8727 "&lowast;")
568     (radical (symbol) 8730 "&radic;")
569     (proportional (symbol) 8733 "&prop;")
570     (infinity (symbol) 8734 "&infin;")
571     (angle (symbol) 8736 "&ang;")
572     (logicaland (symbol) 8743 "&and;")
573     (logicalor (symbol) 8744 "&or;")
574     (intersection (symbol) 8745 "&cap;")
575     (union (symbol) 8746 "&cup;")
576     (integral (symbol) 8747 "&int;")
577     (similar (symbol) 8764 "&sim;")
578     (congruent (symbol) 8773 "&cong;")
579     (notequal (symbol) 8800 "&ne;")
580     (equivalence (symbol) 8801 "&equiv;")
581     (lessequal (symbol) 8804 "&le;")
582     (greaterequal (symbol) 8805 "&ge;")
583     (propersubset (symbol) 8834 "&sub;")
584     (propersuperset (symbol) 8835 "&sup;")
585     (notsubset (symbol) 8836 "&nsub;")
586     (reflexsubset (symbol) 8838 "&sube;")
587     (reflexsuperset (symbol) 8839 "&supe;")
588     (circleplus (symbol) 8853 "&oplus;")
589     (circlemultiply (symbol) 8855 "&otimes;")
590     (perpendicular (symbol) 8869 "&perp;")
591     (periodcentered1 (symbol) 8901 "&sdot;")
592     (angleleft (symbol) 9001 "&lang;")
593     (angleright (symbol) 9002 "&rang;")
594     (lozenge (symbol) 9674 "&loz;")
595     (spade (symbol) 9824 "&spades;")
596     (club (symbol) 9827 "&clubs;")
597     (heart (symbol) 9829 "&hearts;")
598     (diamond (symbol) 9830 "&diams;"))
599   "Table defining SGML entities, see `x-symbol-sgml-table'.")
600
601 (defvar x-symbol-sgml-xsymb1-table
602   '((ampersand2 () 38 "&amp;")
603     (quotedbl1 () 34 "&quot;")
604     (less2 () 60 "&lt;")
605     (greater2 () 62 "&gt;")
606     (universal1 (symbol) 8704 "&forall;")
607     (existential1 (symbol) 8707 "&exist;")
608     (circumflex (symbol) 710 "&circ;")
609     (tilde (symbol) 732 "&tilde;")
610     ;;(ensp (symbol) 8194 "&ensp;") ;  en space, U+2002 ISOpub
611     ;;(emsp (symbol) 8195 "&emsp;") ;  em space, U+2003 ISOpub
612     ;;(thinsp (symbol) 8201 "&thinsp;") ;  thin space, U+2009 ISOpub
613     ;;(zwnj (symbol) 8204 "&zwnj;") ;  zero width non-joiner, U+200C NEW RFC 2070
614     ;;(zwj (symbol) 8205 "&zwj;") ;  zero width joiner, U+200D NEW RFC 2070
615     ;;(lrm (symbol) 8206 "&lrm;") ;  left-to-right mark, U+200E NEW RFC 2070
616     ;;(rlm (symbol) 8207 "&rlm;") ;  right-to-left mark, U+200F NEW RFC 2070
617     (endash (symbol) 8211 "&ndash;")
618     (emdash (symbol) 8212 "&mdash;")
619     ;;(lsquo (symbol) 8216 "&lsquo;") ;  left single quotation mark, U+2018 ISOnum
620     ;;(rsquo (symbol) 8217 "&rsquo;") ;  right single quotation mark, U+2019 ISOnum
621     ;;(sbquo (symbol) 8218 "&sbquo;") ;  single low-9 quotation mark, U+201A NEW
622     ;;(ldquo (symbol) 8220 "&ldquo;") ;  left double quotation mark, U+201C ISOnum
623     ;;(rdquo (symbol) 8221 "&rdquo;") ;  right double quotation mark, U+201D ISOnum
624     ;;(bdquo (symbol) 8222 "&bdquo;") ;  double low-9 quotation mark, U+201E NEW
625     (dagger (symbol) 8224 "&dagger;")
626     (daggerdbl (symbol) 8225 "&Dagger;")
627     (perthousand (symbol) 8240 "&permil;")
628     (guilsinglleft (symbol) 8249 "&lsaquo;")
629     (guilsinglright (symbol) 8250 "&rsaquo;")
630     (therefore1 (symbol) 8756 "&there4;")
631     (ceilingleft (symbol) 8968 "&lceil;")
632     (ceilingright (symbol) 8969 "&rceil;")
633     (floorleft (symbol) 8970 "&lfloor;")
634     (floorright (symbol) 8971 "&rfloor;")
635     (asym (symbol) 8776 "&asymp;")
636     )
637   "Table defining SGML entities, see `x-symbol-sgml-table'.")
638
639 ;; Should I add symbols from http://www.bbsinc.com/iso8859.html ?
640 (defvar x-symbol-sgml-table
641   (append x-symbol-sgml-user-table
642           '(nil)
643           x-symbol-sgml-latin1-table
644           x-symbol-sgml-latinN-table
645           x-symbol-sgml-xsymb0-table
646           x-symbol-sgml-xsymb1-table)
647   "Table defining `sgml' tokens for the characters.
648 See language access `x-symbol-LANG-table' and variable
649 `x-symbol-sgml-token-list'.  Use `x-symbol-sgml-user-table' to define
650 private SGML entities or shadow existing ones.")
651
652
653 ;;;===========================================================================
654 ;;;  Subscript functions
655 ;;;===========================================================================
656
657 (defun x-symbol-sgml-subscript-matcher (limit)
658   ;; checkdoc-params: (limit)
659   "Match and skip over super- and subscripts.
660 Return nil if `x-symbol-mode' or `x-symbol-subscripts' is nil.  Uses
661 `x-symbol-sgml-font-lock-regexp'."
662   (block nil
663     (let (open-beg open-end close-end close-beg)
664       (while (re-search-forward x-symbol-sgml-font-lock-regexp limit t)
665         (setq open-beg (match-beginning 0)
666               open-end (match-end 0))
667         (when (re-search-forward x-symbol-sgml-font-lock-limit-regexp
668                                  limit 'limit)
669           (setq close-beg (match-beginning 0)
670                 close-end (match-end 0))
671           (if (equal (cdr (assoc (downcase
672                                   (buffer-substring open-beg open-end))
673                                  x-symbol-sgml-font-lock-alist))
674                      (downcase (buffer-substring close-beg close-end)))
675               (when
676                   (save-excursion
677                     (goto-char open-end)
678                     (re-search-forward x-symbol-sgml-font-lock-contents-regexp
679                                        close-beg t))
680                 (store-match-data (list open-beg close-end
681                                         open-beg open-end
682                                         open-end close-beg
683                                         close-beg close-end))
684                 (return (if (eq (char-after (+ 3 open-beg)) ?b)
685                             'x-symbol-sub-face
686                           'x-symbol-sup-face)))
687             (goto-char close-beg)))))))
688
689 ;;; Local IspellPersDict: .ispell_xsymb
690 ;;; x-symbol-sgml.el ends here