Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into issue-2747-feed-example
Browse files Browse the repository at this point in the history
  • Loading branch information
mcking65 committed Apr 7, 2024
2 parents 3c4fa26 + 9d3fe80 commit 50f7a04
Show file tree
Hide file tree
Showing 129 changed files with 1,556 additions and 1,003 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ on:
- ".github/workflows/examples.yml"
- "content/**/examples/**"
- "scripts/reference-tables.*"
- "scripts/coverage-report.*"
- "content/about/coverage-and-quality/**"
pull_request:
paths:
- "package*.json"
- ".github/workflows/examples.yml"
- "content/**/examples/**"
- "scripts/reference-tables.*"
- "scripts/coverage-report.*"
- "content/about/coverage-and-quality/**"

jobs:
examples:
Expand All @@ -36,3 +40,23 @@ jobs:

- name: Ensure no git changes
run: git diff --exit-code

coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
cache: npm

- name: Install dependencies
run: npm ci

- name: Generate coverage files
run: npm run coverage-report

- name: Ensure no git changes
run: git diff --exit-code
52 changes: 50 additions & 2 deletions .link-checker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
const HTMLParser = require('node-html-parser');

// Checks object for attribute and returns value.
// If not found on first pass, recursively checks
// nested objects and arrays of nested object(s)
// until attribute is found. If not found,
// returns undefined.
const getAttributeValue = (obj, attribute) => {
if (typeof obj !== 'object' || obj === null) return undefined;
if (obj.hasOwnProperty(attribute)) return obj[attribute];

if (Array.isArray(obj)) {
for (const element of obj) {
const attributeValue = getAttributeValue(element, attribute);
if (attributeValue !== undefined) return attributeValue;
}
} else {
for (const key in obj) {
const attributeValue = getAttributeValue(obj[key], attribute);
if (attributeValue !== undefined) return attributeValue;
}
}

return undefined;
};

module.exports = {
filesToIgnore: [
// For example:
Expand All @@ -18,8 +44,30 @@ module.exports = {
{
name: 'github',
pattern: /^https:\/\/github\.com\/.*/,
matchHash: (ids, hash) =>
ids.includes(hash) || ids.includes(`user-content-${hash}`),
matchHash: (ids, hash, { reactPartial }) => {
if (reactPartial) {
// This is where the react-partial keeps data about READMEs and other *.md files
const richText = getAttributeValue(reactPartial, 'richText');
if (richText !== undefined) {
const html = HTMLParser.parse(richText);
const githubIds = html
.querySelectorAll('[id]')
.map((idElement) => idElement.getAttribute('id'));
return githubIds.includes(`user-content-${hash}`);
}
}
return ids.includes(hash) || ids.includes(`user-content-${hash}`);
},
getPartial: (html) => {
return html
.querySelectorAll('react-partial')
.filter(
(partialElement) =>
partialElement.getAttribute('partial-name') === 'repos-overview' // This is the partial that handles the READMEs
)
.flatMap((element) => element.getElementsByTagName('script'))
.map((element) => JSON.parse(element.innerHTML))[0];
},
},
],
ignoreHashesOnExternalPagesMatchingRegex: [
Expand Down
2 changes: 1 addition & 1 deletion common/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dd>
<p>The action taken when an <a>event</a>, typically initiated by users through an input device, causes an element to fulfill a defined role. The role may be defined for that element by the host language, or by author-defined variables, or both. The role for any given element may be a generic action, or may be unique to that element. For example, the activation behavior of an <abbr title="Hypertext Markup Language">HTML</abbr> or <abbr title="Scalable Vector Graphics">SVG</abbr> <code>&lt;a&gt;</code> element shall be to cause the user agent to traverse the link specified in the <code>href</code> attribute, with the further optional parameter of specifying the browsing context for the traversal (such as the current window or tab, a named window, or a new window); the activation behavior of an <abbr title="Hypertext Markup Language">HTML</abbr> <code>&lt;input&gt;</code> element with the <code>type</code> attribute value <code>submit</code> shall be to send the values of the form elements to an author-defined <abbr title="Internationalized Resource Identifiers">IRI</abbr> by the author-defined <abbr title="Hypertext Transfer Protocol">HTTP</abbr> method.</p>
</dd>
<dt><dfn data-lt="assistive technology">Assistive Technologies</dfn></dt>
<dt><dfn data-lt="assistive technologies|assistive technology">Assistive Technologies</dfn></dt>
<dd><p>Hardware and/or software that:</p>
<ul>
<li>relies on services provided by a <a>user agent</a> to retrieve and render Web content </li>
Expand Down
2 changes: 1 addition & 1 deletion content/about/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="stylesheet" href="../shared/css/core.css">
<script src="../shared/js/highlight.pack.js"></script>
<script src="../shared/js/app.js"></script>
<script src="../shared/js/skipto.js"></script>
<script data-skipto="colorTheme:aria; displayOption:popup; containerElement:div" src="../shared/js/skipto.js"></script>
</head>
<body>
<main>
Expand Down
2 changes: 1 addition & 1 deletion content/about/acknowledgements/acknowledgements.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="stylesheet" href="../../shared/css/core.css">
<script src="../../shared/js/highlight.pack.js"></script>
<script src="../../shared/js/app.js"></script>
<script src="../../shared/js/skipto.js"></script>
<script data-skipto="colorTheme:aria; displayOption:popup; containerElement:div" src="../../shared/js/skipto.js"></script>
</head>
<body>
<main>
Expand Down
2 changes: 1 addition & 1 deletion content/about/aria-basics/aria-basics.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="stylesheet" href="../../shared/css/core.css">
<script src="../../shared/js/highlight.pack.js"></script>
<script src="../../shared/js/app.js"></script>
<script src="../../shared/js/skipto.js"></script>
<script data-skipto="colorTheme:aria; displayOption:popup; containerElement:div" src="../../shared/js/skipto.js"></script>
</head>
<body>
<main>
Expand Down
2 changes: 1 addition & 1 deletion content/about/change-history/change-history.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="stylesheet" href="../../shared/css/core.css">
<script src="../../shared/js/highlight.pack.js"></script>
<script src="../../shared/js/app.js"></script>
<script src="../../shared/js/skipto.js"></script>
<script data-skipto="colorTheme:aria; displayOption:popup; containerElement:div" src="../../shared/js/skipto.js"></script>
</head>
<body>
<main>
Expand Down
Loading

0 comments on commit 50f7a04

Please sign in to comment.