File: py2texi.dpatch

package info (click to toggle)
python2.2 2.2.3dfsg-2sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 36,920 kB
  • ctags: 69,127
  • sloc: ansic: 219,839; python: 203,969; sh: 9,690; makefile: 3,468; perl: 3,454; lisp: 3,248; xml: 2,262; cpp: 106; sed: 2
file content (189 lines) | stat: -rw-r--r-- 6,362 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#! /bin/sh -e

# DP: Doc/tools/py2texi.el update

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        #cd ${dir}gcc && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        #rm ${dir}gcc/configure
        ;;
    *)
	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
        exit 1
esac
exit 0

--- Doc/tools/py2texi.el.orig	2002-07-29 22:10:38.000000000 +0200
+++ Doc/tools/py2texi.el	2002-07-29 22:12:53.000000000 +0200
@@ -56,6 +56,10 @@
     (match-string 0 py2texi-python-version))
   "Short version number, usually set by the LaTeX commands.")
 
+(defvar py2texi-info-file-name nil
+  "If non-nil, that string is used as the name of the Info file.
+Otherwise a generated Info file name is used.")
+
 (defvar py2texi-stop-on-problems nil
   "*If non-nil, stop when you encouter soft problem.")
 
@@ -65,32 +69,32 @@
     ("cfuncdesc" 3
      (progn (setq findex t)
 	    "\n@table @code\n@item \\1 \\2(\\3)\n@findex \\2\n")
-     "@end table")
+     "@end table\n")
     ("classdesc" 2
      (progn (setq obindex t)
 	    "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n")
-     "@end table")
+     "@end table\n")
     ("classdesc*" 1
      (progn (setq obindex t)
 	    "\n@table @code\n@item \\1\n@obindex \\1\n")
-     "@end table")
+     "@end table\n")
     ("csimplemacrodesc" 1
      (progn (setq cindex t)
 	    "\n@table @code\n@item \\1\n@cindex \\1\n")
-     "@end table")
+     "@end table\n")     
     ("ctypedesc" 1
      (progn (setq cindex t)
 	    "\n@table @code\n@item \\1\n@cindex \\1\n")
-     "@end table")
+     "@end table\n")
     ("cvardesc" 2
      (progn (setq findex t)
 	    "\n@table @code\n@item \\1 \\2\n@findex \\2\n")
-     "@end table")
+     "@end table\n")
     ("datadesc" 1
      (progn (setq findex t)
 	    "\n@table @code\n@item \\1\n@findex \\1\n")
-     "@end table")
-    ("datadescni" 1 "\n@table @code\n@item \\1\n" "@end table")
+     "@end table\n")
+    ("datadescni" 1 "\n@table @code\n@item \\1\n" "@end table\n")
     ("definitions" 0 "@table @dfn" "@end table\n")
     ("description" 0 "@table @samp" "@end table\n")
     ("displaymath" 0 "" "")
@@ -111,20 +115,20 @@
     ("excdesc" 1
      (progn (setq obindex t)
 	    "\n@table @code\n@item \\1\n@obindex \\1\n")
-     "@end table")
+     "@end table\n")
     ("excclassdesc" 2
      (progn (setq obindex t)
 	    "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n")
-     "@end table")
+     "@end table\n")
     ("flushleft" 0 "" "")
-    ("fulllineitems" 0 "\n@table @code\n" "@end table")
+    ("fulllineitems" 0 "\n@table @code\n" "@end table\n")
     ("funcdesc" 2
      (progn (setq findex t)
 	    "\n@table @code\n@item \\1(\\2)\n@findex \\1\n")
-     "@end table")
-    ("funcdescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table")
+     "@end table\n")
+    ("funcdescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table\n")
     ("itemize" 0 "@itemize @bullet" "@end itemize\n")
-    ("list" 2 "\n@table @code\n" "@end table")
+    ("list" 2 "\n@table @code\n" "@end table\n")
     ("longtableii" 4 (concat "@multitable @columnfractions .5 .5\n"
 			     "@item \\3 @tab \\4\n"
 			     "@item ------- @tab ------ \n")
@@ -136,22 +140,22 @@
     ("memberdesc" 1
      (progn (setq findex t)
 	    "\n@table @code\n@item \\1\n@findex \\1\n")
-     "@end table")
-    ("memberdescni" 1 "\n@table @code\n@item \\1\n" "@end table")
+     "@end table\n")
+    ("memberdescni" 1 "\n@table @code\n@item \\1\n" "@end table\n")
     ("methoddesc" 2
      (progn (setq findex t)
 	    "\n@table @code\n@item \\1(\\2)\n@findex \\1\n")
-     "@end table")
-    ("methoddescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table")
+     "@end table\n")
+    ("methoddescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table\n")
     ("notice" 0 "@emph{Notice:} " "")
     ("opcodedesc" 2
      (progn (setq findex t)
 	    "\n@table @code\n@item \\1 \\2\n@findex \\1\n")
-     "@end table")
-    ("productionlist" 0 "\n@table @code\n" "@end table")
+     "@end table\n")
+    ("productionlist" 0 "\n@table @code\n" "@end table\n")
     ("quotation" 0 "@quotation" "@end quotation")
-    ("seealso" 0 "See also:\n@table @emph\n" "@end table")
-    ("seealso*" 0 "@table @emph\n" "@end table")
+    ("seealso" 0 "See also:\n@table @emph\n" "@end table\n")
+    ("seealso*" 0 "@table @emph\n" "@end table\n")
     ("sloppypar" 0 "" "")
     ("small" 0 "" "")
     ("tableii" 4 (concat "@multitable @columnfractions .5 .5\n"
@@ -457,12 +461,13 @@
   (let* ((filename (concat "./"
 			   (file-name-nondirectory file)
 			   (if (string-match "\\.tex$" file) "i" ".texi")))
-	 (infofilename (py2texi-info-file-name filename)))
+	 (infofilename (or py2texi-info-file-name
+			   (py2texi-info-file-name filename))))
     (goto-char (point-min))
     (when (looking-at py2texi-magic)
       (delete-region (point) (progn (beginning-of-line 2) (point)))
       (insert "\\input texinfo @c -*-texinfo-*-\n")
-      (insert "@setfilename " (file-name-nondirectory infofilename)))
+      (insert "@setfilename " infofilename))
     (when (re-search-forward "@chapter" nil t)
       (texinfo-all-menus-update t))
     (goto-char (point-min))
@@ -705,7 +710,8 @@
 	id
 	counter
 	string
-	label)
+	label
+	index)
     (py2texi-search "^@node +\\(.*\\)$"
       (setq string (match-string 1))
       (if py2texi-xemacs
@@ -714,6 +720,9 @@
       (when (string-match "@label{[^}]*}" string)
 	(setq label (match-string 0 string))
 	(setq string (replace-match "" t nil string)))
+      (when (string-match "@..?index{[^}]*}" string)
+	(setq index (match-string 0 string))
+	(setq string (replace-match "" t nil string)))
       (while (string-match "@[a-zA-Z]+\\|[{}():]\\|``\\|''" string)
 	(setq string (replace-match "" t nil string)))
       (while (string-match " -- " string)
@@ -733,9 +742,11 @@
 	(setq counter 1))
       (setf (gethash id nodes) counter)
       (insert string)
+      (beginning-of-line 3)
       (when label
-	(beginning-of-line 3)
-	(insert label "\n")))))
+	(insert label "\n"))
+      (when index
+	(insert index "\n")))))
 
 
 (defun py2texi-fix-references ()