浏览代码

Fix spacing after banner.

tags/v0.3
Ben Kurtovic 7 年前
父节点
当前提交
8a339c721b
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. +5
    -2
      earwigbot/tasks/wikiproject_tagger.py

+ 5
- 2
earwigbot/tasks/wikiproject_tagger.py 查看文件

@@ -397,7 +397,7 @@ class WikiProjectTagger(Task):
def add_banner(self, code, banner):
"""Add *banner* to *code*, following template order conventions."""
predecessor = None
for template in code.ifilter_templates():
for template in code.ifilter_templates(recursive=False):
name = template.name.lower().replace("_", " ")
for regex in self.TOP_TEMPS:
if re.match(regex, name):
@@ -412,7 +412,10 @@ class WikiProjectTagger(Task):
self.logger.debug("Inserting banner after template")
if not unicode(predecessor).endswith("\n"):
banner = "\n" + banner
code.insert_after(predecessor, banner + "\n")
post = code.index(predecessor) + 1
if len(code.nodes) > post and not code.get(post).startswith("\n"):
banner += "\n"
code.insert_after(predecessor, banner)
else:
self.logger.debug("Inserting banner at beginning")
code.insert(0, banner + "\n")


正在加载...
取消
保存