Obj2HTML/Plugin/SemanticUIBase.pm

filter: Statementstmt 25.0% 18 / 72 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 28.5% 2 / 7 Podpod n/a totaltotal 18.0% 20 / 111 SCAR 51.7
CC
17
Cov
18%
__ANON__
42.0
__ANON__
20.0
__ANON__
20.0
CRAP 176.3
« Obj2HTML/Plugin/SemanticUIForms.pm ↑ Summary Obj2HTML/Plugin/DB2PO.pm »
1 package HTML::Obj2HTML::Plugin::SemanticUI;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 my @semanticnumbers = qw(zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen);
7 1 HTML::Obj2HTML::register_extension("segment", {
8 tag => "div",
9 attr => { class => "ui segment" }
10 });
11 1 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 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=3 SCAR=24.8
25 0 ▶ if ($o->{html}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"html"}) 0 0 0
26 0 $o->{"data-html"} = $o->{html}; delete($o->{html});
27 }
28 0 ▶ if ($o->{text}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"text"}) 0 0 0
29 0 $o->{"data-content"} = $o->{text}; delete($o->{text});
30 }
31 0 return "";
32 }
33 1 });
34  
35 HTML::Obj2HTML::register_extension("table", {
36 before => sub {
37 0 ▶ my $obj = shift;
Subroutine __ANON__: not called CC=6 SCAR=37.4
38 0 ▶ if (ref $obj eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $obj eq "HASH") 0 0 0
39 0 ▶ if ($obj->{header}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->{"header"}) 0 0 0
40 0 push(@{$obj->{_}}, thead => [ tr => HTML::Obj2HTML::iterate("th", $obj->{header}) ]);
41 0 delete($obj->{header});
42 }
43 0 ▶ if ($obj->{rows}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->{"rows"}) 0 0 0
44 0 my @allrows;
45 0 foreach my $r (@{$obj->{rows}}) {
46 0 my @cols = ();
47 0 foreach my $c (@{$r}) {
48 0 push(@cols, td => $c);
49 }
50 0 push(@allrows, tr => \@cols);
51 }
52 0 push(@{$obj->{_}}, tbody => \@allrows);
53 0 delete($obj->{rows});
54 }
55 0 return "";
56 }
57 },
58 1 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 0 ▶ my $obj = shift;
Subroutine __ANON__: not called CC=4 SCAR=30.0
67  
68 0 my $label = $obj->{label};
69 0 delete($obj->{label});
70  
71 0 my $items = $obj->{items};
72 0 foreach my $i (@{$items}) {
73 0 ▶ if (ref $i eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $i eq "HASH") 0 0 0
74 0 ▶ if ($i->{class}) { $i->{class}.= " "; }
Branch: 1 branch
BranchTrueFalseTotal
if ($i->{"class"}) 0 0 0
75 0 $i->{class} .= "item";
76 }
77 }
78 0 delete($obj->{items});
79  
80 $obj->{_} = [
81 0 _ => $label." ",
82 i => { class => "dropdown icon" },
83 div => { class => "menu", _ => $items }
84 ];
85 0 return;
86 }
87 1 });
88 1 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 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=4 SCAR=30.0
98 0 ▶ if (ref $o eq "HASH" && $o->{columns}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $o eq "HASH" and $o->{"columns"}) 0 0 0
Condition0%0/3
ref $o eq "HASH" and $o->{"columns"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $o eq "HASH" and $o->{"columns"}
ref $o eq "HASH" $o->{"columns"}
Truth table0%0/3
A and B
A= ref $o eq "HASH"B= $o->{"columns"}
ABresult
0X0
100
111
99 0 ▶ if ($o->{class}) { $o->{class} .= " "; }
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"class"}) 0 0 0
100 0 $o->{class} .= $semanticnumbers[$o->{columns}]." column";
101 0 delete($o->{columns});
102 0 return "";
103 }
104 },
105 1 attr => { class => "ui grid" }
106 });
107  
108 1 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 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=4 SCAR=30.0
117 0 ▶ if (ref $o eq "HASH" && $o->{wide}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $o eq "HASH" and $o->{"wide"}) 0 0 0
Condition0%0/3
ref $o eq "HASH" and $o->{"wide"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $o eq "HASH" and $o->{"wide"}
ref $o eq "HASH" $o->{"wide"}
Truth table0%0/3
A and B
A= ref $o eq "HASH"B= $o->{"wide"}
ABresult
0X0
100
111
118 0 ▶ if ($o->{class}) { $o->{class} .= " "; }
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"class"}) 0 0 0
119 0 $o->{class} .= $semanticnumbers[$o->{wide}]." wide";
120 0 delete($o->{wide});
121 0 return "";
122 }
123 },
124 1 attr => { class => "column" }
125 });
126  
127 1 HTML::Obj2HTML::register_extension("highlightbox", {
128 tag => "div",
129 attr => { class => "ui yellow message"}
130 });
131  
132 1 1;
« Obj2HTML/Plugin/SemanticUIForms.pm ↑ Summary Obj2HTML/Plugin/DB2PO.pm »