1 |
frodo |
195 |
#! /bin/sh |
2 |
|
|
|
3 |
frodo |
250 |
compute_command_line() |
4 |
frodo |
195 |
{ |
5 |
|
|
index_file="$1" |
6 |
frodo |
250 |
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 |
frodo |
195 |
|
13 |
frodo |
250 |
generate_links() |
14 |
|
|
{ |
15 |
|
|
command=`compute_command_line "$1"` |
16 |
|
|
#echo $command |
17 |
frodo |
195 |
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" |