Initial Commit
[packages] / xemacs-packages / mailcrypt / texi2html.ext
1 # This is an extension file for the excellent `texi2html' utility by
2 # Lionel Cons.  See <http://wwwcn.cern.ch/dci/texi2html/> for more
3 # information on `texi2html'.
4
5 # `texi2html' will include any file (like this one) named
6 # `texi2html.ext' in the directory in which it is run.
7
8 # This extension file causes URLs marked as @file{} style to be
9 # converted to true hyperlinks.  Well, some URLs, some non-URLs; close
10 # enough for the Mailcrypt manual.
11
12 $URLRE = '^(http)|(ftp)|(news):'; # RE for a URL.  Woefully
13                                   # incomplete, but adequate.
14
15 $patl_old_style_map{'file'} = $style_map{'file'};
16 $style_map{'file'} = '&patl_do_file';
17
18 sub patl_do_file {
19     local($text) = @_;
20     local($ret);
21
22     if ($text =~ /$URLRE/i) {
23         $ret = "<A HREF=\"$text\">$text</A>";
24     } else {
25         $style_map{'file'} = $patl_old_style_map{'file'};
26         $ret = &apply_style('file', $text);
27         $style_map{'file'} = '&patl_do_file';
28     }
29     return($ret);
30 }