File: longtable.perl

package info (click to toggle)
latex2html 2015-debian1-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 7,652 kB
  • ctags: 3,386
  • sloc: perl: 30,941; makefile: 429; sh: 155
file content (62 lines) | stat: -rw-r--r-- 1,568 bytes parent folder | download | duplicates (9)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- perl -*-
# longtable.perl by Denis Koelewijn
#
# Extension to LaTeX2HTML supply support for the "longtable"
# LaTeX style, as described in "The LaTeX Companion," by
# Goossens, Mittelbach and Samarin (ISBN 0-201-54199-8). 
#
# Change Log:
# ===========
# MRO: added changes proposed by Keith Refson

package main;
#
#  Translate the longtable environment as
#  an ordinary table.

sub do_env_longtable {
    local($_) = @_;
    my $cols;
    $cols = &missing_braces unless (
	(s/$next_pair_pr_rx/$cols=$&;''/eo)
	||(s/$next_pair_rx/$cols=$&;''/eo));

    local($cap_env,$captions) = ('table', $captions);
    if (/\\caption\s*(\*?)/) {
	my $star = $1;
	do { local($contents) = $_;
	    &extract_captions($cap_env);
	    $_ = $contents; undef $contents;
	    # remove the artificial prefix, if it's a  \caption*
	    $captions =~ s!^<(STRONG>).*?</\1\s*!!s if ($star);
	}
    };
    my ($this, $head, $foot, $which);
    local($border);
    while (/\\end(((first)?head)|(last)?foot)\b/s ) {
	if ($3) { $head = $`}
	elsif ($2) { $head = $` unless ($head) }
	elsif ($4) { $foot = $` }
	else { $foot = $` unless ($foot) }
	$_ = $'; $this = $`;
	if ($this =~ /(\\[hv]line)\b/) { $border = $1 }
    }
    if ($head) { $head =~ s/\\\\\s*$//s; $head .= '\\\\'."\n"; }
    if ($foot) { $_ =~ s/\\\\\s*$//s; $_ .= '\\\\'."\n"; }
    # Keith Refson: replace \\tabularnewline
    s/\\tabularnewline/\\\\/gs;
    &do_env_tabular("$cols$head$_$foot")
}

&ignore_commands( <<_IGNORED_CMDS_);
LTleft
LTright
LTpre
LTpost
LTcapwidth
LTchunksize
setlongtables
_IGNORED_CMDS_

1;