Commits (11)
save-exact = true
......@@ -2,15 +2,21 @@
/package.json
/package-lock.json
# generated by renovatebot
/.renovaterc.json
# compiled files
/build
/coverage
/public/**/*.html
/public/assets
/public/schemas
/docs/**/__tests__/*.spec.ts
# nunjucks templates
/docs/**/*.html
/docs/dgeni/inline-validate/templates
/docs/dgeni/schema/templates
# will contain errors
/test-files/**/*.html
# local test files
/sites
# html-validate changelog
# [2.19.0](https://gitlab.com/html-validate/html-validate/compare/v2.18.1...v2.19.0) (2020-03-24)
### Bug Fixes
- **meta:** deep merge during inheritance ([85c377d](https://gitlab.com/html-validate/html-validate/commit/85c377d185492407d72fde39bd14d6a80935a56a)), closes [#72](https://gitlab.com/html-validate/html-validate/issues/72)
### Features
- **meta:** implicit inheritance when overriding existing element ([8833a0f](https://gitlab.com/html-validate/html-validate/commit/8833a0fcc9873eee4938619cdae78afa45e48ce5))
## [2.18.1](https://gitlab.com/html-validate/html-validate/compare/v2.18.0...v2.18.1) (2020-03-22)
### Bug Fixes
......
const sass = require("sass");
const serveStatic = require("serve-static");
module.exports = function(grunt) {
module.exports = function (grunt) {
require("load-grunt-tasks")(grunt);
grunt.registerTask("default", ["build"]);
grunt.registerTask("dgeni", "Generate documentation", function() {
grunt.registerTask("dgeni", "Generate documentation", function () {
const Dgeni = require("dgeni");
const done = this.async();
const dgeni = new Dgeni([require("./docs/dgeni")]);
......@@ -97,7 +97,7 @@ module.exports = function(grunt) {
hostname: "localhost",
keepalive: true,
base: "public",
middleware: function() {
middleware: function () {
return [serveStatic("public")];
},
},
......
......@@ -2,7 +2,7 @@ const Package = require("dgeni").Package;
const pkg = new Package("dgeni-bootstrap", []);
pkg.config(function(inlineTagProcessor, getInjectables) {
pkg.config(function (inlineTagProcessor, getInjectables) {
const inlineTagsDefs = getInjectables(require("./inline-tag-defs"));
inlineTagProcessor.inlineTagDefinitions = inlineTagProcessor.inlineTagDefinitions.concat(
inlineTagsDefs
......
......@@ -2,7 +2,7 @@ module.exports = function alertDangerInlineTagDef() {
return {
name: "alert-danger",
description: "Add bootstrap danger alert",
handler: function(doc, tagName, tagDescription) {
handler: function (doc, tagName, tagDescription) {
return `<div class="alert alert-danger"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> ${tagDescription}</div>`;
},
};
......
......@@ -2,7 +2,7 @@ module.exports = function alertInfoInlineTagDef() {
return {
name: "alert-info",
description: "Add bootstrap info alert",
handler: function(doc, tagName, tagDescription) {
handler: function (doc, tagName, tagDescription) {
return `<div class="alert alert-info"><i class="fa fa-info-circle" aria-hidden="true"></i> ${tagDescription}</div>`;
},
};
......
......@@ -2,7 +2,7 @@ module.exports = function alertSucccessInlineTagDef() {
return {
name: "alert-success",
description: "Add bootstrap success alert",
handler: function(doc, tagName, tagDescription) {
handler: function (doc, tagName, tagDescription) {
return `<div class="alert alert-success"><i class="fa fa-check" aria-hidden="true"></i> ${tagDescription}</div>`;
},
};
......
......@@ -2,7 +2,7 @@ module.exports = function alertWarningInlineTagDef() {
return {
name: "alert-warning",
description: "Add bootstrap warning alert",
handler: function(doc, tagName, tagDescription) {
handler: function (doc, tagName, tagDescription) {
return `<div class="alert alert-warning"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> ${tagDescription}</div>`;
},
};
......
......@@ -9,7 +9,7 @@ function prepare(src) {
module.exports = function changelogFileReader() {
return {
name: "changelogFileReader",
getDocs: function(fileInfo) {
getDocs: function (fileInfo) {
return [
{
docType: "changelog",
......
......@@ -3,14 +3,11 @@ const crypto = require("crypto");
module.exports = {
name: "assetHash",
process: asset => {
process: (asset) => {
const filename = `public/${asset}`;
if (fs.existsSync(filename)) {
const data = fs.readFileSync(filename);
const hash = crypto
.createHash("md5")
.update(data)
.digest("hex");
const hash = crypto.createHash("md5").update(data).digest("hex");
return `${asset}?${hash}`;
} else {
console.log(
......
......@@ -9,11 +9,11 @@ module.exports = new Package("highlight", [require("dgeni-packages/nunjucks")])
.factory(require("./filters/highlight"))
/* enable syntax highlighting */
.config(function(renderMarkdown, highlight) {
.config(function (renderMarkdown, highlight) {
renderMarkdown.highlight = highlight;
})
/* add highlight filter */
.config(function(templateEngine, highlightFilter) {
.config(function (templateEngine, highlightFilter) {
templateEngine.filters.push(highlightFilter);
});
......@@ -8,7 +8,7 @@ module.exports = function renderMarkdown(trimIndentation) {
// remove the leading whitespace from the code block before it gets to the
// markdown code render function
renderer.code = function(code, string, language) {
renderer.code = function (code, string, language) {
const trimmedCode = trimIndentation(code);
let renderedCode = marked.Renderer.prototype.code.call(
this,
......@@ -38,7 +38,7 @@ module.exports = function renderMarkdown(trimIndentation) {
};
// Add § link to all headings
renderer.heading = function(text, level, raw) {
renderer.heading = function (text, level, raw) {
const slug = raw
.toLowerCase()
.replace(/\(.*?\)/g, "")
......@@ -51,7 +51,7 @@ module.exports = function renderMarkdown(trimIndentation) {
return `<h${level} id="${id}">${text}${anchor}</h${level}>`;
};
const render = function(content) {
const render = function (content) {
return marked(content, {
highlight: render.highlight,
renderer,
......
......@@ -13,13 +13,13 @@ module.exports = new Package("html-validate-docs", [
.processor(require("./processors/rules"))
.config(function(renderDocsProcessor) {
.config(function (renderDocsProcessor) {
renderDocsProcessor.extraData.pkg = require("../../package.json");
renderDocsProcessor.extraData.tracking = process.env.GA_TRACKING_ID;
})
/* configure markdown syntax highlighting */
.config(function(highlight) {
.config(function (highlight) {
highlight.configure({
languages: ["js", "json", "typescript", "html", "shell"],
});
......@@ -27,15 +27,15 @@ module.exports = new Package("html-validate-docs", [
.factory(require("./changelog"))
.config(function(readFilesProcessor, changelogFileReader) {
.config(function (readFilesProcessor, changelogFileReader) {
readFilesProcessor.fileReaders.push(changelogFileReader);
})
.config(function(getLinkInfo) {
.config(function (getLinkInfo) {
getLinkInfo.relativeLinks = true;
})
.config(function(log, readFilesProcessor, writeFilesProcessor, copySchema) {
.config(function (log, readFilesProcessor, writeFilesProcessor, copySchema) {
log.level = "info";
readFilesProcessor.basePath = path.resolve(packagePath, "../..");
......@@ -59,14 +59,14 @@ module.exports = new Package("html-validate-docs", [
writeFilesProcessor.outputFolder = "public";
})
.config(function(parseTagsProcessor, getInjectables) {
.config(function (parseTagsProcessor, getInjectables) {
parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions.concat(
getInjectables(require("./tag-defs"))
);
})
/* add custom nunjuck filters */
.config(function(templateEngine) {
.config(function (templateEngine) {
templateEngine.filters = templateEngine.filters.concat(
require("./filters")
);
......@@ -74,16 +74,16 @@ module.exports = new Package("html-validate-docs", [
/* add the local template folder first in the search path so it overrides
* dgeni-packages bundled templates */
.config(function(templateFinder) {
.config(function (templateFinder) {
templateFinder.templateFolders.unshift(
path.resolve(packagePath, "templates")
);
})
.config(function(computePathsProcessor, computeIdsProcessor) {
.config(function (computePathsProcessor, computeIdsProcessor) {
computeIdsProcessor.idTemplates.push({
docTypes: ["content", "frontpage", "rule", "rules", "changelog", "error"],
getId: function(doc) {
getId: function (doc) {
const dir = path.dirname(doc.fileInfo.relativePath);
if (dir === ".") {
/* documents not in a subdirectory gets basename as id */
......@@ -98,7 +98,7 @@ module.exports = new Package("html-validate-docs", [
return dir;
}
},
getAliases: function(doc) {
getAliases: function (doc) {
const alias = [doc.id];
if (doc.name) {
alias.push(doc.name);
......@@ -110,7 +110,7 @@ module.exports = new Package("html-validate-docs", [
computePathsProcessor.pathTemplates.push({
docTypes: ["content", "frontpage", "rule", "rules"],
getPath: function(doc) {
getPath: function (doc) {
const dirname = path.dirname(doc.fileInfo.relativePath);
const p = path.join(dirname, doc.fileInfo.baseName);
return `${p}.html`;
......@@ -120,7 +120,7 @@ module.exports = new Package("html-validate-docs", [
computePathsProcessor.pathTemplates.push({
docTypes: ["changelog"],
getPath: function(doc) {
getPath: function (doc) {
const dirname = path.dirname(doc.fileInfo.relativePath);
return path.join(dirname, doc.fileInfo.baseName, "index.html");
},
......@@ -129,7 +129,7 @@ module.exports = new Package("html-validate-docs", [
computePathsProcessor.pathTemplates.push({
docTypes: ["error"],
getPath: function(doc) {
getPath: function (doc) {
/* should go directly under output directory, no subdirectory */
return doc.fileInfo.baseName;
},
......@@ -137,10 +137,10 @@ module.exports = new Package("html-validate-docs", [
});
})
.config(function(checkAnchorLinksProcessor) {
.config(function (checkAnchorLinksProcessor) {
checkAnchorLinksProcessor.ignoredLinks.push(/^\/$/);
checkAnchorLinksProcessor.ignoredLinks.push(/^\/changelog$/);
checkAnchorLinksProcessor.checkDoc = doc => {
checkAnchorLinksProcessor.checkDoc = (doc) => {
return (
doc.path &&
doc.outputPath &&
......
......@@ -15,30 +15,30 @@ module.exports = new Package("inline-validate", [])
.factory(require("./services/validateMap"))
.factory(require("./inline-tag-defs/inline-validation"))
.config(function(templateFinder) {
.config(function (templateFinder) {
templateFinder.templateFolders.push(path.resolve(packagePath, "templates"));
})
.config(function(inlineTagProcessor, inlineValidationInlineTagDef) {
.config(function (inlineTagProcessor, inlineValidationInlineTagDef) {
inlineTagProcessor.inlineTagDefinitions.push(inlineValidationInlineTagDef);
})
.config(function(computePathsProcessor, computeIdsProcessor) {
.config(function (computePathsProcessor, computeIdsProcessor) {
computePathsProcessor.pathTemplates.push({
docTypes: ["validate-config", "validate-markup"],
getPath: function() {},
getPath: function () {},
outputPathTemplate: "inline-validations/${id}",
});
computePathsProcessor.pathTemplates.push({
docTypes: ["validate-spec"],
getPath: function() {},
getPath: function () {},
outputPathTemplate:
"../${fileInfo.path}/__tests__/${fileInfo.file}.spec.ts",
});
computePathsProcessor.pathTemplates.push({
docTypes: ["inlineValidation"],
pathTemplate: "inline-validations/${validate.id}",
getOutputPath: function() {},
getOutputPath: function () {},
});
computeIdsProcessor.idTemplates.push({
docTypes: [
......@@ -47,7 +47,7 @@ module.exports = new Package("inline-validate", [])
"validate-spec",
"inlineValidation",
],
getAliases: function(doc) {
getAliases: function (doc) {
return [doc.id];
},
});
......
......@@ -10,7 +10,7 @@ module.exports = function generateValidationsSpecProcessor(log, validateMap) {
function $process(docs) {
const specs = {};
validateMap.forEach(validation => {
validateMap.forEach((validation) => {
const key = validation.doc.fileInfo.relativePath;
if (!specs[key]) {
......
......@@ -6,7 +6,7 @@ module.exports = function generateInlineValidationsProcessor(log, validateMap) {
};
function $process(docs) {
validateMap.forEach(validation => {
validateMap.forEach((validation) => {
const inlineValidationDoc = createInlineValidateDoc(validation);
docs.push(inlineValidationDoc);
validation.inlineValidationDoc = inlineValidationDoc;
......
......@@ -16,7 +16,7 @@ module.exports = function parseValidatesProcessor(
};
function $process(docs) {
docs.forEach(doc => {
docs.forEach((doc) => {
try {
if (!doc.content) {
return;
......@@ -73,7 +73,7 @@ module.exports = function parseValidatesProcessor(
function extractAttributes(attributeText) {
const attributes = {};
attributeText.replace(ATTRIBUTE_REGEX, function(match, prop, val1, val2) {
attributeText.replace(ATTRIBUTE_REGEX, function (match, prop, val1, val2) {
attributes[prop] = val1 || val2;
});
return attributes;
......
......@@ -13,7 +13,7 @@ module.exports = function generateValidationResultsProcessor(log, validateMap) {
function $process() {
const oldLevel = chalk.level;
chalk.level = 0;
validateMap.forEach(validation => {
validateMap.forEach((validation) => {
htmlvalidate = new HtmlValidate(validation.config);
validation.report = htmlvalidate.validateString(validation.markup);
validation.codeframe = codeframe(validation.report.results);
......
......@@ -27,7 +27,7 @@ module.exports = function rulesProcessor(renderDocsProcessor) {
const ruleDocs = docs.filter(isRuleDocument);
/* compule rule source paths */
ruleDocs.forEach(doc => {
ruleDocs.forEach((doc) => {
const docPath = doc.fileInfo.projectRelativePath;
doc.ruleSourcePath = docPath
.replace("docs", "src")
......@@ -35,7 +35,7 @@ module.exports = function rulesProcessor(renderDocsProcessor) {
});
/* generate title */
ruleDocs.forEach(doc => {
ruleDocs.forEach((doc) => {
if (!doc.title) {
doc.title = `${doc.summary} (${doc.name})`;
}
......@@ -43,7 +43,7 @@ module.exports = function rulesProcessor(renderDocsProcessor) {
/* find all available rules */
const rules = ruleDocs
.map(doc => ({
.map((doc) => ({
name: doc.name,
url: doc.outputPath,
category: doc.category,
......@@ -55,7 +55,7 @@ module.exports = function rulesProcessor(renderDocsProcessor) {
/* group rules into categories */
const categories = {};
rules.forEach(rule => {
rules.forEach((rule) => {
const category = rule.category || "other";
if (!(category in categories)) {
categories[category] = [];
......