Skip to content

Commit e25c2de

Browse files
authored
add 202503W1 (#123)
* add 202503W1 * update invalid image & remove install log * review 2 * review 3 * share
1 parent ae02e90 commit e25c2de

12 files changed

+509
-7
lines changed

.githooks/pre-commit

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ set -e
33

44
echo "🔍 pre-commit hook 正在执行:检查链接是否重复..."
55

6+
# ✅ 链接白名单(支持正则匹配)
7+
whitelist=(
8+
'^https://unsplash.com/@equeen$'
9+
)
10+
11+
# 判断链接是否在白名单中
12+
is_whitelisted() {
13+
local link="$1"
14+
for pattern in "${whitelist[@]}"; do
15+
if [[ "$link" =~ $pattern ]]; then
16+
return 0
17+
fi
18+
done
19+
return 1
20+
}
21+
622
# 提取新增链接(支持 Markdown 和裸链接)
723
new_links=$(git diff --cached --unified=0 | grep '^+' | grep -v '^+++' \
824
| perl -nE '
@@ -32,11 +48,15 @@ conflict_found=false
3248
while read -r link; do
3349
match=$(grep -F "$link" "$map_file" || true)
3450
if [[ -n "$match" ]]; then
35-
if [ "$conflict_found" = false ]; then
36-
echo "❌ 检测到重复链接,禁止提交:"
37-
conflict_found=true
51+
if is_whitelisted "$link"; then
52+
echo "$link ← 已存在于 $(echo "$match" | head -n1 | cut -f2),但已在白名单中"
53+
else
54+
if [ "$conflict_found" = false ]; then
55+
echo "❌ 检测到重复链接,禁止提交:"
56+
conflict_found=true
57+
fi
58+
echo " - $link ← 已出现在 $(echo "$match" | head -n1 | cut -f2)"
3859
fi
39-
echo " - $link ← 已出现在 $(echo "$match" | head -n1 | cut -f2)"
4060
fi
4161
done <<< "$new_links"
4262

epub.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if ! type pandoc >/dev/null 2>&1; then
2323
sudo apt install -y curl
2424
tag=3.7
2525
wget https://github.com/jgm/pandoc/releases/download/$tag/pandoc-$tag-1-amd64.deb
26-
sudo dpkg -i pandoc-$tag-1-amd64.deb
26+
sudo dpkg -i pandoc-$tag-1-amd64.deb >/dev/null
2727
fi
2828

2929
if ! type xelatex >/dev/null 2>&1; then

images/2025/02/645.jpg

61 KB
Loading

images/2025/02/645.png

-24.5 KB
Binary file not shown.
11.6 KB
Loading
114 KB
Loading
20.4 KB
Loading
16 KB
Loading
11.6 MB
Loading

post.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
[readme](../README.md) | [previous]({previous_post}) | [next]({next_post})
2626
27-
![](../images/2025/02/1.jpg "Weekly #{current_id}")
27+
![](../images/2025/03/1.jpg "Weekly #{current_id}")
2828
2929
\\**Photo by Lewis Tian on Unsplash*
3030

0 commit comments

Comments
 (0)