Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple SCs per issue #14

Open
hidde opened this issue May 26, 2021 · 1 comment · May be fixed by #36
Open

Allow multiple SCs per issue #14

hidde opened this issue May 26, 2021 · 1 comment · May be fixed by #36

Comments

@hidde
Copy link
Owner

hidde commented May 26, 2021

Currently the sc property of an issue accepts one number, for instance:

sc: 1.1.1

It would be nice if you could add an array of SCs:

sc: [1.1.1, 1.1.2]
@EllyLoel
Copy link

EllyLoel commented May 9, 2023

Hey @hidde, I've gotten this working in my fork, though there are also a lot of other changes, so probably won't open a PR from that fork.

The main change was in scTable.js:

function getSCs(principleSearchString) {
  let principle = [];
  for (const issue of allIssues) {
    for (const sc of issue.data.sc) {
      if (sc.startsWith(principleSearchString)) {
        principle.push(sc);
      }
    }
  }
  return Array.from(new Set(principle));
}

const perceivable = getSCs("1.");
const operable = getSCs("2.");
const understandable = getSCs("3.");
const robust = getSCs("4.");

There was also a small change needed in the report layout around the WCAG link:

{% if issue.data.sc and issue.data.sc.length !== 0 %}
  {% for sc in issue.data.sc %}
    ...
  {% endfor %}
{% endif %}

And lastly there was the sanitizeNumber function in .eleventy.js, I just changed it to return that issues highest number SC for use in the sorting comparison when creating the collection:

const sanitizeNumbersAndReturnHighest = (numberWithDotsArray) => {
  let number = null;
  for (const numberWithDots of numberWithDotsArray) {
    const numberString = numberWithDots
      .split(".")
      .map((numb) => (numb = Number(numb) < 10 ? "0" + numb : numb))
      .join("");
    number = number < Number(numberString) ? Number(numberString) : number;
  }
  return number;
};

@Kilian Kilian linked a pull request Dec 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants