diff --git a/lib/l10n-en_GB.js b/lib/l10n-en_GB.js
index 353c8d755..40810ac17 100644
--- a/lib/l10n-en_GB.js
+++ b/lib/l10n-en_GB.js
@@ -100,6 +100,9 @@ export const messages = {
'headers.dl.editor-not-found': 'Cannot find any editors for this document.',
'headers.dl.editor-missing-id':
'Missing `data-editor-id` attribute for editor(s): ${names}.',
+ // headers/editor-participation
+ 'headers.editor-participation.not-participating':
+ 'The user with id ${id} is not participating in the group producing this document.',
// headers/errata
'headers.errata.no-errata':
'"Errata:" not found in the headers (<div class="head">) of the document.',
diff --git a/lib/profiles/base.js b/lib/profiles/base.js
index f7fcbc2a4..253d9dcb6 100644
--- a/lib/profiles/base.js
+++ b/lib/profiles/base.js
@@ -2,6 +2,7 @@
import * as detailsSummary from '../rules/headers/details-summary.js';
import * as divHead from '../rules/headers/div-head.js';
import * as dl from '../rules/headers/dl.js';
+import * as editorParticipation from '../rules/headers/editor-participation.js';
import * as shortname from '../rules/headers/shortname.js';
import * as h1Title from '../rules/headers/h1-title.js';
import * as h2Toc from '../rules/headers/h2-toc.js';
@@ -38,6 +39,7 @@ export const rules = [
h1Title,
detailsSummary,
dl,
+ editorParticipation,
shortname,
w3cState,
h2Toc,
diff --git a/lib/rules.json b/lib/rules.json
index 7b0a96586..15149df9d 100644
--- a/lib/rules.json
+++ b/lib/rules.json
@@ -1584,7 +1584,7 @@
"docIDDate": "The title page date and the date at the end of the \"This Version\" URI must match.",
"docIDLatestVersion": "The syntax of a “latest version” URI must be https://www.w3.org/TR/shortname/
.",
"docIDHistory": "The syntax of a “history” URI must be https://www.w3.org/standards/history/shortname/
, and consistent with the shortname mentioned in 'Latest Version'. Note: If there's a shortname change it must be specified using the following data attribute data-previous-shortname='previous-shortname'
on the <a>
element.",
- "editorSection": "The editors'/authors' names must be listed, with attribute data-editor-id=\"@@\"
. Affiliations and email addresses are optional; email addresses are not recommended. If an editor/author is acknowledged in an earlier version of this document and the individual's affiliation has since changed, list the individual using the notation \"<name>, <affiliation> (until DD Month YYYY)\". If the list of authors is very long (e.g., the entire Working Group), identify the authors in the acknowledgments section, linked from the head of the document. Distinguish any contributors from authors in the acknowledgments section.",
+ "editorSection": "The editors'/authors' names must be listed, with attribute data-editor-id=\"@@\"
. Affiliations and email addresses are optional; email addresses are not recommended. If an editor/author is acknowledged in an earlier version of this document and the individual's affiliation has since changed, list the individual using the notation \"<name>, <affiliation> (until DD Month YYYY)\". If the list of authors is very long (e.g., the entire Working Group), identify the authors in the acknowledgments section, linked from the head of the document. Distinguish any contributors from authors in the acknowledgments section.
Note: Editors must be participating in the group producing the document at the time of its publication.",
"altRepresentations": "Authors may provide links to alternative (non-normative) representations or packages for the document. For instance:
<p>This document is also available in these non-normative formats: <a href=\"@{param1}-shortname-20180101.html\">single HTML file</a>, <a href=\"@{param1}-shortname-20180101.tgz\">gzipped tar file of HTML</a>.</p>
Copyright © @{year} World Wide Web Consortium. W3C® liability, trademark and document use rules apply.
<p class="copyright"><a href="https://www.w3.org/policies/#copyright">Copyright</a> © @{year} <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a href=\"https://www.w3.org/copyright/document-license/\">document use</a> rules apply.</p>
Copyright © @{year} World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.
<p class="copyright"><a href="https://www.w3.org/policies/#copyright">Copyright</a> © @{year} <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/copyright/software-license/">permissive document license</a> rules apply.</p>
Note: Exceptions are listed in this json file.", diff --git a/lib/rules/headers/editor-participation.js b/lib/rules/headers/editor-participation.js new file mode 100644 index 000000000..d3c7c3b73 --- /dev/null +++ b/lib/rules/headers/editor-participation.js @@ -0,0 +1,38 @@ +/* eslint-disable */ +import w3cApi from 'node-w3capi'; + +const self = { + name: 'headers.editor-participation', + section: 'front-matter', + rule: 'editorSection', +}; +export const name = self.name; + +export async function check(sr, done) { + const groups = await sr.getDelivererIDs(); + const editors = await sr.getEditorIDs(); + + const groupUsersPromises = []; + groups.forEach(id => { + groupUsersPromises.push( + new Promise(resolve => + w3cApi + .group(id) + .users() + .fetch({ embed: true }, (err, data) => { + resolve(data.map(user => user.id)); + }) + ) + ); + }); + + const userIds = (await Promise.all(groupUsersPromises)).flat(); + + editors.forEach(id => { + if (!userIds.includes(id)) { + sr.error(self, 'not-participating', { id }); + } + }); + + done(); +} diff --git a/test/data/TR/TRBase.js b/test/data/TR/TRBase.js index 3b9ddd35a..e7f0a53eb 100644 --- a/test/data/TR/TRBase.js +++ b/test/data/TR/TRBase.js @@ -35,6 +35,12 @@ export const rules = { errors: ['headers.copyright.exception-no-html'], }, ], + 'editor-participation': [ + { + data: 'noEditorParticipation', + errors: ['headers.editor-participation.not-participating'], + }, + ], }, style: { ...baseRules.style, diff --git a/test/doc-views/layout/spec.handlebars b/test/doc-views/layout/spec.handlebars index 2eecd90c5..0ac55a6df 100644 --- a/test/doc-views/layout/spec.handlebars +++ b/test/doc-views/layout/spec.handlebars @@ -101,6 +101,10 @@