line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Obj2HTML::Plugin::SemanticUI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
609
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
755
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my @semanticnumbers = qw(zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen); |
7
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("segment", { |
8
|
|
|
|
|
|
|
tag => "div", |
9
|
|
|
|
|
|
|
attr => { class => "ui segment" } |
10
|
|
|
|
|
|
|
}); |
11
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("button", { |
12
|
|
|
|
|
|
|
attr => { class => "ui button" } |
13
|
|
|
|
|
|
|
}); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("help", { |
18
|
|
|
|
|
|
|
tag => "i", |
19
|
|
|
|
|
|
|
attr => { |
20
|
|
|
|
|
|
|
class => "blue circular icon help", |
21
|
|
|
|
|
|
|
style => "margin-left: 5px" |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
before => sub { |
24
|
|
|
|
|
|
|
my $o = shift; |
25
|
|
|
|
|
|
|
if (ref $o eq "HASH") { |
26
|
|
|
|
|
|
|
if ($o->{html}) { |
27
|
|
|
|
|
|
|
$o->{"data-html"} = $o->{html}; delete($o->{html}); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
if ($o->{text}) { |
30
|
|
|
|
|
|
|
$o->{"data-content"} = $o->{text}; delete($o->{text}); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
return ""; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
}); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("table", { |
38
|
|
|
|
|
|
|
before => sub { |
39
|
|
|
|
|
|
|
my $obj = shift; |
40
|
|
|
|
|
|
|
if (ref $obj eq "HASH") { |
41
|
|
|
|
|
|
|
if ($obj->{header}) { |
42
|
|
|
|
|
|
|
push(@{$obj->{_}}, thead => [ tr => HTML::Obj2HTML::iterate("th", $obj->{header}) ]); |
43
|
|
|
|
|
|
|
delete($obj->{header}); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
if ($obj->{rows}) { |
46
|
|
|
|
|
|
|
my @allrows; |
47
|
|
|
|
|
|
|
foreach my $r (@{$obj->{rows}}) { |
48
|
|
|
|
|
|
|
my @cols = (); |
49
|
|
|
|
|
|
|
foreach my $c (@{$r}) { |
50
|
|
|
|
|
|
|
push(@cols, td => $c); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
push(@allrows, tr => \@cols); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
push(@{$obj->{_}}, tbody => \@allrows); |
55
|
|
|
|
|
|
|
delete($obj->{rows}); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
return ""; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
attr => { class => 'ui celled table' } |
61
|
|
|
|
|
|
|
}); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Menus etc |
64
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("dropdownmenu", { |
65
|
|
|
|
|
|
|
tag => "div", |
66
|
|
|
|
|
|
|
attr => { class => "ui dropdown item" }, |
67
|
|
|
|
|
|
|
before => sub { |
68
|
|
|
|
|
|
|
my $obj = shift; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
if (ref $obj ne "HASH") { return ""; } |
71
|
|
|
|
|
|
|
my $label = $obj->{label}; |
72
|
|
|
|
|
|
|
delete($obj->{label}); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $items = $obj->{items}; |
75
|
|
|
|
|
|
|
foreach my $i (@{$items}) { |
76
|
|
|
|
|
|
|
if (ref $i eq "HASH") { |
77
|
|
|
|
|
|
|
if ($i->{class}) { $i->{class}.= " "; } |
78
|
|
|
|
|
|
|
$i->{class} .= "item"; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
delete($obj->{items}); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$obj->{_} = [ |
84
|
|
|
|
|
|
|
_ => $label." ", |
85
|
|
|
|
|
|
|
i => { class => "dropdown icon" }, |
86
|
|
|
|
|
|
|
div => { class => "menu", _ => $items } |
87
|
|
|
|
|
|
|
]; |
88
|
|
|
|
|
|
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
}); |
91
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("icon", { |
92
|
|
|
|
|
|
|
tag => "i", |
93
|
|
|
|
|
|
|
scalarattr => "class", |
94
|
|
|
|
|
|
|
attr => { class => "icon" } |
95
|
|
|
|
|
|
|
}); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("grid", { |
98
|
|
|
|
|
|
|
tag => "div", |
99
|
|
|
|
|
|
|
before => sub { |
100
|
|
|
|
|
|
|
my $o = shift; |
101
|
|
|
|
|
|
|
if (ref $o eq "HASH" && $o->{columns}) { |
102
|
|
|
|
|
|
|
if ($o->{class}) { $o->{class} .= " "; } |
103
|
|
|
|
|
|
|
$o->{class} .= $semanticnumbers[$o->{columns}]." column"; |
104
|
|
|
|
|
|
|
delete($o->{columns}); |
105
|
|
|
|
|
|
|
return ""; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
}, |
108
|
|
|
|
|
|
|
attr => { class => "ui grid" } |
109
|
|
|
|
|
|
|
}); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("row", { |
112
|
|
|
|
|
|
|
tag => "div", |
113
|
|
|
|
|
|
|
attr => { class => "row" } |
114
|
|
|
|
|
|
|
}); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("column", { |
117
|
|
|
|
|
|
|
tag => "div", |
118
|
|
|
|
|
|
|
before => sub { |
119
|
|
|
|
|
|
|
my $o = shift; |
120
|
|
|
|
|
|
|
if (ref $o eq "HASH" && $o->{wide}) { |
121
|
|
|
|
|
|
|
if ($o->{class}) { $o->{class} .= " "; } |
122
|
|
|
|
|
|
|
$o->{class} .= $semanticnumbers[$o->{wide}]." wide"; |
123
|
|
|
|
|
|
|
delete($o->{wide}); |
124
|
|
|
|
|
|
|
return ""; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
}, |
127
|
|
|
|
|
|
|
attr => { class => "column" } |
128
|
|
|
|
|
|
|
}); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("highlightbox", { |
131
|
|
|
|
|
|
|
tag => "div", |
132
|
|
|
|
|
|
|
attr => { class => "ui yellow message"} |
133
|
|
|
|
|
|
|
}); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |