Skip to content

Commit eb0d84b

Browse files
authored
Allow former editors to be listed and skip the check on their group's participation (#2004)
* provide a way to include former editors that that are no longer participating in the group * only check if the rationale for former editors is not empty * update documentation * add tests
1 parent ed4a07e commit eb0d84b

File tree

5 files changed

+44
-4
lines changed

5 files changed

+44
-4
lines changed

lib/rules.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@
14001400
"docIDDate": "The title page date and the date at the end of the \"This Version\" URI <span class=\"rfc2119\">must</span> match.",
14011401
"docIDLatestVersion": "The syntax of a “latest version” URI <span class=\"rfc2119\">must</span> be <code>https://www.w3.org/TR/shortname/</code>.",
14021402
"docIDHistory": "The syntax of a “history” URI <span class=\"rfc2119\">must</span> be <code>https://www.w3.org/standards/history/shortname/</code>, and consistent with the shortname mentioned in 'Latest Version'. <em>Note</em>: If there's a shortname change it <span class=\"rfc2119\">must</span> be specified using the following data attribute <code>data-previous-shortname='previous-shortname'</code> on the <code>&lt;a&gt;</code> element.",
1403-
"editorSection": "The editors'/authors' names <span class=\"rfc2119\">must</span> be listed, with attribute <code>data-editor-id=\"@@\"</code>. Affiliations and email addresses are <span class=\"rfc2119\">optional</span>; email addresses are <span class=\"rfc2119\">not recommended</span>. The affiliation of Invited Experts <span class=\"rfc2119\">must</span> always be \"W3C Invited Expert\" whether they are affiliated with another organization or not. 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 \"&lt;name&gt;, &lt;affiliation&gt; (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.<br>Note: Editors <span class=\"rfc2119\">must</span> be participating in the group producing the document at the time of its publication.",
1403+
"editorSection": "The editors'/authors' names <span class=\"rfc2119\">must</span> be listed, with attribute <code>data-editor-id=\"@@\"</code>. Affiliations and email addresses are <span class=\"rfc2119\">optional</span>; email addresses are <span class=\"rfc2119\">not recommended</span>. The affiliation of Invited Experts <span class=\"rfc2119\">must</span> always be \"W3C Invited Expert\" whether they are affiliated with another organization or not. 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 \"&lt;name&gt;, &lt;affiliation&gt; (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.<br>Note: Editors <span class=\"rfc2119\">must</span> be participating in the group producing the document at the time of its publication. If an editor left the group before publication, they can still be listed but the rationale <span class=\"rfc2119\">must</span> be provided in a <code>&lt;span class=\"former\"&gt;</code> element next to the name of the editor.",
14041404
"altRepresentations": "Authors <span class=\"rfc2119\">may</span> provide links to alternative (non-normative) representations or packages for the document. For instance: <p> <code> <small>&lt;p&gt;This document is also available in these non-normative formats: &lt;a href=\"@{param1}-shortname-20180101.html\"&gt;single HTML file&lt;/a&gt;, &lt;a href=\"@{param1}-shortname-20180101.tgz\"&gt;gzipped tar file of HTML&lt;/a&gt;.&lt;/p&gt; </small> </code> </p>",
14051405
"implReport": "It <span class=\"rfc2119\">must</span> include either: <ul> <li>a link to an interoperability or implementation report if the Director used such a report as part of the decision to advance the specification, or</li> <li>a statement that the Director's decision did not involve such a report.</li> </ul>",
14061406
"translation": "There <span class=\"rfc2119\">must</span> be a link to a translations page. The <span class=\"rfc2119\">recommended</span> markup is: <p> <code> <small>&lt;p&gt;See also &lt;a href=\"https://www.w3.org/Translations/?technology=shortname\"&gt;&lt;strong&gt;translations&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;</small> </code> </p> <p>See <a href=\"https://www.w3.org/guide/manual-of-style/#Translations\">suggestions on translations</a> in the manual of style.</p>",

lib/rules/headers/editor-participation.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ export const name = self.name;
99

1010
export async function check(sr, done) {
1111
const groups = await sr.getDelivererIDs();
12-
const editors = await sr.getEditorIDs();
12+
const editors = sr.extractHeaders()?.Editor;
13+
const editorsToCheck = [];
14+
if (editors) {
15+
// only check editors elements that don't have a span with class "former"
16+
editors.dd.forEach(dd => {
17+
const former = dd.querySelector('span.former');
18+
if (!former || !sr.norm(former.textContent)) {
19+
editorsToCheck.push(parseInt(dd.dataset.editorId, 10));
20+
}
21+
});
22+
}
1323

1424
const groupUsersPromises = [];
1525
groups.forEach(id => {
@@ -27,7 +37,7 @@ export async function check(sr, done) {
2737

2838
const userIds = (await Promise.all(groupUsersPromises)).flat();
2939

30-
editors.forEach(id => {
40+
editorsToCheck.forEach(id => {
3141
if (!userIds.includes(id)) {
3242
sr.error(self, 'not-participating', { id });
3343
}

test/data/TR/TRBase.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ export const rules = {
4040
data: 'noEditorParticipation',
4141
errors: ['headers.editor-participation.not-participating'],
4242
},
43+
{
44+
data: 'formerEditorParticipation',
45+
errors: [],
46+
},
47+
{
48+
data: 'formerEditorParticipationNoRationale',
49+
errors: ['headers.editor-participation.not-participating'],
50+
},
4351
],
4452
},
4553
style: {

test/doc-views/layout/spec.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<dd class="p-author h-card vcard" data-editor-id="{{dl.editor.id}}">George Herald (WebFoo)
103103
</dd>
104104
{{#if dl.editor2.show}}
105-
<dd class="p-author h-card vcard" data-editor-id="{{dl.editor2.id}}">John Doe (WebFoo)
105+
<dd class="p-author h-card vcard" data-editor-id="{{dl.editor2.id}}">John Doe (WebFoo){{{dl.editor2.former}}}
106106
</dd>
107107
{{/if}}
108108
{{/if}}

test/doc-views/specBase.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,28 @@ export function buildCommonViewData(base) {
626626
},
627627
},
628628
},
629+
formerEditorParticipation: {
630+
...base,
631+
dl: {
632+
...base.dl,
633+
editor2: {
634+
show: true,
635+
id: '3440',
636+
former: ' <span class="former">(until January 2020)</span>',
637+
},
638+
},
639+
},
640+
formerEditorParticipationNoRationale: {
641+
...base,
642+
dl: {
643+
...base.dl,
644+
editor2: {
645+
show: true,
646+
id: '3440',
647+
former: ' <span class="former"></span>',
648+
},
649+
},
650+
},
629651
},
630652
shortname: {
631653
shortnameLowercaseFP: {

0 commit comments

Comments
 (0)