From 4a8747333cfa7b26345fc9041b6655faed3f8eda Mon Sep 17 00:00:00 2001 From: jennyliang Date: Mon, 5 Dec 2022 12:21:20 +0800 Subject: [PATCH 1/8] Not check errata link for REC with Candidate/Proposed changes --- lib/rules/headers/errata.js | 16 +++++++++ test/data/TR/Recommendation/REC.js | 16 +++++++++ test/doc-views/TR/Recommendation/REC.js | 44 +++++++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/lib/rules/headers/errata.js b/lib/rules/headers/errata.js index 800ef5200..5f8cfbc6e 100644 --- a/lib/rules/headers/errata.js +++ b/lib/rules/headers/errata.js @@ -6,11 +6,27 @@ const self = { export const { name } = self; +// Check if document is Recommendation, and uses inline changes(REC with Candidate/Proposed changes) +function isRECWithChanges(sr) { + const isREC = sr.config.status === 'REC'; + if (!isREC) { + return false; + } + + const recMeta = sr.getRecMetadata({}); + return Object.values(recMeta).some(v => !!v); +} + /** * @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..59db47d54 100644 --- a/test/doc-views/TR/Recommendation/REC.js +++ b/test/doc-views/TR/Recommendation/REC.js @@ -34,6 +34,50 @@ export default { needErrata: false, }, }, + recWithProposedSubChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + emHTML: `${good.sotd.emHTML} It includes proposed corrections.`, + }, + }, + recWithProposedNewChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + emHTML: `${good.sotd.emHTML} It includes proposed additions, introducing new features since the previous Recommendation.`, + }, + }, + recWithCandidateSubChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + emHTML: `${good.sotd.emHTML} It includes candidate corrections.`, + }, + }, + recWithCandidateNewChanges: { + ...good, + config: { + ...good.config, + needErrata: false, + }, + sotd: { + ...good.sotd, + emHTML: `${good.sotd.emHTML} It includes candidate additions, introducing new features since the previous Recommendation.`, + }, + }, }, deployment: { noDeployment: { From 73bba18cbe5f85fd815e5da75813eddd560c5828 Mon Sep 17 00:00:00 2001 From: JiayingL Date: Tue, 6 Dec 2022 14:38:04 +0800 Subject: [PATCH 2/8] Update lib/rules/headers/errata.js Co-authored-by: Denis Ah-Kang --- lib/rules/headers/errata.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rules/headers/errata.js b/lib/rules/headers/errata.js index 5f8cfbc6e..206ef9516 100644 --- a/lib/rules/headers/errata.js +++ b/lib/rules/headers/errata.js @@ -8,8 +8,7 @@ export const { name } = self; // Check if document is Recommendation, and uses inline changes(REC with Candidate/Proposed changes) function isRECWithChanges(sr) { - const isREC = sr.config.status === 'REC'; - if (!isREC) { + if (sr.config.status !== 'REC') { return false; } From a80e1ea4aac2f72159c2e92d3d7f78fcff2021ca Mon Sep 17 00:00:00 2001 From: JiayingL Date: Tue, 6 Dec 2022 14:38:15 +0800 Subject: [PATCH 3/8] Update lib/rules/headers/errata.js Co-authored-by: Denis Ah-Kang --- lib/rules/headers/errata.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/headers/errata.js b/lib/rules/headers/errata.js index 206ef9516..1b8fabbc2 100644 --- a/lib/rules/headers/errata.js +++ b/lib/rules/headers/errata.js @@ -13,7 +13,7 @@ function isRECWithChanges(sr) { } const recMeta = sr.getRecMetadata({}); - return Object.values(recMeta).some(v => !!v); + return Object.values(recMeta).length !== 0; } /** From 705d60d3e8163e54e132009d083581027497586b Mon Sep 17 00:00:00 2001 From: jennyliang Date: Wed, 7 Dec 2022 11:09:28 +0800 Subject: [PATCH 4/8] address comment https://github.com/w3c/specberus/pull/1680#discussion_r1039163718 --- test/doc-views/TR/Recommendation/REC.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/test/doc-views/TR/Recommendation/REC.js b/test/doc-views/TR/Recommendation/REC.js index 59db47d54..033b69758 100644 --- a/test/doc-views/TR/Recommendation/REC.js +++ b/test/doc-views/TR/Recommendation/REC.js @@ -42,7 +42,11 @@ export default { }, sotd: { ...good.sotd, - emHTML: `${good.sotd.emHTML} It includes proposed corrections.`, + rec: { + ...good.sotd.rec, + showAddition: true, + addition: 'It includes proposed corrections.', + }, }, }, recWithProposedNewChanges: { @@ -53,7 +57,10 @@ export default { }, sotd: { ...good.sotd, - emHTML: `${good.sotd.emHTML} It includes proposed additions, introducing new features since the previous Recommendation.`, + rec: { + ...good.sotd.rec, + showProposedAdd: true, + }, }, }, recWithCandidateSubChanges: { @@ -64,7 +71,11 @@ export default { }, sotd: { ...good.sotd, - emHTML: `${good.sotd.emHTML} It includes candidate corrections.`, + rec: { + ...good.sotd.rec, + showAddition: true, + addition: 'It includes candidate corrections.', + }, }, }, recWithCandidateNewChanges: { @@ -75,7 +86,12 @@ export default { }, sotd: { ...good.sotd, - emHTML: `${good.sotd.emHTML} It includes candidate additions, introducing new features since the previous Recommendation.`, + rec: { + ...good.sotd.rec, + showAddition: true, + addition: + 'It includes candidate additions, introducing new features since the previous Recommendation.', + }, }, }, }, From fbb27fdc6c7b8bab45649c7857fee0e27871f3de Mon Sep 17 00:00:00 2001 From: jennyliang Date: Wed, 7 Dec 2022 11:22:10 +0800 Subject: [PATCH 5/8] add document --- lib/rules.json | 2 +- lib/rules/headers/errata.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rules.json b/lib/rules.json index 693c1ea83..6b428c1a0 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:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note: Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports.
", + "docIDOrder": "Document identifier information must be present in this order:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note: Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports. Recommendations with candidate/proposed changes are treated as inline errata, and these documents doesn't require an errata link.
", "docIDThisVersion": ["REC"], "docIDDate": true, "docIDLatestVersion": true, diff --git a/lib/rules/headers/errata.js b/lib/rules/headers/errata.js index 5f8cfbc6e..706aec20e 100644 --- a/lib/rules/headers/errata.js +++ b/lib/rules/headers/errata.js @@ -2,6 +2,8 @@ const self = { name: 'headers.errata', + section: 'front-matter', + rule: 'docIDOrder', }; export const { name } = self; From 784915fc8e02d336e9717aa20cdd8494d6b30e0b Mon Sep 17 00:00:00 2001 From: jennyliang Date: Wed, 7 Dec 2022 11:25:20 +0800 Subject: [PATCH 6/8] add document --- lib/rules.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules.json b/lib/rules.json index 6b428c1a0..01089d0cf 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:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note: Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports. Recommendations with candidate/proposed changes are treated as inline errata, and these documents doesn't require an errata link.
", + "docIDOrder": "Document identifier information must be present in this order:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note: Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports. Recommendations with candidate/proposed changes are treated as inline errata, and these documents don't require an errata link.
", "docIDThisVersion": ["REC"], "docIDDate": true, "docIDLatestVersion": true, From ae0a882df97b7a76e92fc50a8e4620eb5674f1bc Mon Sep 17 00:00:00 2001 From: JiayingL Date: Thu, 8 Dec 2022 15:49:58 +0800 Subject: [PATCH 7/8] Update lib/rules.json Co-authored-by: Denis Ah-Kang --- lib/rules.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules.json b/lib/rules.json index 01089d0cf..1df8abc29 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:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note: Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports. Recommendations with candidate/proposed changes are treated as inline errata, and these documents don't require an errata link.
", + "docIDOrder": "Document identifier information must be present in this order:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note:
    • Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports.
    • Recommendations with candidate/proposed changes are treated as inline errata, and these documents don't require an errata link.
",", "docIDThisVersion": ["REC"], "docIDDate": true, "docIDLatestVersion": true, From aa435ab3c8b79aa77e6b69f8363c95b72b02cb97 Mon Sep 17 00:00:00 2001 From: jennyliang Date: Thu, 8 Dec 2022 16:23:57 +0800 Subject: [PATCH 8/8] fix lint --- lib/rules.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules.json b/lib/rules.json index 1df8abc29..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:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note:
    • Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports.
    • Recommendations with candidate/proposed changes are treated as inline errata, and these documents don't require an errata link.
",", + "docIDOrder": "Document identifier information must be present in this order:
  • 'This version' - URI to that version
  • 'Latest version' - URI to the latest version. See also the (non-normative) Version Management in W3C Technical Reports for information about \"latest version\" URI and version management.
  • 'History' - URI to the history of the specification
  • Editor(s)
  • Feedback - GitHub repository issue links are required in the <dl>after <dt>Feedback:</dt> in the headers (<div class=\"head\">) of the document. Links are expected to be of the form https://github.com/<USER_OR_ORG>/<REPO_NAME>/[issues|labels][/…].)
  • Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on errata page structure in the Manual of Style. Note:
    • Do not put the errata document in TR space as the expectation is that we will not modify document in TR space after publication; see the policy for in-place modification of W3C Technical Reports.
    • Recommendations with candidate/proposed changes are treated as inline errata, and these documents don't require an errata link.
", "docIDThisVersion": ["REC"], "docIDDate": true, "docIDLatestVersion": true,