File: texi2html.ext

package info (click to toggle)
mailcrypt 3.5.5-6.2
  • links: PTS
  • area: contrib
  • in suites: potato
  • size: 696 kB
  • ctags: 331
  • sloc: lisp: 4,142; sh: 170; makefile: 97; perl: 36
file content (30 lines) | stat: -rw-r--r-- 931 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This is an extension file for the excellent `texi2html' utility by
# Lionel Cons.  See <http://wwwcn.cern.ch/dci/texi2html/> for more
# information on `texi2html'.

# `texi2html' will include any file (like this one) named
# `texi2html.ext' in the directory in which it is run.

# This extension file causes URLs marked as @file{} style to be
# converted to true hyperlinks.  Well, some URLs, some non-URLs; close
# enough for the Mailcrypt manual.

$URLRE = '^(http)|(ftp)|(news):'; # RE for a URL.  Woefully
				  # incomplete, but adequate.

$patl_old_style_map{'file'} = $style_map{'file'};
$style_map{'file'} = '&patl_do_file';

sub patl_do_file {
    local($text) = @_;
    local($ret);

    if ($text =~ /$URLRE/i) {
	$ret = "<A HREF=\"$text\">$text</A>";
    } else {
	$style_map{'file'} = $patl_old_style_map{'file'};
	$ret = &apply_style('file', $text);
	$style_map{'file'} = '&patl_do_file';
    }
    return($ret);
}