File: manpage_from.sh

package info (click to toggle)
aspectj 1.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 43,412 kB
  • sloc: java: 558,715; xml: 26,625; sh: 540; makefile: 43
file content (20 lines) | stat: -rwxr-xr-x 654 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
#
# Transforms DocBook .xml documents so that docbook-to-man can grok them.
#
if test "a$#" = "a0"; then
    echo "$0: missing argument" >&2
    echo "usage: $0 <document>" >&2
    echo "prepares an AspectJ document for dobook-to-man" >&2
    exit 2
fi

NAME=`basename $1`
NAME=${NAME%.*}
TMPFILE=`mktemp` || exit 1
trap "rm -f $TMPFILE" 0

# add the doctype header
echo '<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.3//EN">' >> $TMPFILE
sed -e "s,<refnamediv>,<refmeta><refentrytitle>$NAME</refentrytitle><manvolnum>1</manvolnum></refmeta><refnamediv>," < $1 >> $TMPFILE
docbook-to-man $TMPFILE | sed -e 's# (link to URL \(.*\)) # \1#'