1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-17 19:25:32 -04:00

fix entity encoding in image alt/title attributes

This commit is contained in:
2020-01-10 09:23:57 -05:00
parent 4512dce17a
commit 09e9953c66
7 changed files with 18 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
{ {
"ignoredFiles": [ "ignoredFiles": [
"*.svg", "*.svg",
"**/logo.*" "**/logo.*"
], ],
"aggressiveCompression": "false" "aggressiveCompression": "false"
} }

View File

@@ -7,7 +7,7 @@
"color-hex-length": "long", "color-hex-length": "long",
"function-parentheses-space-inside": null, "function-parentheses-space-inside": null,
"function-url-quotes": null, "function-url-quotes": null,
"indentation": null, "indentation": [ 2, { "severity": "warning" } ],
"max-nesting-depth": 5, "max-nesting-depth": 5,
"number-no-trailing-zeros": null, "number-no-trailing-zeros": null,
"order/properties-alphabetical-order": null, "order/properties-alphabetical-order": null,

View File

@@ -2,8 +2,8 @@
<p class="image"> <p class="image">
<amp-img <amp-img
{{- with .Get "alt" }} alt="{{ . | safeHTMLAttr }}" title="{{ . | safeHTMLAttr }}"{{ else }} {{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ else }}
{{- with .Inner }} alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}"{{ end }}{{ end }} {{- with .Inner }} alt="{{ . | markdownify | plainify | safeHTML }}" title="{{ . | markdownify | plainify | safeHTML }}"{{ end }}{{ end }}
src="{{ $optimized.Permalink }}" src="{{ $optimized.Permalink }}"
width="{{ .Scratch.Get "displayWidth" }}" width="{{ .Scratch.Get "displayWidth" }}"
height="{{ .Scratch.Get "displayHeight" }}" height="{{ .Scratch.Get "displayHeight" }}"

View File

@@ -4,11 +4,11 @@
<figure> <figure>
<picture> <picture>
<img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}" <img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}"
alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}"> alt="{{ . | markdownify | plainify | safeHTML }}" title="{{ . | markdownify | plainify | safeHTML }}">
</picture> </picture>
<figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption> <figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
</figure> </figure>
{{- else -}} {{- else -}}
<p><img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}" <p><img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}"
{{- with .Get "alt" }} alt="{{ . | safeHTMLAttr }}" title="{{ . | safeHTMLAttr }}"{{ end }}></p> {{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}></p>
{{- end }} {{- end }}

View File

@@ -2,7 +2,7 @@
<p style="text-align: center;"> <p style="text-align: center;">
<img src="{{ $optimized.Permalink }}" width="{{ .Scratch.Get "displayWidth" }}" height="{{ .Scratch.Get "displayHeight" }}" <img src="{{ $optimized.Permalink }}" width="{{ .Scratch.Get "displayWidth" }}" height="{{ .Scratch.Get "displayHeight" }}"
{{- with .Get "alt" }} alt="{{ . | safeHTMLAttr }}" title="{{ . | safeHTMLAttr }}"{{ end }} {{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}
{{- with .Inner }} alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}"{{ end }}> {{- with .Inner }} alt="{{ . | markdownify | plainify | safeHTML }}" title="{{ . | markdownify | plainify | safeHTML }}"{{ end }}>
{{ with .Inner }}<br>{{ . | $.Page.RenderString | safeHTML }}{{ end -}} {{ with .Inner }}<br>{{ . | $.Page.RenderString | safeHTML }}{{ end -}}
</p> </p>

View File

@@ -4,7 +4,12 @@ module.exports = {
}, },
plugins: [ plugins: [
require("stylelint")({ require("stylelint")({
configFile: ".stylelintrc.json" configFile: ".stylelintrc",
configOverrides: {
"rules": {
"indentation": null
}
}
}), }),
require("autoprefixer")(), require("autoprefixer")(),
require("postcss-clean")({ require("postcss-clean")({