line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Obj2HTML::Plugin::SemanticUI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
538
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
630
|
|
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 ($o->{html}) { |
26
|
|
|
|
|
|
|
$o->{"data-html"} = $o->{html}; delete($o->{html}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
if ($o->{text}) { |
29
|
|
|
|
|
|
|
$o->{"data-content"} = $o->{text}; delete($o->{text}); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
return ""; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
}); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("table", { |
36
|
|
|
|
|
|
|
before => sub { |
37
|
|
|
|
|
|
|
my $obj = shift; |
38
|
|
|
|
|
|
|
if (ref $obj eq "HASH") { |
39
|
|
|
|
|
|
|
if ($obj->{header}) { |
40
|
|
|
|
|
|
|
push(@{$obj->{_}}, thead => [ tr => HTML::Obj2HTML::iterate("th", $obj->{header}) ]); |
41
|
|
|
|
|
|
|
delete($obj->{header}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
if ($obj->{rows}) { |
44
|
|
|
|
|
|
|
my @allrows; |
45
|
|
|
|
|
|
|
foreach my $r (@{$obj->{rows}}) { |
46
|
|
|
|
|
|
|
my @cols = (); |
47
|
|
|
|
|
|
|
foreach my $c (@{$r}) { |
48
|
|
|
|
|
|
|
push(@cols, td => $c); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
push(@allrows, tr => \@cols); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
push(@{$obj->{_}}, tbody => \@allrows); |
53
|
|
|
|
|
|
|
delete($obj->{rows}); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
return ""; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
attr => { class => 'ui celled table' } |
59
|
|
|
|
|
|
|
}); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Menus etc |
62
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("dropdownmenu", { |
63
|
|
|
|
|
|
|
tag => "div", |
64
|
|
|
|
|
|
|
attr => { class => "ui dropdown item" }, |
65
|
|
|
|
|
|
|
before => sub { |
66
|
|
|
|
|
|
|
my $obj = shift; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $label = $obj->{label}; |
69
|
|
|
|
|
|
|
delete($obj->{label}); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $items = $obj->{items}; |
72
|
|
|
|
|
|
|
foreach my $i (@{$items}) { |
73
|
|
|
|
|
|
|
if (ref $i eq "HASH") { |
74
|
|
|
|
|
|
|
if ($i->{class}) { $i->{class}.= " "; } |
75
|
|
|
|
|
|
|
$i->{class} .= "item"; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
delete($obj->{items}); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$obj->{_} = [ |
81
|
|
|
|
|
|
|
_ => $label." ", |
82
|
|
|
|
|
|
|
i => { class => "dropdown icon" }, |
83
|
|
|
|
|
|
|
div => { class => "menu", _ => $items } |
84
|
|
|
|
|
|
|
]; |
85
|
|
|
|
|
|
|
return; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
}); |
88
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("icon", { |
89
|
|
|
|
|
|
|
tag => "i", |
90
|
|
|
|
|
|
|
scalarattr => "class", |
91
|
|
|
|
|
|
|
attr => { class => "icon" } |
92
|
|
|
|
|
|
|
}); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("grid", { |
95
|
|
|
|
|
|
|
tag => "div", |
96
|
|
|
|
|
|
|
before => sub { |
97
|
|
|
|
|
|
|
my $o = shift; |
98
|
|
|
|
|
|
|
if (ref $o eq "HASH" && $o->{columns}) { |
99
|
|
|
|
|
|
|
if ($o->{class}) { $o->{class} .= " "; } |
100
|
|
|
|
|
|
|
$o->{class} .= $semanticnumbers[$o->{columns}]." column"; |
101
|
|
|
|
|
|
|
delete($o->{columns}); |
102
|
|
|
|
|
|
|
return ""; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
attr => { class => "ui grid" } |
106
|
|
|
|
|
|
|
}); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("row", { |
109
|
|
|
|
|
|
|
tag => "div", |
110
|
|
|
|
|
|
|
attr => { class => "row" } |
111
|
|
|
|
|
|
|
}); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("column", { |
114
|
|
|
|
|
|
|
tag => "div", |
115
|
|
|
|
|
|
|
before => sub { |
116
|
|
|
|
|
|
|
my $o = shift; |
117
|
|
|
|
|
|
|
if (ref $o eq "HASH" && $o->{wide}) { |
118
|
|
|
|
|
|
|
if ($o->{class}) { $o->{class} .= " "; } |
119
|
|
|
|
|
|
|
$o->{class} .= $semanticnumbers[$o->{wide}]." wide"; |
120
|
|
|
|
|
|
|
delete($o->{wide}); |
121
|
|
|
|
|
|
|
return ""; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
}, |
124
|
|
|
|
|
|
|
attr => { class => "column" } |
125
|
|
|
|
|
|
|
}); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
HTML::Obj2HTML::register_extension("highlightbox", { |
128
|
|
|
|
|
|
|
tag => "div", |
129
|
|
|
|
|
|
|
attr => { class => "ui yellow message"} |
130
|
|
|
|
|
|
|
}); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |