line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Obj2HTML::Plugin::SemanticUI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
586
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
601
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my @tabs = (); |
7
|
|
|
|
|
|
|
my @content = (); |
8
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("tabsection", { |
9
|
|
|
|
|
|
|
tag => "", |
10
|
|
|
|
|
|
|
before => sub { |
11
|
|
|
|
|
|
|
my $obj = shift; |
12
|
|
|
|
|
|
|
@tabs = (); |
13
|
|
|
|
|
|
|
@content = (); |
14
|
|
|
|
|
|
|
return HTML::Obj2HTML::gen($obj); |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
after => sub { |
17
|
|
|
|
|
|
|
my $obj = shift; |
18
|
|
|
|
|
|
|
my $divinner = { |
19
|
|
|
|
|
|
|
class => "ui tabular menu", |
20
|
|
|
|
|
|
|
_ => \@tabs |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
if (ref $obj eq "HASH") { |
23
|
|
|
|
|
|
|
foreach my $k (%{$obj}) { |
24
|
|
|
|
|
|
|
if (defined $divinner->{$k}) { $divinner->{$k} .= " ".$obj->{$k}; } else { $divinner->{$k} = $obj->{$k}; } |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
return HTML::Obj2HTML::gen([ div => $divinner, \@content ]); |
27
|
|
|
|
|
|
|
} else { |
28
|
|
|
|
|
|
|
return HTML::Obj2HTML::gen([ div => { class => "ui top attached tabular menu", _ => \@tabs }, \@content ]); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
}); |
32
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("tab", { |
33
|
|
|
|
|
|
|
tag => "", |
34
|
|
|
|
|
|
|
before => sub { |
35
|
|
|
|
|
|
|
my $obj = shift; |
36
|
|
|
|
|
|
|
if ($obj->{class}) { $obj->{class} .= " "; } |
37
|
|
|
|
|
|
|
if ($obj->{active}) { $obj->{class} .= "active "; } |
38
|
|
|
|
|
|
|
push(@tabs, div => { class => $obj->{class}."item", "data-tab" => $obj->{tab}, _ => $obj->{label} }); |
39
|
|
|
|
|
|
|
push(@content, div => { class => $obj->{class}."ui bottom attached tab segment", "data-tab" => $obj->{tab}, _ => $obj->{content} }); |
40
|
|
|
|
|
|
|
return ""; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
}); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $stepcontent = {}; |
45
|
|
|
|
|
|
|
my $steplabels = {}; |
46
|
|
|
|
|
|
|
my $curstepid; |
47
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("steps", { |
48
|
|
|
|
|
|
|
tag => "", |
49
|
|
|
|
|
|
|
before => sub { |
50
|
|
|
|
|
|
|
my $o = shift; |
51
|
|
|
|
|
|
|
my $content = $o->{_}; |
52
|
|
|
|
|
|
|
$stepcontent->{$o->{id}} = []; |
53
|
|
|
|
|
|
|
$steplabels->{$o->{id}} = []; |
54
|
|
|
|
|
|
|
$curstepid = $o->{id}; |
55
|
|
|
|
|
|
|
HTML::Obj2HTML::gen($content); # This processes it, but it doesn't actually generate anything, that's handled by the after() |
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
after => sub { |
58
|
|
|
|
|
|
|
my $o = shift; |
59
|
|
|
|
|
|
|
my $id = ""; |
60
|
|
|
|
|
|
|
if (ref $o eq "HASH") { $id = $o->{id}; } |
61
|
|
|
|
|
|
|
my $cls = HTML::Obj2HTML::combineClasses("ui steps", $o->{class}); |
62
|
|
|
|
|
|
|
my $ccls = HTML::Obj2HTML::combineClasses("stepcontent", $o->{contentclass}); |
63
|
|
|
|
|
|
|
return [ |
64
|
|
|
|
|
|
|
div => { "data-stepid" => $id, class => $cls, _ => \@{$steplabels->{$o->{id}}} }, |
65
|
|
|
|
|
|
|
div => { "data-stepid" => $id, class => $ccls, _ => \@{$stepcontent->{$o->{id}}} } |
66
|
|
|
|
|
|
|
]; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
}); |
69
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("step", { |
70
|
|
|
|
|
|
|
tag => "", |
71
|
|
|
|
|
|
|
before => sub { |
72
|
|
|
|
|
|
|
my $o = shift; |
73
|
|
|
|
|
|
|
my @steplabels = @{$steplabels->{$curstepid}}; |
74
|
|
|
|
|
|
|
my $cnt = (($#steplabels+1)/2)+1; # -1 = no steps, start count from 1, therefore +2. |
75
|
|
|
|
|
|
|
if (!@steplabels) { |
76
|
|
|
|
|
|
|
push(@{$steplabels->{$curstepid}}, div => { "data-stepid" => $curstepid, class => 'active step', "data-stepnum" => $cnt, _ => $o->{label} }); |
77
|
|
|
|
|
|
|
push(@{$stepcontent->{$curstepid}}, div => { "data-stepid" => $curstepid, "data-stepnum" => $cnt, _ => $o->{_} }); |
78
|
|
|
|
|
|
|
} else { |
79
|
|
|
|
|
|
|
push(@{$steplabels->{$curstepid}}, div => { "data-stepid" => $curstepid, class => 'step', "data-stepnum" => $cnt, _ => $o->{label} }); |
80
|
|
|
|
|
|
|
push(@{$stepcontent->{$curstepid}}, div => { "data-stepid" => $curstepid, "data-stepnum" => $cnt, style => 'display: none;', _ => $o->{_} }); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
return; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
}); |
85
|
|
|
|
|
|
|
1; |