浏览代码

Add {{reflist-talk}} to a case if it has <ref>s and no reflist.

pull/15/head
Ben Kurtovic 10 年前
父节点
当前提交
b1d5095406
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. +9
    -0
      tasks/drn_clerkbot.py

+ 9
- 0
tasks/drn_clerkbot.py 查看文件

@@ -315,6 +315,7 @@ class DRNClerkBot(Task):
elif case.status in [self.STATUS_RESOLVED, self.STATUS_CLOSED,
self.STATUS_FAILED]:
self.clerk_closed_case(case, signatures)
self.add_missing_reflist(case)
self.save_case_updates(conn, case, volunteers, signatures, storedsigs)
return notices

@@ -511,6 +512,14 @@ class DRNClerkBot(Task):
self.logger.debug(log.format(case.id, len(notices), template))
return notices

def add_missing_reflist(self, case):
"""Add {{reflist-talk}} to a case if it has <ref>s and no reflist."""
code = mw_parse(case.body)
if code.filter_tags(matches=lambda t: t.name.lower() == "ref"):
if any(s in case.body.lower() for s in ("reflist", "<references")):
return
case.body += "\n===References===\n{{reflist-talk|close=1}}\n"

def save_case_updates(self, conn, case, volunteers, sigs, storedsigs):
"""Save any updates made to a case and signatures in the database."""
if case.status != case.original_status:


正在加载...
取消
保存