NetBSD/gnu/dist/texinfo/util/gen-dir-node
wiz ccaa2ac97b Import of texinfo-4.7, as prepared by texinfo2netbsd.
Changes since 4.6:

4.7 (9 April 2004)
* Language:
  . new commands @float, @caption, @shortcaption, @listoffloats for
    initial implementation of floating material (figures, tables, etc).
    Ironically, they do not yet actually float anywhere.
  . new commands @docbook, @ifdocbook, @ifnotdocbook for conditional Docbook.
  . new commands @ordf{} and @ordm{} for Spanish feminine/masculine ordinals.
  . new commands @deftypecv[x] for class variables in typed OO languages.
  . new command @registeredsymbol for the r-in-a-circle symbol.
  . new command @headitem to make a heading row in @multitable.
  . new command @LaTeX{} for the LaTeX logo.
  . new command @comma{} to avoid comma-parsing problems.
  . @url is now a synonym for @uref; new command @indicateurl has the
    old meaning of just displaying a url as text.
  . @quotation now accepts an optional argument for labelling the text
      as a `Note', `Tip', etc.
  . @defun (et al.) heading lines can now be continued with a lone @.
  . @acronym accepts an optional argument for the meaning of the acronym.
* makeinfo:
  . New environment variable TEXINFO_OUTPUT_FORMAT determines the output
    format at runtime, if no options are specified.
  . New option --plaintext, equivalent to --no-headers with Info output.
  . All outputs:
    - sections are numbered by default.
  . Info output:
    - punctuation is inserted after @pxref and @ref, if needed to make
      cross-references valid.
    - line numbers included in index menus, so Info readers can go to
      the exact line of an entry, not just a node.  Also in plaintext output.
    - ^@^H[index^@^H] cookie included in index menus, so Info readers
      can handle the ] etc. commands better.
  . HTML output:
    - new algorithm for cross-references to other manuals, for maximum
      portability and stability.
    - include node name in <title> with split output.
    - @multicolumn fractions become percentages.
    - entities used for bullets, quotes, dashes, and others.
    - index entries are links to the exact locations.
    - <h4> and <h5> used for @sub and @subsubsections again.
    - accented dotless i supported.
  . XML output: many new tags and structure to preserve more source features.
  . Docbook output:
    - upgraded DTD to Docbook XML 4.2, no longer using Docbook SGML.
    - improved translation in general, for instance:
    - line annotations and marked quotations.
* texi2dvi:
  . if available, use etex (pdfetex if --pdf) by default.
  . if the input file includes thumbpdf.sty (for LaTeX), then run thumbpdf.
  . more output if --debug.
* texinfo.tex:
  . @defun names are now printed in typewriter (instead of bold), and
    within the arguments, @var text is printed in slanted typewriter.
  . @tex code is executed inside a TeX group, so that any changes must
    be prefixed with \global (or the equivalent) to be effective.  (This
    change was actually made years ago, but never made it into the NEWS.)
* info:
  . new option --where (aka --location, -w) to report where an Info file
    would be found, instead of reading it.
  . by default, output ANSI terminal escape sequences as-is; new option
    --no-raw-escapes overrides this.
  . use the newly-generated index line numbers.
* Distribution:
  . new script gendocs.sh (not installed), for use by GNU maintainers in
    getting their manuals on the GNU web site.  Documented in
    maintain.texi (http://www.gnu.org/prep/maintain_toc.html).
  . Most code uses ANSI C prototypes, to some extent.
  . New translation: nb.
  . automake 1.8.3, autoconf 2.59, gettext 0.14.1.
2004-07-12 23:26:33 +00:00

213 lines
6.4 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# Id: gen-dir-node,v 1.1.1.1 2003/12/06 01:35:48 karl Exp
# Generate the top-level Info node, given a directory of Info files
# and (optionally) a skeleton file. The output will be suitable for a
# top-level dir file. The skeleton file contains info topic names in the
# order they should appear in the output. There are three special
# lines that alter the behavior: a line consisting of just "--" causes
# the next line to be echoed verbatim to the output. A line
# containing just "%%" causes all the remaining filenames (wildcards
# allowed) in the rest of the file to be ignored. A line containing
# just "!!" exits the script when reached (unless preceded by a line
# containing just "--"). Once the script reaches the end of the
# skeleton file, it goes through the remaining files in the directory
# in order, putting their entries at the end. The script will use the
# ENTRY information in each info file if it exists. Otherwise it will
# make a minimal entry.
# sent by Jeffrey Osier <jeffrey@cygnus.com>, who thinks it came from
# zoo@winternet.com (david d `zoo' zuhn)
# modified 7 April 1995 by Joe Harrington <jh@tecate.gsfc.nasa.gov> to
# take special flags
INFODIR=$1
if [ $# = 2 ] ; then
SKELETON=$2
else
SKELETON=/dev/null
fi
skip=
if [ $# -gt 2 ] ; then
echo usage: $0 info-directory [ skeleton-file ] 1>&2
exit 1
elif [ -z "${INFODIR}" ] ; then
INFODIR="%%DEFAULT_INFO_DIR%%"
else
true
fi
if [ ! -d ${INFODIR} ] ; then
echo "$0: first argument must specify a directory"
exit 1
fi
### output the dir header
echo "-*- Text -*-"
echo "This file was generated automatically by $0."
echo "This version was generated on `date`"
echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
cat << moobler
\Id: gen-dir-node,v 1.1.1.1 2003/12/06 01:35:48 karl Exp
This is the file .../info/dir, which contains the topmost node of the
Info hierarchy. The first time you invoke Info you start off
looking at that node, which is (dir)Top.

File: dir Node: Top This is the top of the INFO tree
This (the Directory node) gives a menu of major topics.
Typing "q" exits, "?" lists all Info commands, "d" returns here,
"h" gives a primer for first-timers,
"mEmacs<Return>" visits the Emacs topic, etc.
In Emacs, you can click mouse button 2 on a menu item or cross reference
to select it.
* Menu: The list of major topics begins on the next line.
moobler
### go through the list of files in the skeleton. If an info file
### exists, grab the ENTRY information from it. If an entry exists
### use it, otherwise create a minimal dir entry.
###
### Then remove that file from the list of existing files. If any
### additional files remain (ones that don't have a skeleton entry),
### then generate entries for those in the same way, putting the info for
### those at the end....
infofiles=`(cd ${INFODIR}; /bin/ls | grep -v '\-[0-9]*$' | egrep -v '^dir$|^dir\.info$|^dir\.orig$')`
# echoing gets clobbered by backquotes; we do it the hard way...
lines=`wc $SKELETON | awk '{print $1}'`
line=1
while [ $lines -ge $line ] ; do
# Read one line from the file. This is so that we can echo lines with
# whitespace and quoted characters in them.
fileline=`awk NR==$line $SKELETON`
# flag fancy features
if [ ! -z "$echoline" ] ; then # echo line
echo "$fileline"
fileline=
echoline=
elif [ "${fileline}" = "--" ] ; then # should we echo the next line?
echoline=1
elif [ "${fileline}" = "%%" ] ; then # eliminate remaining files from dir?
skip=1
elif [ "${fileline}" = "!!" ] ; then # quit now
exit 0
fi
# handle files if they exist
for file in $fileline"" ; do # expand wildcards ("" handles blank lines)
fname=
if [ -z "$echoline" ] && [ ! -z "$file" ] ; then
# Find the file to operate upon. Check both possible names.
infoname=`echo $file | sed 's/\.info$//'`
noext=
ext=
if [ -f ${INFODIR}/$infoname ] ; then
noext=$infoname
fi
if [ -f ${INFODIR}/${infoname}.info ] ; then
ext=${infoname}.info
fi
# If it exists with both names take what was said in the file.
if [ ! -z "$ext" ] && [ ! -z "$noext" ]; then
fname=$file
warn="### Warning: $ext and $noext both exist! Using ${file}. ###"
elif [ ! -z "${noext}${ext}" ]; then
# just take the name if it exists only once
fname=${noext}${ext}
fi
# if we found something and aren't skipping, do the entry
if [ ! -z "$fname" ] ; then
if [ -z "$skip" ] ; then
if [ ! -z "$warn" ] ; then # issue any warning
echo $warn
warn=
fi
entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$fname`
if [ ! -z "${entry}" ] ; then
echo "${entry}"
else
echo "* ${infoname}: (${infoname})."
fi
fi
# remove the name from the directory listing
infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${fname} / /" -e "s/ / /g"`
fi
fi
done
line=`expr $line + 1`
done
if [ -z "${infofiles}" ] ; then
exit 0
elif [ $lines -gt 0 ]; then
echo
fi
# Sort remaining files by INFO-DIR-SECTION.
prevsect=
filesectdata=`(cd ${INFODIR}; fgrep INFO-DIR-SECTION /dev/null ${infofiles} | \
fgrep -v 'INFO-DIR-SECTION Miscellaneous' | \
sort -t: -k2 -k1 | tr ' ' '_')`
for sectdata in ${filesectdata}; do
file=`echo ${sectdata} | cut -d: -f1`
section=`sed -n -e 's/^INFO-DIR-SECTION //p' ${INFODIR}/${file}`
infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${file} / /" -e "s/ / /g"`
if [ "${prevsect}" != "${section}" ] ; then
if [ ! -z "${prevsect}" ] ; then
echo ""
fi
echo "${section}"
prevsect="${section}"
fi
infoname=`echo $file | sed 's/\.info$//'`
entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}`
if [ ! -z "${entry}" ] ; then
echo "${entry}"
elif [ ! -d "${INFODIR}/${file}" ] ; then
echo "* ${infoname}: (${infoname})."
fi
done
# Process miscellaneous files.
for file in ${infofiles}; do
if [ ! -z "${prevsect}" ] ; then
echo ""
echo "Miscellaneous"
prevsect=""
fi
infoname=`echo $file | sed 's/\.info$//'`
entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/${file}`
if [ ! -z "${entry}" ] ; then
echo "${entry}"
elif [ ! -d "${INFODIR}/${file}" ] ; then
echo "* ${infoname}: (${infoname})."
fi
done