Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 maxima (5.37.2-9) unstable; urgency=medium
 .
   * Bug fix: "maxima do not load the draw package.", thanks to Renato
     Alvarez Nodarse (Closes: #803251).  rework sys:*load-pathname* patch
   * texi2html -> makeinfo
   * no xmaxima in menu
   * use dh_compress to compress Manual.ps.gz
Author: Camm Maguire <camm@debian.org>
Bug-Debian: https://bugs.debian.org/803251

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- maxima-5.37.2.orig/doc/info/extract_categories.sh
+++ maxima-5.37.2/doc/info/extract_categories.sh
@@ -17,21 +17,24 @@ for f in *.texi; do
   if [ $f = "maxima.texi" ]
     then echo SKIP OVER $f
     else
-      sed 's/^@deffn  *{[^}]*}  *\([^[:blank:]]*\).*/@anchor{Item: \1}\
-&/; s/^@defvr  *{[^}]*}  *\([^[:blank:]]*\).*/@anchor{Item: \1}\
-&/; s/^@node  *\([^,]*\).*/@anchor{Item: \1}\
+      sed 's/^@deffn  *{\([^}]*\)}  *\([^[:blank:]]*\).*/@anchor{Item: '$f'_fn_\2_\1}\
+&/; s/^@defvr  *{\([^}]*\)}  *\([^[:blank:]]*\).*/@anchor{Item: '$f'_vr_\2_\1}\
+&/; s/^@node  *\([^,]*\).*/@anchor{Item: '$f'_nd_\1}\
 &/' "$f" > tmp.texi
       mv tmp.texi "$f"
     fi
 done
 
-cat *.texi\
+rm -f tmp-make-categories.py
+for i in *.texi; do
+  cat $i \
   | awk '!/^@c / && !/^@c$/ && (/^@deffn/ || /^@defvr/ || /^@end deffn/ || /^@end defvr/ || /@category/ || /@node/)'\
   | sed 's/\$/---endofline---/'\
   | sed -f "$d/extract_categories1.sed" \
-  | awk -F'$' -f "$d/extract_categories1.awk" \
+  | sed -e 's,"fn_,"'$i'_fn_,g' -e 's,"vr_,"'$i'_vr_,g' -e 's,"nd_,"'$i'_nd_,g';
+done | awk -F'$' -f "$d/extract_categories1.awk" \
   | sed 's/---endofline---/$/'\
-  > tmp-make-categories.py
+  >> tmp-make-categories.py
 
 ${PYTHONBIN:-python} tmp-make-categories.py
 
@@ -42,8 +45,13 @@ for f in Category-*.texi; do echo '@incl
 echo '@bye' >> tmp-target.texi
 mv tmp-target.texi $TARGET_TEXI
 
-perl "/usr/bin/texi2html" -split_chapter --lang=en --output=. \
- --css-include="$d/manual.css" --init-file "$d/texi2html.init" $TARGET_TEXI
+cat include-maxima.texi \
+    | awk '/^@comment @detailmenu/ {printf("Documentation Categories\n* Documentation Categories::\tDocumentation categories.\n\n");} {print}' \
+    >tmp && mv tmp include-maxima.texi
+
+# perl "/usr/bin/texi2html" -split_chapter --lang=en --output=. \
+#  --css-include="$d/manual.css" --init-file "$d/texi2html.init" $TARGET_TEXI
+makeinfo --no-warn --html --output=. --css-include="$d/manual.css" --split=chapter --init-file="$d/texi2html.init" $TARGET_TEXI
 
 # Now clean up the texi2html output. I'm going to burn in Hell for this (and much else).
 
--- maxima-5.37.2.orig/doc/info/extract_categories1.sed
+++ maxima-5.37.2/doc/info/extract_categories1.sed
@@ -1,10 +1,10 @@
-s/^@deffn  *{[^}]*}  *\([^[:blank:]]*\).*/items = ["\1"]/
-s/^@defvr  *{[^}]*}  *\([^[:blank:]]*\).*/items = ["\1"]/
-s/^@deffnx  *{[^}]*}  *\([^[:blank:]]*\).*/if not "\1" in items: items.append ("\1")/
-s/^@defvrx  *{[^}]*}  *\([^[:blank:]]*\).*/if not "\1" in items: items.append ("\1")/
+s/^@deffn  *{\([^}]*\)}  *\([^[:blank:]]*\).*/items = ["fn_\2_\1"]/
+s/^@defvr  *{\([^}]*\)}  *\([^[:blank:]]*\).*/items = ["vr_\2_\1"]/
+s/^@deffnx  *{\([^}]*\)}  *\([^[:blank:]]*\).*/if not "fn_\1" in items: items.append ("fn_\2_\1")/
+s/^@defvrx  *{\([^}]*\)}  *\([^[:blank:]]*\).*/if not "vr_\1" in items: items.append ("vr_\2_\1")/
 s/^@end deffn/items = []/
 s/^@end defvr/items = []/
-s/^@node  *\([^,]*\).*/items = ["\1"] # extracted from node/
+s/^@node  *\([^,]*\).*/items = ["nd_\1"] # extracted from node/
 s/@opencatbox//
 s/@closecatbox//
 s/@category{\([^}]*\)}\s*/\$foo = []\$for x in items: foo.append ([items[0], x])\$try: categories ["\1"] . extend (foo)\$except KeyError: categories ["\1"] = foo\$/g
