diff --git a/lib/rules.json b/lib/rules.json index 693c1ea83..399a5689d 100644 --- a/lib/rules.json +++ b/lib/rules.json @@ -1223,7 +1223,7 @@ "

If this is a modified Recommendation that was modified in place or is a new edition, the document must include both the original publication date and the modification date. For example:

<p id=\"w3c-state\">W3C Recommendation 7 April 2004, edited in place 19 August2004</p>
" ], "docIDFormat": true, - "docIDOrder": "Document identifier information must be present in this order: ", + "docIDOrder": "Document identifier information must be present in this order: ", "docIDThisVersion": ["REC"], "docIDDate": true, "docIDLatestVersion": true, diff --git a/lib/rules/headers/errata.js b/lib/rules/headers/errata.js index 800ef5200..b5fdffcd5 100644 --- a/lib/rules/headers/errata.js +++ b/lib/rules/headers/errata.js @@ -2,15 +2,32 @@ const self = { name: 'headers.errata', + section: 'front-matter', + rule: 'docIDOrder', }; export const { name } = self; +// Check if document is Recommendation, and uses inline changes(REC with Candidate/Proposed changes) +function isRECWithChanges(sr) { + if (sr.config.status !== 'REC') { + return false; + } + + const recMeta = sr.getRecMetadata({}); + return Object.values(recMeta).length !== 0; +} + /** * @param sr * @param done */ export function check(sr, done) { + // for REC with Candidate/Proposed changes, no need to check errata link + if (isRECWithChanges(sr)) { + return done(); + } + const dts = sr.extractHeaders(); // Check 'Errata:' exist, don't check any further. if (!dts.Errata) { diff --git a/test/data/TR/Recommendation/REC.js b/test/data/TR/Recommendation/REC.js index c4f3ce2f9..13eb76e15 100644 --- a/test/data/TR/Recommendation/REC.js +++ b/test/data/TR/Recommendation/REC.js @@ -54,6 +54,22 @@ export const rules = { data: 'noErrata', errors: ['headers.errata.no-errata'], }, + { + data: 'recWithProposedSubChanges', + errors: [], + }, + { + data: 'recWithProposedNewChanges', + errors: [], + }, + { + data: 'recWithCandidateSubChanges', + errors: [], + }, + { + data: 'recWithCandidateNewChanges', + errors: [], + }, ], dl: [ ...baseRules.headers.dl, diff --git a/test/doc-views/TR/Recommendation/REC.js b/test/doc-views/TR/Recommendation/REC.js index 21350bf9b..033b69758 100644 --- a/test/doc-views/TR/Recommendation/REC.js +++ b/test/doc-views/TR/Recommendation/REC.js @@ -34,6 +34,66 @@ export default { needErrata: false, }, }, + recWithProposedSubChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + rec: { + ...good.sotd.rec, + showAddition: true, + addition: 'It includes proposed corrections.', + }, + }, + }, + recWithProposedNewChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + rec: { + ...good.sotd.rec, + showProposedAdd: true, + }, + }, + }, + recWithCandidateSubChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + rec: { + ...good.sotd.rec, + showAddition: true, + addition: 'It includes candidate corrections.', + }, + }, + }, + recWithCandidateNewChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + rec: { + ...good.sotd.rec, + showAddition: true, + addition: + 'It includes candidate additions, introducing new features since the previous Recommendation.', + }, + }, + }, }, deployment: { noDeployment: {