Skip to content

Commit

Permalink
Prepare copyright rule for W3C Inc for 2023 (#1685)
Browse files Browse the repository at this point in the history
* change copyright rule for W3C Inc for 2023

* add test for copyright change

* fix test

* Update README.md

Co-authored-by: Denis Ah-Kang <deniak@users.noreply.github.com>

* Update lib/rules.json

Co-authored-by: Denis Ah-Kang <deniak@users.noreply.github.com>

* Update lib/rules/headers/copyright.js

Co-authored-by: Denis Ah-Kang <deniak@users.noreply.github.com>

Co-authored-by: Denis Ah-Kang <deniak@users.noreply.github.com>
  • Loading branch information
jennyliang220 and deniak authored Dec 16, 2022
1 parent 1f6473c commit d26900e
Show file tree
Hide file tree
Showing 11 changed files with 418 additions and 109 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ $ W3C_API_KEY="xxx" npm run live 3001

## 3. Testing

#### 1. Simple test

Testing is done using mocha. Simply run:

```bash
Expand All @@ -97,13 +99,49 @@ from the root and you will be running the test suite. Mocha can be installed wit
$ npm install -g mocha
```

#### 2. SKIP_NETWORK

Some of the tests can on occasion take a long time, or fail outright because a remote service is
unavailable. To work around this, you can set SKIP_NETWORK:

```bash
$ SKIP_NETWORK=1 W3C_API_KEY="<YOUR W3C API KEY>" mocha
```

#### 3. Run testserver

The testcase document can run independently

```bash
$ npm run testserver
```

#### 4. Run certain test

Add process env before `npm run test` and `describe.only()` to run single test.

```
// test/rules.js
describe.only('Making sure Specberus is not broken...', () => {
```

The following example only run test for the http://localhost:8001/doc-views/TR/Recommendation/WD?rule=copyright&type=noCopyright document.

```bash
$ RULE=copyright TYPE=noCopyright PROFILE=WD npm run test
```

The following example run tests to all the documents, but limit to `copyright` rule and using the `noCopyright` data.

```bash
$ RULE=copyright TYPE=noCopyright npm run test
```

- http://localhost:8001/doc-views/TR/Recommendation/WD?rule=copyright&type=noCopyright
- http://localhost:8001/doc-views/TR/Registry/CRYD/?rule=copyright&type=noCopyright
- http://localhost:8001/doc-views/TR/Note/DNOTE-Echidna?rule=copyright&type=noCopyright
- ... and all profiles

## 4. JS API

The interface you get when you `require("specberus")` is that from `lib/validator`. It returns a
Expand Down
2 changes: 2 additions & 0 deletions lib/l10n-en_GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export const messages = {
'Pubrules fails to find the document license in the group charter. Please ask the team contact for help.',
'headers.memsub-copyright.not-found':
'Missing link to the W3C document notice (https://www.w3.org/Consortium/Legal/copyright-documents).',
'headers.copyright.legacy-copyright-found':
'Legacy copyright found. Please use the latest format instead.',
// headers/github-repo
'headers.github-repo.no-feedback':
'Cannot find the "Feedback" &lt;dt&gt; in the headers of the document.',
Expand Down
4 changes: 3 additions & 1 deletion lib/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ export function message(profileCode, rule, key, extra) {
`[${profile}][${rule.section}][${rule.rule}].text`
);
}
// TODO: to change after 2023
result.message = result.message.replace(
// eslint-disable-next-line prefer-regex-literals
new RegExp(`@{year}`, 'g'),
new Date().getFullYear()
'2023'
// new Date().getFullYear()
);
} else
selector = encodeURIComponent(
Expand Down
2 changes: 1 addition & 1 deletion lib/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@
"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>. 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.",
"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>",
"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>",
"copyright": "The copyright <span class=\"rfc2119\">must</span> use the following markup (fill in with the appropriate year, years, or year range). The type of license the document is using can be found in the group's charter.<ol><li>For documents using W3C Document License:<div class=\"boilerplate\"> <blockquote class=\"copyright\"> <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\">Copyright</a> © @{year} <a href=\"https://www.w3.org/\"> <abbr title=\"World Wide Web Consortium\">W3C</abbr> </a> <sup>®</sup> (<a href=\"https://www.csail.mit.edu/\"> <abbr title=\"Massachusetts Institute of Technology\">MIT</abbr> </a>, <a href=\"https://www.ercim.eu/\"> <abbr title=\"European Research Consortium for Informatics and Mathematics\">ERCIM</abbr> </a>, <a href=\"https://www.keio.ac.jp/\">Keio</a>, <a href=\"https://ev.buaa.edu.cn/\">Beihang</a>). W3C <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\">liability</a>, <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\">trademark</a> and <a href=\"https://www.w3.org/Consortium/Legal/copyright-documents\">document use</a> rules apply.</blockquote> </div> <div class=\"source\"> <span style=\"font-style: italic\">Include this source code</span>:<br><code>&lt;p class=\"copyright\"&gt;&lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\"&gt;Copyright&lt;/a&gt; © @{year} &lt;a href=\"https://www.w3.org/\"&gt;&lt;abbr title=\"World Wide Web Consortium\"&gt;W3C&lt;/abbr&gt;&lt;/a&gt;&lt;sup&gt;®&lt;/sup&gt; (&lt;a href=\"https://www.csail.mit.edu/\"&gt;&lt;abbr title=\"Massachusetts Institute of Technology\"&gt;MIT&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.ercim.eu/\"&gt;&lt;abbr title=\"European Research Consortium for Informatics and Mathematics\"&gt;ERCIM&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.keio.ac.jp/\"&gt;Keio&lt;/a&gt;, &lt;a href=\"https://ev.buaa.edu.cn/\"&gt;Beihang&lt;/a&gt;). W3C &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\"&gt;liability&lt;/a&gt;, &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\"&gt;trademark&lt;/a&gt; and &lt;a href=\"https://www.w3.org/Consortium/Legal/copyright-documents\"&gt;document use&lt;/a&gt; rules apply.&lt;/p&gt;</code></div></li><li>For documents using W3C Software and Document License:<div class=\"boilerplate\"> <blockquote class=\"copyright\"> <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\">Copyright</a> © @{year} <a href=\"https://www.w3.org/\"> <abbr title=\"World Wide Web Consortium\">W3C</abbr> </a> <sup>®</sup> (<a href=\"https://www.csail.mit.edu/\"> <abbr title=\"Massachusetts Institute of Technology\">MIT</abbr> </a>, <a href=\"https://www.ercim.eu/\"> <abbr title=\"European Research Consortium for Informatics and Mathematics\">ERCIM</abbr> </a>, <a href=\"https://www.keio.ac.jp/\">Keio</a>, <a href=\"https://ev.buaa.edu.cn/\">Beihang</a>). W3C <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\">liability</a>, <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\">trademark</a> and <a href=\"https://www.w3.org/Consortium/Legal/copyright-software\">permissive document license</a> rules apply.</blockquote> </div> <div class=\"source\"> <span style=\"font-style: italic\">Include this source code</span>:<br><code>&lt;p class=\"copyright\"&gt;&lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\"&gt;Copyright&lt;/a&gt; © @{year} &lt;a href=\"https://www.w3.org/\"&gt;&lt;abbr title=\"World Wide Web Consortium\"&gt;W3C&lt;/abbr&gt;&lt;/a&gt;&lt;sup&gt;®&lt;/sup&gt; (&lt;a href=\"https://www.csail.mit.edu/\"&gt;&lt;abbr title=\"Massachusetts Institute of Technology\"&gt;MIT&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.ercim.eu/\"&gt;&lt;abbr title=\"European Research Consortium for Informatics and Mathematics\"&gt;ERCIM&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.keio.ac.jp/\"&gt;Keio&lt;/a&gt;, &lt;a href=\"https://ev.buaa.edu.cn/\"&gt;Beihang&lt;/a&gt;). W3C &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\"&gt;liability&lt;/a&gt;, &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\"&gt;trademark&lt;/a&gt; and &lt;a href=\"https://www.w3.org/Consortium/Legal/copyright-software\"&gt;permissive document license&lt;/a&gt; rules apply.&lt;/p&gt;</code></div></li></ol>",
"copyright": "The copyright depends on the publication date:<ul><li>starting from 01 February 2023, the copyright <span class=\"rfc2119\">must</span> follow the following markup (fill in with the appropriate year, years, or year range). The type of license the document is using can be found in the group's charter. <ol> <li>For documents using W3C Document License: <blockquote class=\"copyright\"><a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\">Copyright</a> © @{year} <a href=\"https://www.w3.org/\">World Wide Web Consortium, Inc.</a>. <abbr title=\"World Wide Web Consortium\">W3C</abbr><sup>®</sup> <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\">liability</a>, <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\">trademark</a> and <a href=\"https://www.w3.org/Consortium/Legal/copyright-documents\">document use</a> rules apply.</blockquote><div class=\"source\"> <span style=\"font-style: italic\">Include this source code</span>:<br><code>&lt;p class=&quot;copyright&quot;&gt;&lt;a href=&quot;https://www.w3.org/Consortium/Legal/ipr-notice#Copyright&quot;&gt;Copyright&lt;/a&gt; © @{year} &lt;a href=&quot;https://www.w3.org/&quot;&gt;World Wide Web Consortium, Inc.&lt;/a&gt;. &lt;abbr title=&quot;World Wide Web Consortium&quot;&gt;W3C&lt;/abbr&gt;&lt;sup&gt;®&lt;/sup&gt; &lt;a href=&quot;https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer&quot;&gt;liability&lt;/a&gt;, &lt;a href=&quot;https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks&quot;&gt;trademark&lt;/a&gt; and &lt;a href=\"https://www.w3.org/Consortium/Legal/copyright-documents\"&gt;document use&lt;/a&gt; rules apply.&lt;/p&gt;</code> </div></li><li>For documents using W3C Software and Document License: <blockquote class=\"copyright\"><a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\">Copyright</a> © @{year} <a href=\"https://www.w3.org/\">World Wide Web Consortium, Inc.</a>. <abbr title=\"World Wide Web Consortium\">W3C</abbr><sup>®</sup> <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\">liability</a>, <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\">trademark</a> and <a href=\"https://www.w3.org/Consortium/Legal/copyright-software\">permissive document license</a> rules apply.</blockquote><div class=\"source\"> <span style=\"font-style: italic\">Include this source code</span>:<br><code>&lt;p class=&quot;copyright&quot;&gt;&lt;a href=&quot;https://www.w3.org/Consortium/Legal/ipr-notice#Copyright&quot;&gt;Copyright&lt;/a&gt; © @{year} &lt;a href=&quot;https://www.w3.org/&quot;&gt;World Wide Web Consortium, Inc.&lt;/a&gt;. &lt;abbr title=&quot;World Wide Web Consortium&quot;&gt;W3C&lt;/abbr&gt;&lt;sup&gt;®&lt;/sup&gt; &lt;a href=&quot;https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer&quot;&gt;liability&lt;/a&gt;, &lt;a href=&quot;https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks&quot;&gt;trademark&lt;/a&gt; and &lt;a href=&quot;https://www.w3.org/Consortium/Legal/copyright-software&quot;&gt;permissive document license&lt;/a&gt; rules apply.&lt;/p&gt;</code> </div></li></ol></li><li>during the transition period (between 01 January 2023 and 01 February 2023), both the new and legacy copyrights are allowed.</li><li>until 31 December 2022, use the legacy copyright following the markup below (fill in with the appropriate year, years, or year range). The type of license the document is using can be found in the group's charter. <ol> <li>For documents using W3C Document License: <div class=\"boilerplate\"> <blockquote class=\"copyright\"><a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\">Copyright</a> © 2022<a href=\"https://www.w3.org/\"> <abbr title=\"World Wide Web Consortium\">W3C</abbr> </a> <sup>®</sup> (<a href=\"https://www.csail.mit.edu/\"> <abbr title=\"Massachusetts Institute of Technology\">MIT</abbr> </a>, <a href=\"https://www.ercim.eu/\"> <abbr title=\"European Research Consortium for Informatics and Mathematics\">ERCIM</abbr> </a>, <a href=\"https://www.keio.ac.jp/\">Keio</a>, <a href=\"https://ev.buaa.edu.cn/\">Beihang</a>). W3C <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\">liability</a>, <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\">trademark</a> and <a href=\"https://www.w3.org/Consortium/Legal/copyright-documents\">document use</a> rules apply. </blockquote> </div><div class=\"source\"> <span style=\"font-style: italic\">Include this source code</span>:<br><code>&lt;p class=\"copyright\"&gt;&lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\"&gt;Copyright&lt;/a&gt; © 2022&lt;a href=\"https://www.w3.org/\"&gt;&lt;abbr title=\"World Wide Web Consortium\"&gt;W3C&lt;/abbr&gt;&lt;/a&gt;&lt;sup&gt;®&lt;/sup&gt; (&lt;a href=\"https://www.csail.mit.edu/\"&gt;&lt;abbr title=\"Massachusetts Institute of Technology\"&gt;MIT&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.ercim.eu/\"&gt;&lt;abbr title=\"European Research Consortium for Informatics and Mathematics\"&gt;ERCIM&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.keio.ac.jp/\"&gt;Keio&lt;/a&gt;, &lt;a href=\"https://ev.buaa.edu.cn/\"&gt;Beihang&lt;/a&gt;). W3C &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\"&gt;liability&lt;/a&gt;, &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\"&gt;trademark&lt;/a&gt; and &lt;a href=\"https://www.w3.org/Consortium/Legal/copyright-documents\"&gt;document use&lt;/a&gt; rules apply.&lt;/p&gt;</code> </div></li><li>For documents using W3C Software and Document License: <div class=\"boilerplate\"> <blockquote class=\"copyright\"><a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\">Copyright</a> © 2022<a href=\"https://www.w3.org/\"> <abbr title=\"World Wide Web Consortium\">W3C</abbr> </a> <sup>®</sup> (<a href=\"https://www.csail.mit.edu/\"> <abbr title=\"Massachusetts Institute of Technology\">MIT</abbr> </a>, <a href=\"https://www.ercim.eu/\"> <abbr title=\"European Research Consortium for Informatics and Mathematics\">ERCIM</abbr> </a>, <a href=\"https://www.keio.ac.jp/\">Keio</a>, <a href=\"https://ev.buaa.edu.cn/\">Beihang</a>). W3C <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\">liability</a>, <a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\">trademark</a> and <a href=\"https://www.w3.org/Consortium/Legal/copyright-software\">permissive document license</a> rules apply. </blockquote> </div><div class=\"source\"> <span style=\"font-style: italic\">Include this source code</span>:<br><code>&lt;p class=\"copyright\"&gt;&lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Copyright\"&gt;Copyright&lt;/a&gt; © 2022&lt;a href=\"https://www.w3.org/\"&gt;&lt;abbr title=\"World Wide Web Consortium\"&gt;W3C&lt;/abbr&gt;&lt;/a&gt;&lt;sup&gt;®&lt;/sup&gt; (&lt;a href=\"https://www.csail.mit.edu/\"&gt;&lt;abbr title=\"Massachusetts Institute of Technology\"&gt;MIT&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.ercim.eu/\"&gt;&lt;abbr title=\"European Research Consortium for Informatics and Mathematics\"&gt;ERCIM&lt;/abbr&gt;&lt;/a&gt;, &lt;a href=\"https://www.keio.ac.jp/\"&gt;Keio&lt;/a&gt;, &lt;a href=\"https://ev.buaa.edu.cn/\"&gt;Beihang&lt;/a&gt;). W3C &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer\"&gt;liability&lt;/a&gt;, &lt;a href=\"https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks\"&gt;trademark&lt;/a&gt; and &lt;a href=\"https://www.w3.org/Consortium/Legal/copyright-software\"&gt;permissive document license&lt;/a&gt; rules apply.&lt;/p&gt;</code> </div></li></ol> </li></ul>",
"hrAfterCopyright": "A horizontal rule (<code>hr</code>) <span class=\"rfc2119\">must</span> follow the copyright."
}
},
Expand Down
Loading

0 comments on commit d26900e

Please sign in to comment.