Add alt text as title text... for the single image on my entire site
This commit is contained in:
parent
d47156ebba
commit
ebbd2bef19
6 changed files with 19 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
||||||
<title>askiiart.net blog</title>
|
<title>askiiart.net blog</title>
|
||||||
<description>The feed for askiiart.net but just the blog, I guess</description>
|
<description>The feed for askiiart.net but just the blog, I guess</description>
|
||||||
<link>https://askiiart.net/blog/</link>
|
<link>https://askiiart.net/blog/</link>
|
||||||
<lastBuildDate>Thu, 07 Mar 2024 05:17:23 +0000</lastBuildDate>
|
<lastBuildDate>Wed, 13 Mar 2024 01:44:19 +0000</lastBuildDate>
|
||||||
<item>
|
<item>
|
||||||
<title>300</title>
|
<title>300</title>
|
||||||
<link>https://askiiart.net/til/300.html</link>
|
<link>https://askiiart.net/til/300.html</link>
|
||||||
|
|
|
@ -441,7 +441,7 @@
|
||||||
<figure>
|
<figure>
|
||||||
<img
|
<img
|
||||||
src="/assets/blog/marlin-boot-animations/marlin-linux-mint.png"
|
src="/assets/blog/marlin-boot-animations/marlin-linux-mint.png"
|
||||||
alt="Linux Mint logo, as it would appear on a 128x64 display" />
|
title="Linux Mint logo, as it would appear on a 128x64 display" alt="Linux Mint logo, as it would appear on a 128x64 display" />
|
||||||
<figcaption aria-hidden="true">Linux Mint logo, as it would
|
<figcaption aria-hidden="true">Linux Mint logo, as it would
|
||||||
appear on a 128x64 display</figcaption>
|
appear on a 128x64 display</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
2
feed.xml
2
feed.xml
|
@ -5,7 +5,7 @@
|
||||||
<title>askiiart.net</title>
|
<title>askiiart.net</title>
|
||||||
<description>The feed for askiiart.net, I guess</description>
|
<description>The feed for askiiart.net, I guess</description>
|
||||||
<link>https://askiiart.net</link>
|
<link>https://askiiart.net</link>
|
||||||
<lastBuildDate>Thu, 07 Mar 2024 05:17:23 +0000</lastBuildDate>
|
<lastBuildDate>Wed, 13 Mar 2024 01:44:19 +0000</lastBuildDate>
|
||||||
<item>
|
<item>
|
||||||
<title>300</title>
|
<title>300</title>
|
||||||
<link>https://askiiart.net/blog/300.html</link>
|
<link>https://askiiart.net/blog/300.html</link>
|
||||||
|
|
|
@ -7,4 +7,5 @@ find . -name "*.md" | while read -r item; do
|
||||||
echo "Currently processing ${item}"
|
echo "Currently processing ${item}"
|
||||||
pandoc -f markdown-smart --data-dir . --template ${dir}/template.html -t html -o ${item}.html ${item}.md --metadata title="$(grep -m 1 -oP '(?<=^# ).*' ${item}.md | cat)"
|
pandoc -f markdown-smart --data-dir . --template ${dir}/template.html -t html -o ${item}.html ${item}.md --metadata title="$(grep -m 1 -oP '(?<=^# ).*' ${item}.md | cat)"
|
||||||
sed -i s/sourceCode\ /language-/g ${item}.html
|
sed -i s/sourceCode\ /language-/g ${item}.html
|
||||||
|
python3 $dir/regex-chicanery.py ${item}.html
|
||||||
done
|
done
|
||||||
|
|
14
regex-chicanery.py
Normal file
14
regex-chicanery.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# add title attribute to img tags
|
||||||
|
filename = sys.argv[1]
|
||||||
|
with open(filename, 'r+') as f:
|
||||||
|
contents = ''.join(f.readlines())
|
||||||
|
regexp = re.compile('alt="(.*?)"')
|
||||||
|
for match in regexp.finditer(contents):
|
||||||
|
contents = contents.replace(match.group(0), f'title="{match.group(1)}" {match.group(0)}')
|
||||||
|
|
||||||
|
with open(filename, 'wt') as f:
|
||||||
|
f.write(contents)
|
|
@ -5,7 +5,7 @@
|
||||||
<title>askiiart.net TIL</title>
|
<title>askiiart.net TIL</title>
|
||||||
<description>The feed for askiiart.net but just TIL, I guess</description>
|
<description>The feed for askiiart.net but just TIL, I guess</description>
|
||||||
<link>https://askiiart.net/til/</link>
|
<link>https://askiiart.net/til/</link>
|
||||||
<lastBuildDate>Thu, 07 Mar 2024 05:17:23 +0000</lastBuildDate>
|
<lastBuildDate>Wed, 13 Mar 2024 01:44:19 +0000</lastBuildDate>
|
||||||
<item>
|
<item>
|
||||||
<title>Akkoma in Docker</title>
|
<title>Akkoma in Docker</title>
|
||||||
<link>https://askiiart.net/til/akkoma-in-docker.html</link>
|
<link>https://askiiart.net/til/akkoma-in-docker.html</link>
|
||||||
|
|
Loading…
Reference in a new issue