提交 d97dd05e 编写于 作者: M Mars Liu

reflection for author search

上级 6b2febf6
......@@ -9,17 +9,12 @@ if __name__ == '__main__':
ignore_keywords=True,
enable_notebook=False,
authors={
"Python小白进阶": "youcans",
"youcans": "youcans",
"AI浩": "hhhhhhhhhhwwwwwwwwww",
"hhhhhhhhhhwwwwwwwwww": "hhhhhhhhhhwwwwwwwwww",
"吴佳WuJia": "yvettewu",
"yvettewu": "yvettewu",
"幻灰龙": "huanhuilong",
"feilong": "huanhuilong",
"huanhuilong": "huanhuilong",
"xiaozhi_5638": "xiaozhi_5638",
"请叫我卷福": "xiaozhi_5638"
"youcans":["Python小白进阶"],
"hhhhhhhhhhwwwwwwwwww":["AI浩"],
"yvettewu": ["吴佳WuJia"],
"huanhuilong":["幻灰龙",
"feilong"],
"xiaozhi_5638": ["请叫我卷福"],
}
)
walker.walk()
......
......@@ -16,6 +16,12 @@ formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
def search_author(author_dict, username):
for key in author_dict:
names = author_dict[key]
if username in names:
return key
return username
def user_name(md_file, author_dict):
ret = subprocess.Popen([
......@@ -27,8 +33,7 @@ def user_name(md_file, author_dict):
if line.startswith('Author'):
author_lines.append(line.split(' ')[1])
author_nick_name = author_lines[-1]
return author_dict.get(author_nick_name, "")
return search_author(author_dict, author_nick_name)
def load_json(p):
with open(p, 'r') as f:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册