From 09e9953c66ae678032e3baaf2394cd09ca33bcf6 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Fri, 10 Jan 2020 09:23:57 -0500 Subject: [PATCH] fix entity encoding in image alt/title attributes --- .imgbotconfig | 10 +++++----- .markdownlint.json => .markdownlintrc | 0 .stylelintrc.json => .stylelintrc | 2 +- layouts/shortcodes/image.amp.html | 4 ++-- layouts/shortcodes/image.html | 4 ++-- layouts/shortcodes/image.rss.xml | 4 ++-- postcss.config.js | 7 ++++++- 7 files changed, 18 insertions(+), 13 deletions(-) rename .markdownlint.json => .markdownlintrc (100%) rename .stylelintrc.json => .stylelintrc (94%) diff --git a/.imgbotconfig b/.imgbotconfig index 60c6350c..a8b3f489 100644 --- a/.imgbotconfig +++ b/.imgbotconfig @@ -1,7 +1,7 @@ { - "ignoredFiles": [ - "*.svg", - "**/logo.*" - ], - "aggressiveCompression": "false" + "ignoredFiles": [ + "*.svg", + "**/logo.*" + ], + "aggressiveCompression": "false" } diff --git a/.markdownlint.json b/.markdownlintrc similarity index 100% rename from .markdownlint.json rename to .markdownlintrc diff --git a/.stylelintrc.json b/.stylelintrc similarity index 94% rename from .stylelintrc.json rename to .stylelintrc index 1de7142f..1f041daa 100644 --- a/.stylelintrc.json +++ b/.stylelintrc @@ -7,7 +7,7 @@ "color-hex-length": "long", "function-parentheses-space-inside": null, "function-url-quotes": null, - "indentation": null, + "indentation": [ 2, { "severity": "warning" } ], "max-nesting-depth": 5, "number-no-trailing-zeros": null, "order/properties-alphabetical-order": null, diff --git a/layouts/shortcodes/image.amp.html b/layouts/shortcodes/image.amp.html index dcdec820..f27e9492 100644 --- a/layouts/shortcodes/image.amp.html +++ b/layouts/shortcodes/image.amp.html @@ -2,8 +2,8 @@

{{ . | markdownify | plainify | safeHTMLAttr }} + alt="{{ . | markdownify | plainify | safeHTML }}" title="{{ . | markdownify | plainify | safeHTML }}">

{{ . | $.Page.RenderString | safeHTML }}
{{- else -}}

{{ . | safeHTMLAttr }}

+ {{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}>

{{- end }} diff --git a/layouts/shortcodes/image.rss.xml b/layouts/shortcodes/image.rss.xml index 0b450914..a81fc69d 100644 --- a/layouts/shortcodes/image.rss.xml +++ b/layouts/shortcodes/image.rss.xml @@ -2,7 +2,7 @@

{{ . | safeHTMLAttr }} + {{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }} + {{- with .Inner }} alt="{{ . | markdownify | plainify | safeHTML }}" title="{{ . | markdownify | plainify | safeHTML }}"{{ end }}> {{ with .Inner }}
{{ . | $.Page.RenderString | safeHTML }}{{ end -}}

diff --git a/postcss.config.js b/postcss.config.js index 285119d0..5dde75bf 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -4,7 +4,12 @@ module.exports = { }, plugins: [ require("stylelint")({ - configFile: ".stylelintrc.json" + configFile: ".stylelintrc", + configOverrides: { + "rules": { + "indentation": null + } + } }), require("autoprefixer")(), require("postcss-clean")({