Commit | Line | Data |
---|---|---|
bba7b95e MW |
1 | <!-- -*-html-*- |
2 | - | |
3 | - Generate a dealing list for a single hand | |
4 | - | |
5 | - (c) 2013 Mark Wooding | |
6 | --> | |
7 | ||
8 | <table class=deal>\ | |
9 | <%perl> | |
10 | my @line = Deal::line; | |
11 | my ($row, $col, $box) = (0, 0, 0); | |
12 | for (my $i = 0; $i < @line; $i++) { | |
13 | if ($col) { | |
14 | $m->out(" "); | |
15 | } else { | |
16 | if (!$box) { | |
17 | my $class = | |
18 | $row == 0 ? "first" : | |
19 | $i + $nrow*$nbox >= @line ? "last" : | |
20 | "mid"; | |
21 | $m->out("\n<tr class=$class>"); | |
22 | } | |
23 | my $class = ($box + $row)%2 ? "odd " : "even"; | |
24 | $m->out("\n <td class=$class>"); | |
25 | } | |
26 | $m->out($line[$i]); | |
27 | $col++; | |
28 | if ($col >= $nbox) { $col = 0; $box++; } | |
29 | if ($box >= $nrow) { $box = 0; $row++; } | |
30 | } | |
31 | $m->out("\n"); | |
32 | </%perl> | |
33 | </table> | |
34 | %# | |
35 | <%flags> | |
36 | inherit => "%html" | |
37 | </%flags> | |
38 | %# | |
39 | <%args> | |
40 | $nbox => 4 | |
41 | $nrow => 4 | |
42 | </%args> | |
43 | %# | |
44 | <%method title>Single hand</%method> | |
45 | %# | |
46 | <%once> | |
47 | use Deal; | |
48 | </%once> | |
49 | %# | |
50 | <%init> | |
51 | unless ($m->dhandler_arg eq "") { | |
52 | $m->clear_buffer; | |
53 | $m->comp("%not-found", what => $m->dhandler_arg); | |
54 | } | |
55 | </%init> |