Obj2HTML/Plugin/SemanticUIBase.pm

filter: Statementstmt 24.0% 18 / 75 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 28.5% 2 / 7 Podpod n/a totaltotal 16.9% 20 / 118 SCAR 54.2
CC
19
Cov
17%
__ANON__
42.0
__ANON__
30.0
__ANON__
20.0
CRAP 226.7
« 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=4 SCAR=30.0
25 0 ▶ if (ref $o eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $o eq "HASH") 0 0 0
26 0 ▶ if ($o->{html}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"html"}) 0 0 0
27 0 $o->{"data-html"} = $o->{html}; delete($o->{html});
28 }
29 0 ▶ if ($o->{text}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"text"}) 0 0 0
30 0 $o->{"data-content"} = $o->{text}; delete($o->{text});
31 }
32 }
33 0 return "";
34 }
35 1 });
36  
37 HTML::Obj2HTML::register_extension("table", {
38 before => sub {
39 0 ▶ my $obj = shift;
Subroutine __ANON__: not called CC=6 SCAR=37.4
40 0 ▶ if (ref $obj eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $obj eq "HASH") 0 0 0
41 0 ▶ if ($obj->{header}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->{"header"}) 0 0 0
42 0 push(@{$obj->{_}}, thead => [ tr => HTML::Obj2HTML::iterate("th", $obj->{header}) ]);
43 0 delete($obj->{header});
44 }
45 0 ▶ if ($obj->{rows}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->{"rows"}) 0 0 0
46 0 my @allrows;
47 0 foreach my $r (@{$obj->{rows}}) {
48 0 my @cols = ();
49 0 foreach my $c (@{$r}) {
50 0 push(@cols, td => $c);
51 }
52 0 push(@allrows, tr => \@cols);
53 }
54 0 push(@{$obj->{_}}, tbody => \@allrows);
55 0 delete($obj->{rows});
56 }
57 0 return "";
58 }
59 },
60 1 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 0 ▶ my $obj = shift;
Subroutine __ANON__: not called CC=5 SCAR=34.0
69  
70 0 ▶ if (ref $obj ne "HASH") { return ""; }
Branch: 1 branch
BranchTrueFalseTotal
if (ref $obj ne "HASH") 0 0 0
71 0 my $label = $obj->{label};
72 0 delete($obj->{label});
73  
74 0 my $items = $obj->{items};
75 0 foreach my $i (@{$items}) {
76 0 ▶ if (ref $i eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $i eq "HASH") 0 0 0
77 0 ▶ if ($i->{class}) { $i->{class}.= " "; }
Branch: 1 branch
BranchTrueFalseTotal
if ($i->{"class"}) 0 0 0
78 0 $i->{class} .= "item";
79 }
80 }
81 0 delete($obj->{items});
82  
83 $obj->{_} = [
84 0 _ => $label." ",
85 i => { class => "dropdown icon" },
86 div => { class => "menu", _ => $items }
87 ];
88 0 return;
89 }
90 1 });
91 1 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 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=4 SCAR=30.0
101 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
102 0 ▶ if ($o->{class}) { $o->{class} .= " "; }
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"class"}) 0 0 0
103 0 $o->{class} .= $semanticnumbers[$o->{columns}]." column";
104 0 delete($o->{columns});
105 0 return "";
106 }
107 },
108 1 attr => { class => "ui grid" }
109 });
110  
111 1 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 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=4 SCAR=30.0
120 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
121 0 ▶ if ($o->{class}) { $o->{class} .= " "; }
Branch: 1 branch
BranchTrueFalseTotal
if ($o->{"class"}) 0 0 0
122 0 $o->{class} .= $semanticnumbers[$o->{wide}]." wide";
123 0 delete($o->{wide});
124 0 return "";
125 }
126 },
127 1 attr => { class => "column" }
128 });
129  
130 1 HTML::Obj2HTML::register_extension("highlightbox", {
131 tag => "div",
132 attr => { class => "ui yellow message"}
133 });
134  
135 1 1;
« Obj2HTML/Plugin/SemanticUIForms.pm ↑ Summary Obj2HTML/Plugin/DB2PO.pm »