File: hyperref.perl

package info (click to toggle)
latex2html 2019-debian1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,896 kB
  • sloc: perl: 33,323; makefile: 447
file content (35 lines) | stat: -rwxr-xr-x 915 bytes parent folder | download
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
31
32
33
34
35
#!/usr/bin/perl

# this file is loaded if a file contains
# \usepackage{hyperref}

# allows latex2html to process files containing
# the \href command defined by hyperref.sty
# and therefore allows latex2html to process files
# written for hyperref.sty without modifying them for latex2html

package main;

# Suppress option warning messages:

sub do_hyperref_colorlinks {}
sub do_hyperref_backref {}
sub do_hyperref_pagebackref {}
sub do_hyperref_pdfstartview_FitH {}
sub do_hyperref_breaklinks {}

sub do_cmd_href {
    local($_) = @_;
    local($url, $anchor);
    $url = &missing_braces unless (
	(s/$next_pair_pr_rx/$url = $2;''/eo)
	||(s/$next_pair_rx/$url = $2;''/eo));
    $anchor = &missing_braces unless (
	(s/$next_pair_pr_rx/$anchor=$2;''/eo)
	||(s/$next_pair_rx/$anchor=$2;''/eo));
    # and recode the ~ (don't turn it to space)
    $url =~ s/~/~/go;
    "<a href=\"$url\">$anchor</a>".$_;
}

1;