]> granicus.if.org Git - python/commitdiff
Integrate updates to the GNU info conversion.
authorFred Drake <fdrake@acm.org>
Wed, 13 Nov 2002 19:31:04 +0000 (19:31 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 13 Nov 2002 19:31:04 +0000 (19:31 +0000)
This includes SF patch #590352 and additional support for more of the custom
markup.

Doc/info/Makefile
Doc/tools/mkinfo
Doc/tools/py2texi.el

index 88c0d6ec738655344d18d098f8710c596eb4cc3b..008e3692b566f7a609c5c52befabe063efd0f368 100644 (file)
@@ -34,34 +34,34 @@ check-emacs-version:
        fi
 
 python$(VERSION)-api.info:     ../api/api.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 python$(VERSION)-ext.info:     ../ext/ext.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 python$(VERSION)-lib.info:     ../lib/lib.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 # Not built by default; the conversion doesn't really handle it well.
 python$(VERSION)-mac.info:     ../mac/mac.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 python$(VERSION)-ref.info:     ../ref/ref.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 python$(VERSION)-tut.info:     ../tut/tut.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 # Not built by default; the conversion doesn't handle it at all.
 python$(VERSION)-doc.info:     ../doc/doc.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 python$(VERSION)-dist.info:    ../dist/dist.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 # Not built by default; the conversion chokes on two @end multitable's
 python$(VERSION)-inst.info:    ../inst/inst.tex $(SCRIPTS)
-       EMACS=$(EMACS) $(MKINFO) $< $@
+       EMACS=$(EMACS) $(MKINFO) $< $*.texi $@
 
 clean:
        rm -f *.texi~ *.texi
index 65add7c730f1d89a632697794f02a48296a30ffd..d9527301ae2af039dde2ba0e62dd3f5109573d1a 100755 (executable)
@@ -2,8 +2,10 @@
 #  -*- Ksh -*-
 
 #  Script to drive the HTML-info conversion process.
-#  Pass in a single parameter: the name of the top-level HTML file
-#  generated by LaTeX2HTML.
+#  Pass in upto three parameters:
+#  - the name of the main tex file
+#  - the name of the output file in texi format (optional)
+#  - the name of the output file in info format (optional)
 #
 #  Written by Fred L. Drake, Jr. <fdrake@acm.org>
 
@@ -18,7 +20,12 @@ DOCDIR=`dirname "$FILENAME"`
 DOCFILE=`basename "$FILENAME"`
 DOCNAME=`basename "$FILENAME" .tex`
 if [ $# -gt 1 ]; then
-    INFONAME="$2"
+    TEXINAME="$2"
+else
+    TEXINAME="python-$DOCNAME.texi"
+fi
+if [ $# -gt 2 ]; then
+    INFONAME="$3"
 else
     INFONAME="python-$DOCNAME.info"
 fi
@@ -43,6 +50,8 @@ run() {
 
 run $EMACS -batch -q --no-site-file -l $TOOLSDIR/py2texi.el \
     --eval "(setq py2texi-dirs '(\"./\" \"../texinputs/\" \"$DOCDIR\"))" \
+    --eval "(setq py2texi-texi-file-name \"$TEXINAME\")" \
+    --eval "(setq py2texi-info-file-name \"$INFONAME\")" \
     --eval "(py2texi \"$DOCDIR/$DOCFILE\")" \
     -f kill-emacs
 echo Done
@@ -51,4 +60,4 @@ echo Done
 # generate the .info files:
 
 run $MAKEINFO --footnote-style end --fill-column 72 \
-             --paragraph-indent 0 --output=$INFONAME $DOCNAME.texi
+             --paragraph-indent 0 --output=$INFONAME $TEXINAME
index b29a9139c5f72d2117a558a64cb0453aa1d382c1..eb7e00bb53a3f6825628b4eb652b1107767cc4c8 100644 (file)
     (match-string 0 py2texi-python-version))
   "Short version number, usually set by the LaTeX commands.")
 
+(defvar py2texi-texi-file-name nil
+  "If non-nil, that string is used as the name of the Texinfo file.
+Otherwise a generated Texinfo file name is used.")
+
+(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.")
 
     ("cfuncdesc" 3
      (progn (setq findex t)
            "\n@table @code\n@item \\1 \\2(\\3)\n@findex \\2\n")
-     "@end table")
+     "@end table\n")
+    ("cmemberdesc" 3
+     "\n@table @code\n@item \\2 \\3\n"
+     "@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")
-    ("cmemberdesc" 3
-     (progn (setq findex t)
-           "\n@table @code\n@item \\1 \\2 \\3\n@findex \\3\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 "" "")
     ("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")
     ("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"
@@ -200,9 +207,7 @@ Both BEGIN and END are evaled.  Moreover, you can reference arguments through
     ("catcode" 0 "")
     ("cdata" 1 "@code{\\1}")
     ("centerline" 1 "@center \\1")
-    ("cfuncline" 3
-     (progn (setq findex t)
-           "\n@item \\1 \\2(\\3)\n@findex \\2\n"))
+    ("cfuncline" 3 "@itemx \\1 \\2(\\3)\n@findex \\2")
     ("cfunction" 1 "@code{\\1}")
     ("chapter" 1 (format "@node \\1\n@%s \\1\n"
                         (if appendix "appendix" "chapter")))
@@ -210,9 +215,7 @@ Both BEGIN and END are evaled.  Moreover, you can reference arguments through
     ("character" 1 "@samp{\\1}")
     ("citetitle" 1 "@ref{Top,,,\\1}")
     ("class" 1 "@code{\\1}")
-    ("cmemberline" 3
-     (progn (setq findex t)
-           "\n@item \\1 \\2 \\3\n@findex \\3\n"))
+    ("cmemberline" 3 "@itemx \\2 \\3\n")
     ("code" 1 "@code{\\1}")
     ("command" 1 "@command{\\1}")
     ("constant" 1 "@code{\\1}")
@@ -282,7 +285,7 @@ Both BEGIN and END are evaled.  Moreover, you can reference arguments through
     ("methodlineni" 2 "@item \\1(\\2)\n")
     ("mimetype" 1 "@samp{\\1}")
     ("module" 1 "@samp{\\1}")
-    ("moduleauthor" 2 "This module was written by \\1 @email{\\2}.@*")
+    ("moduleauthor" 2 "")
     ("modulesynopsis" 1 "\\1")
     ("moreargs" 0 "@dots{}")
     ("n" 0 "@backslash{}n")
@@ -308,7 +311,7 @@ Both BEGIN and END are evaled.  Moreover, you can reference arguments through
     ("plusminus" 0 "+-")
     ("POSIX" 0 "POSIX")
     ("production" 2 "@item \\1 \\2")
-    ("productioncont" 1 "@item \\1")
+    ("productioncont" 1 "@item @w{} \\1")
     ("program" 1 "@command{\\1}")
     ("programopt" 1 "@option{\\1}")
     ("protect" 0 "")
@@ -334,8 +337,7 @@ Both BEGIN and END are evaled.  Moreover, you can reference arguments through
                          (py2texi-backslash-quote (match-string 1 str))
                          (py2texi-backslash-quote (match-string 2 str)))
                       "@node \\1\n@section \\1\n"))))
-    ("sectionauthor" 2
-     "\nThis manual section was written by \\1 @email{\\2}.@*")
+    ("sectionauthor" 2 "")
     ("seemodule" 2 "@ref{\\1} \\2")
     ("seepep" 3 "\n@table @strong\n@item PEP\\1 \\2\n\\3\n@end table\n")
     ("seerfc" 3 "\n@table @strong\n@item RFC\\1 \\2\n\\3\n@end table\n")
@@ -468,20 +470,26 @@ Each list item is of the form (COMMAND ARGNUM SUBSTITUTION) where:
     (py2texi-destroy-empties)
     (py2texi-fix-newlines)
     (py2texi-adjust-level))
-  (let* ((filename (concat "./"
-                          (file-name-nondirectory file)
-                          (if (string-match "\\.tex$" file) "i" ".texi")))
-        (infofilename (py2texi-info-file-name filename)))
+  (let* ((texi-file-name (or py2texi-texi-file-name
+                            (py2texi-texi-file-name file)))
+        (info-file-name (or py2texi-info-file-name
+                            (py2texi-info-file-name texi-file-name))))
     (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 " info-file-name))
     (when (re-search-forward "@chapter" nil t)
       (texinfo-all-menus-update t))
     (goto-char (point-min))
-    (write-file filename)
-    (message (format "You can apply `makeinfo %s' now." filename))))
+    (write-file texi-file-name)
+    (message (format "You can apply `makeinfo %s' now." texi-file-name))))
+
+
+(defun py2texi-texi-file-name (filename)
+  "Generate name of Texinfo file from original file name FILENAME."
+  (concat filename
+         (if (string-match "\\.tex$" filename) "i" ".texi")))
 
 
 (defun py2texi-info-file-name (filename)
@@ -719,19 +727,25 @@ Do not include .ind files."
        id
        counter
        string
-       label)
+       label
+       index)
     (py2texi-search "^@node +\\(.*\\)$"
       (setq string (match-string 1))
       (if py2texi-xemacs
          (replace-match "@node " t)
        (replace-match "" t nil nil 1))
-      (when (string-match "@label{[^}]*}" string)
+      (while (string-match "@label{[^}]*}" string)
        (setq label (match-string 0 string))
        (setq string (replace-match "" t nil string)))
+      (while (string-match "@..?index{[^}]*}\ 1" 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)
        (setq string (replace-match " - " t nil string)))
+      (while (string-match "\\." string)
+       (setq string (replace-match "" t nil string)))
       (when (string-match " +$" string)
        (setq string (replace-match "" t nil string)))
       (when (string-match "^\\(Built-in\\|Standard\\) Module \\|The " string)
@@ -747,9 +761,11 @@ Do not include .ind files."
        (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 ()