Skip to content

Commit

Permalink
Merge pull request #1073 from wet-boew/dependabot/npm_and_yarn/html-v…
Browse files Browse the repository at this point in the history
…alidate-8.9.0

build(deps-dev): Bump html-validate from 8.8.0 to 8.9.0
  • Loading branch information
ahmad-shahid authored Mar 25, 2024
2 parents 6e7b26e + 86370cd commit 97cd814
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 74 deletions.
11 changes: 7 additions & 4 deletions StaticFileCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,22 @@ function createStaticFallbackFile(grunt, definition, language) {
output = defaultContentFilter(grunt, output, definition, language, targetFileName);
if (definition.filterContent) output = definition.filterContent(grunt, output, definition, language, targetFileName);

//---[ Output to file
//NOTE: Generate the files before validating the HTML, for troubleshooting
if (!fs.existsSync(distStaticTargetDirName)) fs.mkdirSync(distStaticTargetDirName); //create target directory if it doesn't exist
fs.writeFileSync(targetFileName, output, { encoding: 'utf8' });

//---[ Validate HTML before we save
const htmlValidate = new HtmlValidate(require('./htmlvalidator.conf.js'));
const htmlValidateFormatReport = formatterFactory('stylish'); //possible formatters: checkstyle, codeframe, json, stylish, text
const htmlValidateFormatReport = formatterFactory('codeframe'); //possible formatters: checkstyle, codeframe, json, stylish, text
const report = htmlValidate.validateStringSync(output);
if ((!report.valid) || (report.warningCount > 0)) {
grunt.log.error(`${targetFileName}: ${report.errorCount} error(s), ${report.warningCount} warning(s) reported:`);
grunt.log.error(htmlValidateFormatReport(report.results));
if (report.errorCount > 0) throw new Error('HTML validator error reported, aborting.');
}

//---[ Output to file
if (!fs.existsSync(distStaticTargetDirName)) fs.mkdirSync(distStaticTargetDirName); //create target directory if it doesn't exist
fs.writeFileSync(targetFileName, output, { encoding: 'utf8' });

}

module.exports = function generateStaticFile(grunt, themeName, definitionFileBasename, getStaticFileDefinition) {
Expand Down
8 changes: 4 additions & 4 deletions TestFileGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function searchFunctionCalls(content) {

function validateBuilderFunctions(content, theme, version) {
const htmlValidate = new HtmlValidate(require('./htmlvalidator.conf.js')); //config path relative
const htmlValidateFormatReport = formatterFactory('stylish'); //possible formatters: checkstyle, codeframe, json, stylish, text
const htmlValidateFormatReport = formatterFactory('codeframe'); //possible formatters: checkstyle, codeframe, json, stylish, text

function validateHTML(functionName, htmlContent) {
const report = htmlValidate.validateStringSync(htmlContent);
Expand Down Expand Up @@ -159,7 +159,7 @@ module.exports = function generateTestFile(inputFilePath, theme, outputFileName,
}
return;
}

console.log(`TestFileGenerator processing ${inputFilePath} -> ${theme}/${outputFileName}`);
let data = fs.readFileSync(inputFilePath, 'utf8');

if (data.match(/wet\.builder\.[\S]*[sS]etup\(/gm) !== null || data.match(setupAttributeRegex) !== null) {
Expand Down Expand Up @@ -197,8 +197,8 @@ module.exports = function generateTestFile(inputFilePath, theme, outputFileName,
data = data.replace('"~' + Object.keys(sections)[i] + '~"', sections[Object.keys(sections)[i]]);
}

fs.writeFileSync(filePath, data, 'utf8');

//---[ Before writing data to disk, validate the output of the various 'wet.builder.*' functions.
validateBuilderFunctions(data, theme, version);

fs.writeFileSync(filePath, data, 'utf8');
}
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"grunt-contrib-uglify": "^5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^24.3.0",
"html-validate": "^8.8.0",
"html-validate": "^8.15.0",
"https-proxy-agent": "^7.0.4",
"isbinaryfile": "^5.0.2"
}
Expand Down
4 changes: 2 additions & 2 deletions src/gcintranet/appFooter.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<%_ } -%>
<footer role="contentinfo" id="wb-info">
<%_ if (pr.footerSections != null) { -%>
<nav role="navigation" class="container wb-navcurr">
<h2 class="wb-inv"><^- msg('Related links') ^></h2>
<nav role="navigation" class="container wb-navcurr" aria-labelledby="cdts-relatedLinks">
<h2 class="wb-inv" id="cdts-relatedLinks"><^- msg('Related links') ^></h2>
<div class="row">
<%_ for (var sectionIndex=0; sectionIndex<pr.footerSections.length; sectionIndex++) {
const footerSection=pr.footerSections[sectionIndex];-%>
Expand Down
16 changes: 8 additions & 8 deletions src/gcintranet/appTop.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if (pr.subTheme === 'eccc') {
<%_ } -%>
</ul>
</nav>
<header role="banner">
<header role="banner" aria-label="<^- msg('Intranet Banner') ^>">
<div id="wb-bnr">
<div id="app-brand">
<div class="container">
Expand Down Expand Up @@ -92,8 +92,8 @@ if (pr.subTheme === 'eccc') {
</div>
</div>
<section id="gctools" class="mfp-hide modal-dialog modal-content overlay-def">
<header class="modal-header">
<h2 class="modal-title"><^- msg('<span class="bold-gc">GC</span>Tools') ^></h2>
<header class="modal-header" aria-labelledby="cdts-gctoolsPopupHeader">
<h2 class="modal-title" id="cdts-gctoolsPopupHeader"><^- msg('<span class="bold-gc">GC</span>Tools') ^></h2>
</header>
<div class="modal-body">
<ul class="list-unstyled lst-spcd">
Expand Down Expand Up @@ -251,9 +251,9 @@ if (pr.subTheme === 'eccc') {
</div>
</div>
<%_ if (pr.menuLinks != null) { -%>
<nav role="navigation" id="wb-smapp" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement">
<nav role="navigation" id="wb-smapp" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement" aria-labelledby="cdts-mainMenu">
<div class="pnl-strt container nvbar">
<h2 class="wb-inv"><^- msg('Main navigation menu') ^></h2>
<h2 class="wb-inv" id="cdts-mainMenu"><^- msg('Main navigation menu') ^></h2>
<div class="row">
<ul class="list-inline menu" role="menubar">
<%_ for (var menuLinkIndex=0; menuLinkIndex<pr.menuLinks.length; menuLinkIndex++) {
Expand Down Expand Up @@ -289,13 +289,13 @@ if (pr.subTheme === 'eccc') {
</div>
</nav>
<%_ } else if (pr.menuPath != null) { -%>
<nav role="navigation" id="wb-smapp" data-ajax-replace="<%= pr.menuPath %>" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement"></nav>
<nav role="navigation" id="wb-smapp" data-ajax-replace="<%= pr.menuPath %>" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement" aria-label="<^- msg('Application menu') ^>"></nav>
<%_ } else { -%>
<div id="wb-sm" data-ajax-replace="<%- wet.builder.environment(pr.cdnEnv) %>cdts/ajax/<^- msg('appmenu-eng.html') ^>" data-trgt="mb-pnl" class="wb-menu hidden-sm hidden-xs"></div>
<%_ } -%>
<%_ if (pr.breadcrumbs != null) { -%>
<nav role="navigation" id="wb-bc" property="breadcrumb">
<h2><^- msg('You are here:') ^></h2>
<nav role="navigation" id="wb-bc" property="breadcrumb" aria-labelledby="cdts-breadcrumbPosition">
<h2 id="cdts-breadcrumbPosition"><^- msg('You are here:') ^></h2>
<div class="container">
<ol class="breadcrumb">
<%_ for (var breadcrumbIndex=0; breadcrumbIndex<pr.breadcrumbs.length; breadcrumbIndex++) {
Expand Down
4 changes: 2 additions & 2 deletions src/gcintranet/refFooter.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<%_ if (pr.exitSecureSite != null) { -%>
<%_ if (pr.exitSecureSite.exitScript == true) { -%>
<%# This is a placeholder link to trigger the WET exitscript intialization in the event the no external link is present on the page -%>
<a href="#" id="cdts-exitscript-placeholder-link" aria-hidden="true" class="wb-exitscript cdts-hidden">Exit Link</a>
<a href="#" id="cdts-exitscript-placeholder-link" hidden class="wb-exitscript cdts-hidden">Exit Link</a>
<%# When is "setup" mode, we avoid inserting an inline script element to support clients who wnat to use Content-Security-Policy -%>
<%_ if (wet.utilities.isCDTSSetupMode()) {
wet.utilities.addSetupCompletitionListener(function() {
Expand All @@ -38,7 +38,7 @@
<%_ } -%>
<%_ } else if (pr.exitScript == true) { -%>
<%# This is only for backwards compatibility where a user implements exitscript using parameters instead of an object. -%>
<a href="#" id="cdts-exitscript-placeholder-link" style="display: none" aria-hidden="true" class="wb-exitscript">Exit Link</a>
<a href="#" id="cdts-exitscript-placeholder-link" style="display: none" hidden class="wb-exitscript">Exit Link</a>
<script data-id="exitScript">wet.utilities.cdtsApplyExitScriptToLinks("<%=pr.displayModal != null? pr.displayModal: 'undefined'%>", "<%-pr.exitURL != null? pr.exitURL: 'undefined'%>", "<%=pr.exitDomains != null? pr.exitDomains: 'undefined'%>", "<%=pr.exitMsg != null? pr.exitMsg: 'undefined'%>", "<%=pr.yesMsg != null? pr.yesMsg: 'undefined'%>", "<%=pr.cancelMsg != null? pr.cancelMsg: 'undefined'%>", "<%=pr.msgBoxHeader != null? pr.msgBoxHeader: 'undefined'%>", "<%=pr.targetWarning != null? pr.targetWarning: 'undefined'%>", "<%=pr.displayModalForNewWindow != null? pr.displayModalForNewWindow: 'undefined'%>");</script>
<%_ } -%>
<%_ if (pr.webAnalytics != null && pr.webAnalytics != false && !wet.utilities.isCDTSSetupMode()) { -%>
Expand Down
22 changes: 11 additions & 11 deletions src/gcintranet/top.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if (pr.subTheme === 'eccc') {
<%_ } -%>
</ul>
</nav>
<header role="banner">
<header role="banner" aria-label="<^- msg('Intranet Banner') ^>">
<div id="wb-bnr">
<div id="app-brand">
<div class="container">
Expand Down Expand Up @@ -90,8 +90,8 @@ if (pr.subTheme === 'eccc') {
</div>
</div>
<section id="gctools" class="mfp-hide modal-dialog modal-content overlay-def">
<header class="modal-header">
<h2 class="modal-title"><^- msg('<span class="bold-gc">GC</span>Tools') ^></h2>
<header class="modal-header" aria-labelledby="cdts-gcToolsModal">
<h2 class="modal-title" id="cdts-gcToolsModal"><^- msg('<span class="bold-gc">GC</span>Tools') ^></h2>
</header>
<div class="modal-body">
<ul class="list-unstyled lst-spcd">
Expand Down Expand Up @@ -210,9 +210,9 @@ if (pr.subTheme === 'eccc') {
</div>
<%_ if (pr.siteMenu != false) { -%>
<%_ if (pr.subTheme == 'esdc' || pr.subTheme == 'labour') { -%>
<nav role="navigation" id="wb-sm" data-wb-ajax='{"url": "<%- (pr.menuPath != null)? pr.menuPath: '/app/cls/WET/global/<^- msg('esdcmenu-eng.html') ^>' %>", "type": "replace", "nocache": true }' data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement">
<nav role="navigation" id="wb-sm" data-wb-ajax='{"url": "<%- (pr.menuPath != null)? pr.menuPath: '/app/cls/WET/global/<^- msg('esdcmenu-eng.html') ^>' %>", "type": "replace", "nocache": true }' data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement" aria-labelledby="cdts-topicsMenu">
<div class="container nvbar">
<h2><^- msg('Topics menu') ^></h2>
<h2 id="cdts-topicsMenu"><^- msg('Topics menu') ^></h2>
<div class="row">
<ul class="list-inline menu">
<%_ if (pr.hidePlaceholderMenu == true) { -%>
Expand All @@ -230,9 +230,9 @@ if (pr.subTheme === 'eccc') {
</nav>
<%_ } else if (pr.subTheme == 'eccc') { -%>
<%# Todo: Change with eccc Menu -%>
<nav role="navigation" id="wb-sm" data-wb-ajax='{"url": "<%- (pr.menuPath != null)? pr.menuPath: wet.builder.environment(pr.cdnEnv) + 'cdts/ajax/<^- msg('sitemenu-eng.html') ^>' %>", "type": "replace", "nocache": true }' data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement">
<nav role="navigation" id="wb-sm" data-wb-ajax='{"url": "<%- (pr.menuPath != null)? pr.menuPath: wet.builder.environment(pr.cdnEnv) + 'cdts/ajax/<^- msg('sitemenu-eng.html') ^>' %>", "type": "replace", "nocache": true }' data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement" aria-labelledby="cdts-topicsMenu">
<div class="container nvbar">
<h2><^- msg('Topics menu') ^></h2>
<h2 id="cdts-topicsMenu"><^- msg('Topics menu') ^></h2>
<div class="row">
<ul class="list-inline menu">
<%_ if (pr.hidePlaceholderMenu == true) { -%>
Expand All @@ -251,9 +251,9 @@ if (pr.subTheme === 'eccc') {
</div>
</nav>
<%_ } else { -%>
<nav role="navigation" id="wb-sm" data-ajax-replace="<%- wet.builder.environment(pr.cdnEnv) %>cdts/ajax/<^- msg('sitemenu-eng.html') ^>" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement">
<nav role="navigation" id="wb-sm" data-ajax-replace="<%- wet.builder.environment(pr.cdnEnv) %>cdts/ajax/<^- msg('sitemenu-eng.html') ^>" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement" aria-labelledby="cdts-topicsMenu">
<div class="container nvbar">
<h2><^- msg('Topics menu') ^></h2>
<h2 id="cdts-topicsMenu"><^- msg('Topics menu') ^></h2>
<div class="row">
<ul class="list-inline menu">
<li><a href="<^- msg('https://intranet.canada.ca/psc-fsc/index-eng.asp') ^>"><^- msg('News') ^></a></li>
Expand All @@ -267,8 +267,8 @@ if (pr.subTheme === 'eccc') {
<%_ } -%>
<%_ } -%>
<%_ if (pr.breadcrumbs != false) { -%>
<nav role="navigation" id="wb-bc" property="breadcrumb">
<h2><^- msg('You are here:') ^></h2>
<nav role="navigation" id="wb-bc" property="breadcrumb" aria-labelledby="cdts-breadcrumbPosition">
<h2 id="cdts-breadcrumbPosition"><^- msg('You are here:') ^></h2>
<div class="container">
<ol class="breadcrumb">
<%_ if (pr.breadcrumbs != null) { -%>
Expand Down
8 changes: 8 additions & 0 deletions src/gcintranet/wet-messages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@
"source": "Skip to section menu",
"target": null
},
"5b82747d146bcb033f073f1c4465847546261d56": {
"source": "Intranet Banner",
"target": null
},
"99a3e18460e703b6b52b26b4155c66c3e3ba24bc": {
"source": "GC",
"target": null
Expand Down Expand Up @@ -309,6 +313,10 @@
"source": "GCTools",
"target": null
},
"4fd0ed7e7a474d24b9db775b6bf8fa2727beaa1d": {
"source": "Application menu",
"target": null
},
"616127b124840170bb853584ca52fbb610817859": {
"source": "appmenu-eng.html",
"target": null
Expand Down
28 changes: 28 additions & 0 deletions src/gcintranet/wet-messages.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,33 @@
"0ca3e700f4ad7f0a2cb04efdc52361be64516d04": {
"source": "<span class=\"bold-gc\">GC</span>Xchange",
"target": "<span class=\"bold-gc\">GC</span>Échange"
},
"d8cde1c29b61c58e4ef757161e59991a22d66763": {
"source": "Activities and initiatives",
"target": "Activités et initiatives"
},
"5a4356b4e754ea9c3775e8c156860a6e18ab6b54": {
"source": "GC Tools",
"target": "Outils GC"
},
"26c01e70a337f208f56dae1c3bc18f60c4bff453": {
"source": "Footer",
"target": "Pied de page"
},
"4fd0ed7e7a474d24b9db775b6bf8fa2727beaa1d": {
"source": "Application menu",
"target": "Menu de l'application"
},
"baab55ac4da1ff0e442b592dda1b4a9b16e8e1f4": {
"source": "GCintranet header",
"target": "En-tête GCintranet"
},
"e6c08df891206ab48e50e3539af1d87363b593e3": {
"source": "GCTools section",
"target": "Section Outils GC"
},
"5b82747d146bcb033f073f1c4465847546261d56": {
"source": "Intranet Banner",
"target": "Bannière intranet"
}
}
4 changes: 2 additions & 2 deletions src/gcweb/appFooter.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<%_ if (pr.footerSections != null && Array.isArray(pr.footerSections)) pr.footerSections = { links: pr.footerSections } -%>
<div class="gc-contextual">
<div class="container">
<nav>
<h2 class="wb-inv"><^- msg('Related links') ^></h2>
<nav aria-labelledby="cdts-appFooterLinks">
<h2 class="wb-inv" id="cdts-appFooterLinks"><^- msg('Related links') ^></h2>
<%_ if (pr.footerSections != null && pr.footerSections.title != null) { -%> <h3><%= pr.footerSections.title %></h3> <%_ } -%>
<ul class="list-col-xs-1 list-col-sm-2 list-col-md-3">
<%_ if (pr.contactLink != null && pr.contactLink.length > 0) { -%>
Expand Down
Loading

0 comments on commit 97cd814

Please sign in to comment.