Initial Commit
[packages] / xemacs-packages / footnote / footnote-han.el
1 ;;; footnote-han.el --- Han Japanese footnote support
2
3 ;; Copyright (C) 1997 by Free Software Foundation, Inc.
4
5 ;; Author: Steven L Baur <steve@xemacs.org>
6 ;; Keywords: mail, news, mule
7 ;; Version: 0.17
8
9 ;; This file is part of XEmacs.
10
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; 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 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING.  If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 ;; 02111-1307, USA.
25
26 ;;; Synched up with: Not in FSF
27
28 ;;; Commentary:
29
30 ;; \e$B?t\e(B \e$BJQ$($k\e(B
31
32 ;;; Change Log:
33
34 ;; Apr-18-1997: Added regexp to the footnote style alist.
35 ;; Sep-30-1997: See ChangeLog file.
36
37 ;;; Code:
38
39 (require 'footnote)
40
41 (defconst footnote-han-digits "\e$B0lFs;0;M8^O;<7H,6e\e(B"
42   "\e$B7e\e(B")
43
44 (defconst footnote-han-digits-regexp
45   (concat "[" footnote-han-digits "\e$B==\e(B" "]"))
46
47 (defun Footnote-han (n)
48   "\e$B$+$($k\e(B \e$B$K\e(B \e$BF|K\8l\e(B."
49   (cond ((<= n 9)
50          (char-to-string (aref footnote-han-digits (1- n))))
51         ((= n 10)
52          "\e$B==\e(B")
53         ((<= n 19)
54          (concat "\e$B==\e(B" (char-to-string (aref footnote-han-digits
55                                             (1- (mod n 10))))))
56         (t
57          (concat
58           (char-to-string (aref footnote-han-digits (1- (/ n 10))))
59           "\e$B==\e(B"
60           (unless (= (mod n 10) 0)
61             (char-to-string (aref footnote-han-digits
62                                   (1- (mod n 10)))))))))
63
64 (setq footnote-style-alist
65       (append (list `(han
66                       Footnote-han
67                       ,footnote-han-digits-regexp)) footnote-style-alist))
68
69 (provide 'footnote-han)
70
71 ;;; footnote-han.el ends here