nings;
use autodie qw(:all);
use JSON::MaybeXS;
use File::Glob ':glob';
use File::Slurp;
use POSIX qw(strftime);
use File::stat;
my $cover_db = 'cover_db/cover.json';
my $output = 'cover_html/index.
html';
# Read and decode coverage data
my $json_text = read_file($cover_db);
my $data = decode_json($json_text);
my $coverage_pct = 0;
my $badge_color = 'red';
if(my $total_info = $data->{summary}{
} bsd_glob("coverage_history/*.json");
my $prev_data;
if (@history >= 1) {
my $prev_file = $history[-1]; # Most recent before current
eval {
$prev_data = decode_json(read_file($prev_file));
};
}
tured_data {
my ($self, $html) = @_;
my @jsonld = ($html =~ /<script\b[^>]*type=["']application\/ld\+json["'][^>]*>(.*?)<\/script>/gis);
if(scalar(@jsonld)) {
return {
name => 'Structured Da
otes => scalar(@jsonld) . ' JSON-LD block(s) found'
};
}
return {
name => 'Structured Data',
status => 'warn',
notes => 'no structured data found',
resolution => 'Add JSON-LD structured d
ata to <head>: <script type="application/ld+json">{"@context": "https://schema.org", "@type": "WebPage", "name": "Page Title", "description": "Page description"}</script> - helps search engines unders