website/gen-config.pl

filter: Statementstmt 62.0% 31 / 50 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 53.3% 8 / 15 Podpod n/a totaltotal 52.0% 39 / 75 CC 6 SCAR 14.6
CC
6
Cov
52%
__ANON__
12.0
__ANON__
6.0
__ANON__
6.0
CRAP 4.3
« blib/lib/FP/Trie/t.pm ↑ Summary bin/expand-tail »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use experimental "signatures";
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our ($mydir, $gitrepository); # 'import' from main
8  
9 1 ▶use PXML::XHTML ":all";
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Clone 'clone';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use FP::Lazy;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # htmlgen is run with CWD set to website/
14 1 my $logocfg = require "./logo.pl";
15  
16 1 my $css_path0 = "FP.css";
17  
18 0 ▶my $version_numrevisions = lazy {
Subroutine __ANON__: not called CC=2 SCAR=17.9
19 0 my $describe = $gitrepository->describe();
20 0 ▶ my ($version, $maybe_numrevisions, $maybe_shorthash)
Branch: 1 branch
BranchTrueFalseTotal
() = $describe =~ /^(.*?)(?:-(\d+)-g(.*))?\z/s or die "huh describe '${describe}'" 0 0 0
21 = $describe =~ /^(.*?)(?:-(\d+)-g(.*))?\z/s
22 or die "huh describe '$describe'";
23 0 [$version, $maybe_numrevisions]
24 1 };
25  
26 1 my $year = (localtime)[5] + 1900;
27  
28 1 my $email = "copying\@christianjaeger.ch"; # ? or ch@?
29  
30 +{
31 0 ▶ map_code_body => sub ($str, $uplist, $path0) {
Subroutine __ANON__: not called CC=3 SCAR=24.8
32 0 my ($version, $maybe_numrevisions) = @{ force $version_numrevisions};
33 0 my $version_underscores = $version;
34 0 $version_underscores =~ tr/./_/;
35 0 ▶ my $commits
Branch: 2 branches
BranchTrueFalseTotal
$maybe_numrevisions ? : 0 0 0
$maybe_numrevisions == 1 ? : 0 0 0
36 = $maybe_numrevisions
37 ? ($maybe_numrevisions == 1
38 ? "$maybe_numrevisions commit"
39 : "$maybe_numrevisions commits")
40 : "zero commits";
41  
42 0 $str =~ s|\$FP_VERSION\b|$version|sg;
43 0 $str =~ s|\$FP_VERSION_UNDERSCORES\b|$version_underscores|sg;
44 0 $str =~ s|\$FP_COMMITS_DIFFERENCE\b|$commits|sg;
45 0 $str
46 },
47  
48 #copy_paths => [], optional, for path0s from the main source root
49 copy_paths_separate =>
50  
51 # source_root => path0s
52 +{ "." => ["FP-logo.png", $css_path0,] },
53 path0_handlers => +{},
54 0 ▶ title => sub($filetitle) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
55 (
56 0 ▶ $filetitle eq "Readme"
Branch: 1 branch
BranchTrueFalseTotal
$filetitle eq 'Readme' ? : 0 0 0
57 ? "Functional programming in Perl"
58 : $filetitle,
59 " - functional-perl.org"
60 )
61 },
62 0 ▶ head => sub($path0) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
63  
64 # HTML to add to the <head> section
65 0 LINK(
66 {
67 rel => "stylesheet",
68 href => path_diff($path0, $css_path0),
69 type => "text/css"
70 }
71 )
72 },
73  
74 0 ▶ header => sub($path0) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
75  
76 # HTML above navigation
77  
78 # XX hack: clone it so that serialization doesn't kill parts of
79 # it (by way of `weaken`ing)
80 clone $logocfg->($path0)->{logo}
81 0 },
82 nav => nav(
83 entry(
84 "README.md", entry("docs/intro.md"),
85 entry("docs/howto.md"), entry("docs/design.md"),
86 entry("examples/README.md")
87 ),
88 entry("functional_XML/README.md", entry("functional_XML/TODO.md")),
89 entry("htmlgen/README.md", entry("htmlgen/TODO.md")),
90 entry("docs/ideas.md"),
91 entry("docs/TODO.md", entry("docs/names.md")),
92 entry("docs/HACKING.md"),
93 entry("COPYING.md", entry("licenses/artistic_license_2.0.md")),
94 entry("docs/links.md"),
95 entry("docs/contact.md", entry("docs/mailing_list.md")),
96 entry(
97 "docs/blog/index.md",
98 entry("docs/blog/perl-weekly-challenges-113.md"),
99 entry("docs/blog/perl_weekly_challenges_114.md")
100 )
101 ),
102 0 ▶ belownav => sub($path0) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
103  
104 # HTML between navigation and page content.
105 # path0 is the source (.md) file.
106  
107 0 DIV(
108 { class => "editandhist" },
109 A(
110 {
111 href =>
112 "https://github.com/pflanze/functional-perl/commits/master/$path0"
113 },
114 "history"
115 ),
116 " | ",
117 A(
118 {
119 href =>
120 "https://github.com/pflanze/functional-perl/edit/master/$path0"
121 },
122 "edit"
123 )
124 )
125 },
126 0 ▶ footer => sub($path0) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
127 0 my $yearstart = 2014;
128 0 ▶ my $years = $year == $yearstart ? $year : "$yearstart-$year";
Branch: 1 branch
BranchTrueFalseTotal
$year == $yearstart ? : 0 0 0
129 0 DIV(
130 { class => "footer_legalese" },
131  
132 # our part
133 "© $years ", A({ href => "mailto:$email" }, "Christian Jaeger"),
134  
135 ". ",
136  
137 # camel logo
138 "The Perl camel image is a trademark of ",
139 A({ href => "http://www.oreilly.com" }, "O'Reilly Media, Inc."),
140 " Used with permission."
141 )
142 },
143  
144 1 warn_hint => 1, # warn if the website hint (header) is missing in a
145 # .md file
146  
147 downcaps =>
148 1, # whether to downcase all-caps filenames like README -> Readme
149 }
« blib/lib/FP/Trie/t.pm ↑ Summary bin/expand-tail »