1 |
#! /bin/sh |
2 |
|
3 |
compute_command_line() |
4 |
{ |
5 |
index_file="$1" |
6 |
printf "sed " |
7 |
while read file lineno name; do |
8 |
printf "-e %s " \''s,\['"$name"'\],<A NAME="'"$name"'">,g'\' |
9 |
printf "-e %s " \''s,«'"$name"'»,<A HREF="'"$file"\#"$name"'">'"$name"'</A>,g'\' |
10 |
done < "$index_file" |
11 |
} |
12 |
|
13 |
generate_links() |
14 |
{ |
15 |
command=`compute_command_line "$1"` |
16 |
#echo $command |
17 |
eval "$command" |
18 |
} |
19 |
|
20 |
generate_headers() |
21 |
{ |
22 |
index_file_generate_headers="$1" |
23 |
this_file_generate_headers=`echo $2 | sed 's,.*/,,' | sed 's,\..*$,,'` |
24 |
|
25 |
name_generate_headers=`grep "^$this_file_generate_headers" "$index_file_generate_headers" | head -1 | sed s,'^[^ ]* [^ ]* ,,'` |
26 |
sed -e 's,<TITLE>.*</TITLE>,<TITLE>'"$name_generate_headers"'</TITLE>,' |
27 |
} |
28 |
|
29 |
|
30 |
cat "$2" | generate_links "$1" | generate_headers "$1" "$2" |