Add the Developed in dejima badge
The same badge and the same asset as dejima carries, placed where dejima places it: at the end of the opening block, before the first section heading. test/links.bats only knew about <img src="...png">. The badge is markdown image syntax and an svg, so neither half of that test would have seen it - the assertion would have kept passing while pointing at nothing. It now walks every image the README references in either syntax and either format, and requires at least two so a README that lost one of them fails rather than passing with the other. Checked by breaking the badge path and watching the guard name it.
This commit is contained in:
@@ -33,6 +33,8 @@ you what that bound actually is.
|
||||
a fix, not a release. [SECURITY.md](SECURITY.md) has the detail, and is where to
|
||||
report a vulnerability rather than in a public issue.
|
||||
|
||||
[](https://gitbox.branderson.io/dejima/dejima)
|
||||
|
||||
## What a devbox is, and why it is a different problem
|
||||
|
||||
A devbox is a long-lived VM that runs [dejima](https://gitbox.branderson.io/dejima/dejima)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="122" height="20" role="img"
|
||||
aria-label="Developed in dejima">
|
||||
<title>Developed in dejima</title>
|
||||
<linearGradient id="g" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
<clipPath id="r"><rect width="122" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="79" height="20" fill="#282828"/>
|
||||
<rect x="79" width="43" height="20" fill="#8ec07c"/>
|
||||
<rect width="122" height="20" fill="url(#g)"/>
|
||||
</g>
|
||||
<g font-family="Verdana,DejaVu Sans,Geneva,sans-serif" font-size="11"
|
||||
text-anchor="middle">
|
||||
<text x="39.5" y="15" fill="#010101" fill-opacity=".3">Developed in</text>
|
||||
<text x="39.5" y="14" fill="#ebdbb2">Developed in</text>
|
||||
<text x="100.5" y="15" fill="#010101" fill-opacity=".3">dejima</text>
|
||||
<text x="100.5" y="14" fill="#282828">dejima</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 969 B |
+16
-6
@@ -73,12 +73,22 @@ anchors_of() {
|
||||
fi
|
||||
}
|
||||
|
||||
@test "the README's wordmark resolves to a file this repository ships" {
|
||||
src=$(sed -n 's/.*<img src="\([^"]*\)".*/\1/p' "$REPO/README.md" | head -1)
|
||||
[ -n "$src" ]
|
||||
[ -f "$REPO/$src" ]
|
||||
# Both modes ship, so a mirror on a light-themed host changes one line
|
||||
# rather than needing a file it does not have.
|
||||
@test "every image the README references is a file this repository ships" {
|
||||
# Both syntaxes and both formats. The wordmark is an <img> tag and a png;
|
||||
# the badge is markdown image syntax and an svg. A test written for only
|
||||
# the first pair would not have seen the second at all.
|
||||
found=0
|
||||
while IFS= read -r src; do
|
||||
[ -n "$src" ] || continue
|
||||
case "$src" in http*) continue ;; esac
|
||||
found=$((found + 1))
|
||||
[ -f "$REPO/$src" ] || { echo "README references missing image: $src"; false; }
|
||||
done < <(grep -ohE 'src="[^"]+\.(png|svg)"|\]\([^)]+\.(png|svg)\)' "$REPO/README.md" \
|
||||
| sed 's/^src="//; s/"$//; s/^](//; s/)$//')
|
||||
[ "$found" -ge 2 ] || { echo "expected at least the wordmark and the badge"; false; }
|
||||
|
||||
# Both wordmark modes ship, so a mirror on a light-themed host changes one
|
||||
# line rather than needing a file it does not have.
|
||||
[ -f "$REPO/assets/dejima-wordmark-darkmode.png" ]
|
||||
[ -f "$REPO/assets/dejima-wordmark-lightmode.png" ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user