Skip to content

Commit c5a2774

Browse files
authored
Merge pull request uaxe#11 from zhyjor/master
fix: 修改正则,补充处理裂图问题
2 parents 6ca940a + c544c12 commit c5a2774

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mkdocs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
def _main():
99
dirs = ['AI-大数据','产品-运营','前端-移动','后端-架构','管理-成长','计算机基础','运维-测试']
1010
patterns = [
11-
re.compile(r'!\[\]\((https?://\S+?)\)'),
11+
re.compile(r'!?\[.*?\]\((https?://.*?)\)'),
1212
re.compile(r'!$.*?$$(https?://[^\s$]+)'),
1313
]
1414
proxy_url = "http://127.0.0.1:8091/proxy?url={url}"
1515
proxy_urls = [
1616
"https://static001.geekbang.org/resource/image",
1717
"https://static001.geekbang.org/resource/avatar",
18+
"https://static001-test.geekbang.org/resource/image",
19+
"https://static001.infoq.cn/resource/image",
20+
"https://static001.geekbang.org/con",
1821
]
1922
all = []
2023
docs_dir = Path(__file__).parent.joinpath('dist')
@@ -41,6 +44,7 @@ def _main():
4144
for uri in pattern.findall(line):
4245
for purl in proxy_urls:
4346
if purl in uri:
47+
print(uri)
4448
dst_url = proxy_url.format(url=uri)
4549
line = line.replace(uri, dst_url)
4650
dst_raw += line

0 commit comments

Comments
 (0)