Source

mailcrypt / texi2html.ext

Full commit
# 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);
}