Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > db48b4a68013ba23450c5a772dacae55 > files > 3

maxima-5.20.1-8mdv2010.1.src.rpm

--- maxima-5.14.0/doc/info/extract_categories1.awk.catg	2008-04-24 22:21:31.000000000 +0200
+++ maxima-5.14.0/doc/info/extract_categories1.awk	2007-11-28 04:36:48.000000000 +0100
@@ -0,0 +1,20 @@
+BEGIN { print "categories = {}" }
+
+{for (i=1; i<=NF; i++) print $i;}
+
+END {
+    print "for key in categories.keys():"
+    print " f = open (\"Category-\" + key + \".texi\", \"w\")"
+    print " f.write (\"@anchor{Category: \" + key + \"}\\n\")"
+    print " f.write (\"@opencatbox\\n\")"
+    print " f.write (\"@b{Category: \" + key + \"}\\n\\n\")"
+    print " items = categories [key]"
+    print " if len (items) == 0: continue"
+    print " items.sort ()"
+    print " f.write (\"@ref{Item: \" + items[0][0] + \", \" + items[0][1] + \"}\\n\")"
+    print " for item in items [1:]:"
+    print "  f.write (\"@html\\n&middot;\\n@end html\\n\")"
+    print "  f.write (\"@ref{Item: \" + item[0] + \", \" + item[1] + \"}\\n\")"
+    print " f.write (\"@closecatbox\")"
+    print }
+
--- maxima-5.14.0/doc/info/extract_categories.sh.catg	2008-04-24 22:21:13.000000000 +0200
+++ maxima-5.14.0/doc/info/extract_categories.sh	2007-12-29 18:15:26.000000000 +0100
@@ -0,0 +1,80 @@
+TARGET=$1
+if [ "x$TARGET" = "x" ]; then
+  echo USAGE: sh $0 '<TARGET>'
+  exit 1
+fi
+
+set -x
+
+TARGET_TEXI=$TARGET.texi
+
+WORKING_DIRECTORY=`mktemp -d /tmp/maxima-texinfo-categories-XXXXXX`
+cp -R *.texi figures $WORKING_DIRECTORY
+d=`pwd`
+cd $WORKING_DIRECTORY
+
+for f in *.texi; do
+  if [ $f = "maxima.texi" ]
+    then echo SKIP OVER $f
+    else
+      sed 's/^@def\(fn\|vr\)  *{[^}]*}  *\([^[:blank:]]*\).*/@anchor{Item: \2}\
+\0/; s/^@node  *\([^,]*\).*/@anchor{Item: \1}\
+\0/' "$f" > tmp.texi
+      mv tmp.texi "$f"
+    fi
+done
+
+cat *.texi\
+  | awk '!/^@c / && !/^@c$/ && (/^@deffn/ || /^@defvr/ || /^@end deffn/ || /^@end defvr/ || /@category/ || /@node/)'\
+  | sed -f $d/extract_categories1.sed \
+  | awk -F '$' -f $d/extract_categories1.awk \
+  > tmp-make-categories.py
+
+python tmp-make-categories.py
+
+sed 's/^@bye//' $TARGET_TEXI > tmp-target.texi
+echo '@node Documentation Categories' >> tmp-target.texi
+echo '@chapter Documentation Categories' >> tmp-target.texi
+for f in Category-*.texi; do echo '@include' $f; done >> tmp-target.texi
+echo '@bye' >> tmp-target.texi
+mv tmp-target.texi $TARGET_TEXI
+
+perl $d/texi2html -split_chapter --lang=en --output=. \
+ --css-include=$d/manual.css --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).
+
+for f in *.html
+do
+    grep -q '<a href=".*">Category: .*</a>' $f
+    if [ $? = 0 ]; then
+        echo FIX UP CATEGORY BOXES IN $f
+        sed 's/^&middot;$//; s/<p>\(<a href=".*">Category: .*<\/a>\)/<p>Categories:\&nbsp;\&nbsp;\1/' $f > tmp.html
+        mv tmp.html $f
+    fi
+done
+
+for f in *.html
+do
+    grep -q '<a href=".*">Category: .*</a>' $f
+    if [ $? = 0 ]; then
+        echo FIX UP CATEGORY HREFS IN $f
+        sed 's/<a href="\(.*\)">Category: \(.*\)<\/a>/<a href="\1">\2<\/a>/' $f > tmp.html
+        mv tmp.html $f
+    fi
+done
+
+for f in *.html
+do
+    grep -q '<a href=".*">Item: .*</a>' $f
+    if [ $? = 0 ]; then
+        echo FIX UP ITEM HREFS IN $f
+        sed 's/<a href="\(.*\)">Item: \(.*\)<\/a>/<a href="\1">\2<\/a>/' $f > tmp.html
+        mv tmp.html $f
+    fi
+done
+
+mv *.html $d
+
+cd $d
+set +x
--- maxima-5.14.0/doc/info/extract_categories1.sed.catg	2008-04-24 22:21:25.000000000 +0200
+++ maxima-5.14.0/doc/info/extract_categories1.sed	2007-11-28 04:36:48.000000000 +0100
@@ -0,0 +1,7 @@
+s/^@def\(fn\|vr\)  *{[^}]*}  *\([^[:blank:]]*\).*/items = ["\2"]/
+s/^@def\(fn\|vr\)x  *{[^}]*}  *\([^[:blank:]]*\).*/if not "\2" in items: items.append ("\2")/
+s/^@end def\(fn\|vr\)/items = []/
+s/^@node  *\([^,]*\).*/items = ["\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