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

Fixed mailto: href issue #160 and links not being links #164

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ _site
.jekyll-metadata
.DS_Store
.netlify
vendor
.bundle
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ GEM
jekyll (>= 3.6, < 5.0)

PLATFORMS
universal-darwin-20
x86_64-linux

DEPENDENCIES
wai-gems!

BUNDLED WITH
2.2.15
2.2.27
22 changes: 12 additions & 10 deletions content-images/wai-statements/generator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ts-nocheck
/**
* ACCESSIBILITY STATEMENT GENERATOR
* ---
Expand Down Expand Up @@ -548,22 +549,23 @@

if (dataList && nodeName === 'UL' || nodeName === 'OL') {
item.innerHTML = printData
.map(function wrapInLi(data, index) {

if (index === 0) {
return '\n\t<li>' + data + '</li>\n';
.map(function makeElement(data) {
// check if starts with "http"
const isLink = String(data).startsWith('http');
// make it a link if true
if(isLink) {
return '\n\t<li><a href="' + data + '">' + data + '</a></li>';
}

return '\t<li>' + data + '</li>\n';
// else return as li element
return '\n\t<li>' + data + '</li>\n';
})
.join('');

} else {

switch (nodeName) {
case 'A':
var hrefPrefix = item.getAttribute('href');

// checks item for data-href-prefix, prepends to href if it exists
var hrefPrefix = item.dataset.hrefPrefix || '';

item.setAttribute('href', hrefPrefix + printData);
item.innerText = printData;
break;
Expand Down
2 changes: 1 addition & 1 deletion content/generator_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ <h3>{{ page.preview.feedback.title }}</h3>
</li>
<li data-if="accstmnt_contact_email">
{{ page.basic_info.feedback.email.title }}:
<a class="email u-email" href="mailto:" data-print="accstmnt_contact_email"></a>
<a class="email u-email" href="mailto:" data-href-prefix="mailto:" data-print="accstmnt_contact_email"></a>
</li>
<li data-if="accstmnt_contact_visit">
{{ page.basic_info.feedback.visitor_address.title }}:
Expand Down