@daisy/ace-report
Advanced tools
Comparing version 0.7.0 to 0.8.0
'use strict'; | ||
const escape = require('escape-html'); | ||
const handlebars = require('handlebars'); | ||
@@ -29,2 +30,3 @@ const fs = require('fs'); | ||
'EPUB': 'EPUB', | ||
'best-practice': 'Best Practice', | ||
'other': 'Other' | ||
@@ -57,3 +59,3 @@ }; | ||
function collectViolationStats(flatListOfViolations) { | ||
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB']; | ||
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB', 'best-practice']; | ||
@@ -64,2 +66,3 @@ var summaryData = { | ||
'EPUB': { 'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0 }, | ||
'best-practice': { 'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0 }, | ||
'other': { 'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0 }, | ||
@@ -85,3 +88,3 @@ 'total': { 'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0 } | ||
Object.keys(summaryData['total']).forEach(function (key) { | ||
summaryData['total'][key] += summaryData['wcag2a'][key] + summaryData['wcag2aa'][key] + summaryData['EPUB'][key] + summaryData['other'][key]; | ||
summaryData['total'][key] += summaryData['wcag2a'][key] + summaryData['wcag2aa'][key] + summaryData['EPUB'][key] + summaryData['best-practice'][key] + summaryData['other'][key]; | ||
}); | ||
@@ -115,3 +118,3 @@ | ||
var flatData = []; | ||
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB']; // applicable ruleset tags | ||
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB', 'best-practice']; // applicable ruleset tags | ||
@@ -149,2 +152,5 @@ violations.forEach(function (assertion) { | ||
} | ||
if (item["earl:result"]["html"]) { | ||
obj.html = escape(item["earl:result"]["html"]); | ||
} | ||
flatData.push(obj); | ||
@@ -151,0 +157,0 @@ }); |
@@ -36,3 +36,3 @@ /* eslint no-param-reassign: ["error", { "props": false }] */ | ||
function withTestSubject(obj, url, title = '', identifier = '', metadata = null) { | ||
function withTestSubject(obj, url, title = '', identifier = '', metadata = null, links = null) { | ||
const testSubject = { url }; | ||
@@ -42,2 +42,3 @@ if (title.length > 0) testSubject['dct:title'] = title; | ||
if (metadata !== undefined && metadata != null) testSubject.metadata = metadata; | ||
if (links !== undefined && links != null) testSubject.links = links; | ||
obj['earl:testSubject'] = testSubject; | ||
@@ -146,4 +147,4 @@ return obj; | ||
} | ||
withTestSubject(url, title, identifier, metadata) { | ||
withTestSubject(this._json, url, title, identifier, metadata); | ||
withTestSubject(url, title, identifier, metadata, links) { | ||
withTestSubject(this._json, url, title, identifier, metadata, links); | ||
return this; | ||
@@ -164,2 +165,6 @@ } | ||
} | ||
withHTML(html) { | ||
this._json['html'] = html; | ||
return this; | ||
} | ||
withPointer(css, cfi) { | ||
@@ -166,0 +171,0 @@ this._json['earl:pointer'] = { cfi, css }; |
@@ -43,3 +43,3 @@ 'use strict'; | ||
constructor(epub) { | ||
this._builder = new builders.ReportBuilder().withTestSubject(epub.path, '', '', epub.metadata).withA11yMeta(a11yMetaChecker.analyze(epub.metadata)); | ||
this._builder = new builders.ReportBuilder().withTestSubject(epub.path, '', '', epub.metadata, epub.links).withA11yMeta(a11yMetaChecker.analyze(epub.metadata)); | ||
} | ||
@@ -58,6 +58,2 @@ | ||
} | ||
addOutline(outline) { | ||
this._builder.withHOutline(outline); | ||
return this; | ||
} | ||
addHeadings(headings) { | ||
@@ -64,0 +60,0 @@ this._builder.withHeadingsOutline(headingsToOutline(headings)); |
{ | ||
"name": "@daisy/ace-report", | ||
"version": "0.7.0", | ||
"version": "v0.8.0", | ||
"description": "Reporting utilities for Ace", | ||
@@ -20,2 +20,3 @@ "author": { | ||
"dependencies": { | ||
"escape-html": "^1.0.3", | ||
"fs-extra": "^4.0.2", | ||
@@ -22,0 +23,0 @@ "handlebars": "^4.0.11", |
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
35558
479
4
1
+ Addedescape-html@^1.0.3
+ Addedescape-html@1.0.3(transitive)