Skip to content

Commit

Permalink
The standard type link has a trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
deniak committed Nov 5, 2024
1 parent 6956562 commit 473e141
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/l10n-en_GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const messages = {
'headers.w3c-state.no-w3c-state-link':
'Cannot find the link of the W3C profile in id="w3c-state" element pointing to "https://www.w3.org/standards/types#xx".',
'headers.w3c-state.wrong-w3c-state-link':
'The link for text "${text}" should pointing to W3C profile "${expectedLink}", but the link found in the document is "${linkFound}".',
'The link for text "${text}" should pointing to W3C profile "https://www.w3.org/standards/types/#${hash}", but the link found in the document is "${linkFound}".',
// headers/h2-toc
'headers.h2-toc.not-found':
'There is no table of contents inside a navigation element (<code>&lt;nav id="toc"&gt; &hellip; &lt;h2&gt;Table of Contents&lt;/h2&gt; &hellip; &lt;/nav&gt;</code>).',
Expand Down
4 changes: 2 additions & 2 deletions lib/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@
],
"dateState": [
"Recommendation",
" <p>If this is a modified Recommendation that was modified in place or is a new edition, the document <span class=\"rfc2119\">must</span> include both the original publication date and the modification date. For example:</p> <pre xml:space=\"preserve\">&lt;p id=\"w3c-state\"&gt;<a href=\"https://www.w3.org/standards/types#REC\">W3C Recommendation</a> 7 April 2004, edited in place 19 August2004&lt;/p&gt;</pre>"
" <p>If this is a modified Recommendation that was modified in place or is a new edition, the document <span class=\"rfc2119\">must</span> include both the original publication date and the modification date. For example:</p> <pre xml:space=\"preserve\">&lt;p id=\"w3c-state\"&gt;<a href=\"https://www.w3.org/standards/types/#REC\">W3C Recommendation</a> 7 April 2004, edited in place 19 August2004&lt;/p&gt;</pre>"
],
"docIDFormat": true,
"docIDOrder": "Document identifier information <span class=\"rfc2119\">must</span> be present in this order: <ul><li>'This version' - URI to that version</li><li>'Latest version' - URI to the latest version. See also the (non-normative) <cite> <a href=\"https://www.w3.org/2005/05/tr-versions\">Version Management in W3C Technical Reports</a> </cite> for information about \"latest version\" URI and version management.</li><li class=\"historyuri\">'History' - URI to the history of the specification</li><li>Editor(s)</li><li>Feedback - GitHub repository issue links are required in the &lt;dl&gt;after &lt;dt&gt;Feedback:&lt;/dt&gt; in the headers (&lt;div class=\"head\"&gt;) of the document. Links are expected to be of the form <code>https://github.com/&lt;USER_OR_ORG&gt;/&lt;REPO_NAME&gt;/[issues|labels][/&hellip;]</code>.)</li><li>Errata - URI to an errata document for any errors or issues reported since publication. See also suggestions on <a href=\"https://www.w3.org/2001/06/manual/#Errata\">errata page structure</a> in the Manual of Style. <strong>Note:</strong><ul><li> 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 <a href=\"https://www.w3.org/2003/01/republishing/\">in-place modification of W3C Technical Reports</a>.</li><li>Recommendations with candidate/proposed changes are treated as inline errata, and these documents don't require an errata link.</li></ul></li></ul>",
Expand Down Expand Up @@ -1577,7 +1577,7 @@
"logo": "The document <span class=\"rfc2119\">must</span> include a link to the W3C logo identified below. The URI used to identify the logo <span class=\"rfc2119\">must</span> be absolute. <div class=\"boilerplate\"> <a href=\"https://www.w3.org/\"> <img alt=\"W3C\" src=\"https://www.w3.org/StyleSheets/TR/2021/logos/W3C\" height=\"48\" width=\"72\"> </a> </div> <div class=\"source\"> <span style=\"font-style: italic\">Include this source code</span>:<br><code>&lt;a href=\"https://www.w3.org/\"&gt;&lt;img height=\"48\" width=\"72\" alt=\"W3C\" src=\"https://www.w3.org/StyleSheets/TR/2021/logos/W3C\"/&gt;&lt;/a&gt;</code></div>",
"title": "The document's title <span class=\"rfc2119\">must</span> be in the <code>title</code> element and in an <code>h1</code> element. When calculating text equation, special transformations made to <code>h1</code> are: <ol><li>Replace ':&lt;br&gt;' with ': '</li><li>Replace '&lt;br&gt;' with ' - '</li><li>Extract text from h1, and ignore HTML tags.</li></ol>",
"versionNumber": "Technical report version information, i.e., version and edition numbers. <ol> @{param1}<li>See the (non-normative) <cite> <a href=\"https://www.w3.org/2005/05/tr-versions\">Version Management in W3C Technical Reports</a> </cite> for more information.</li> </ol>",
"dateState": "The document's status and date <span class=\"rfc2119\">must</span> be in a <code>&lt;p id=\"w3c-state\"&gt;</code> element as follows (see also <a href=\"#datesFormat\">date syntax</a>): <pre xml:space=\"preserve\">&lt;p id=\"w3c-state\"&gt;<a href=\"https://www.w3.org/standards/types#@@Profile\">W3C @{param1}</a> DD Month YYYY&lt;/p&gt;</pre>@{param2}",
"dateState": "The document's status and date <span class=\"rfc2119\">must</span> be in a <code>&lt;p id=\"w3c-state\"&gt;</code> element as follows (see also <a href=\"#datesFormat\">date syntax</a>): <pre xml:space=\"preserve\">&lt;p id=\"w3c-state\"&gt;<a href=\"https://www.w3.org/standards/types/#@@Profile\">W3C @{param1}</a> DD Month YYYY&lt;/p&gt;</pre>@{param2}",
"docIDFormat": "Document identifier information <span class=\"rfc2119\">must</span> be presented in a <code>dl</code> list, where each <code>dt</code> element marks up an identifier role (\"This Version\", \"Latest Version\", \"History\", etc.) and each <code>dd</code> element includes a link whose link text is the identifier. That <code>dl</code> <span class=\"rfc2119\">must</span> itself be placed in a <code>details</code> element. <p><span style=\"font-style: italic\">Include this source code:</span><br/><code>&lt;details open&gt;&lt;summary&gt;More details about this document&lt;/summary&gt;&lt;dl&gt;...&lt;/dl&gt;&lt;/details&gt;</code></p>",
"docIDOrder": "Document identifier information <span class=\"rfc2119\">must</span> be present in this order: <ul><li>'This version' - URI to that version</li><li>'Latest version' - URI to the latest version. See also the (non-normative) <cite> <a href=\"https://www.w3.org/2005/05/tr-versions\">Version Management in W3C Technical Reports</a> </cite> for information about \"latest version\" URI and version management.</li><li class=\"historyuri\">'History' - URI to the history of the specification</li><li>Editor(s)</li><li>Feedback - GitHub repository issue links are required in the &lt;dl&gt;after &lt;dt&gt;Feedback:&lt;/dt&gt; in the headers (&lt;div class=\"head\"&gt;) of the document. Links are expected to be of the form <code>https://github.com/&lt;USER_OR_ORG&gt;/&lt;REPO_NAME&gt;/[issues|labels][/&hellip;]</code>.)</li></ul>",
"docIDThisVersion": "The syntax of a “this version” URI <span class=\"rfc2119\">must</span> be <code>https://www.w3.org/TR/YYYY/@{param1}-shortname-YYYYMMDD/</code>. If the document introduces a new shortname, it <span class=\"rfc2119\">must</span> use lowercase letters.",
Expand Down
8 changes: 5 additions & 3 deletions lib/rules/headers/w3c-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ export function check(sr, done) {
if (sr.config.longStatus === 'First Public Working Draft') {
hash = 'FPWD';
}
const expectedLink = `https://www.w3.org/standards/types#${hash}`;
const expectedLink = new RegExp(
`https://www.w3.org/standards/types/?#${hash}`
);
if (!standardLink) {
sr.error(self, 'no-w3c-state-link');
} else if (standardLink.href !== expectedLink) {
} else if (!expectedLink.test(standardLink.href)) {
sr.error(self, 'wrong-w3c-state-link', {
expectedLink,
hash,
linkFound: standardLink.href,
text: sr.norm(standardLink.textContent),
});
Expand Down

0 comments on commit 473e141

Please sign in to comment.