File: xtable.src

package info (click to toggle)
wml 2.0.12ds1-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,432 kB
  • ctags: 116
  • sloc: perl: 5,634; sh: 3,663; makefile: 1,004
file content (93 lines) | stat: -rw-r--r-- 2,112 bytes parent folder | download | duplicates (5)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
##
##  wml::fmt::xtable - HTML tables through Advanced Syntax
##  Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved. 
##

#use wml::std::tags

<set-var __xtable:level=0 />
<define-tag xtable endtag=required>
<increment __xtable:level />
<perl filehandle="FH_XTABLE">
{
    my $tmpfile = "$(WML_TMPDIR)/wml.table.$$.tmp";
    my $options;
    <perl:assign $options>%attributes</perl:assign>;
    <when <eq <get-var __xtable:level /> 1 />>
    local *FH_XTABLE;
    open(FH_XTABLE, ">$tmpfile");
    </when>
    <perl:assign>
      <wwwtable $options>
        %body
      </wwwtable>
    </perl:assign>
</perl>
#   we cut here to change filehandle
<perl>
    <when <eq <get-var __xtable:level /> 1 />>
    print FH_XTABLE <perl:var />;
    close(FH_XTABLE);
    open(FH_XTABLE_IN,
       "$(WML_LOC_LIBDIR)/exec/wml_aux_freetable $tmpfile < /dev/null |");
    local ($/) = undef;
    <perl:var /> = <*FH_XTABLE_IN>;
    close(FH_XTABLE_IN);
    <perl:print:var />
    unlink("$tmpfile");
    </when>
}
</perl>
<decrement __xtable:level />
</define-tag>

##EOF##
__END__

=head1 NAME

wml::fmt::xtable - HTML tables through Advanced Syntax

=head1 SYNOPSIS

 #use wml::fmt::xtable
 
 <xtable table-options>
   initial text (e.g. <caption> ... </caption>).
   (X, Y) options for cell (X, Y)
   text for cell (X,Y)...
   ((X,Y)) options for header cell X,Y
   text for header cell (X,Y)...
 </xtable>

=head1 DESCRIPTION

This is just a WML wrapper for interfacing the wml_aux_freetable(1) utility
which converts its advanced table syntax to plain HTML table markup code. See
wml_aux_freetable(1) for more details.

=head1 CAVEATS
 
An error is reported if C<xtable> body contains ePerl code, so the
special variable C<IPP_NOSYNCLINES> has to be written onto C<#include>
lines (see wml_p1_ipp(1)), and macros expanded by C<wml_p2_mp4h>(1)
must not print ePerl code.
 
=head1 AUTHOR

 Ralf S. Engelschall
 rse@engelschall.com
 www.engelschall.com

=head1 REQUIRES

 Internal: P1, P2, P3, wml_aux_freetable (PATH)
 External: --

=head1 SEE ALSO

wml_aux_freetable(1),
HTML C<E<lt>tableE<gt>> tag.

=cut