Przeglądaj źródła

Fix spacing after banner.

tags/v0.3
Ben Kurtovic 7 lat temu
rodzic
commit
8a339c721b
1 zmienionych plików z 5 dodań i 2 usunięć
  1. +5
    -2
      earwigbot/tasks/wikiproject_tagger.py

+ 5
- 2
earwigbot/tasks/wikiproject_tagger.py Wyświetl plik

@@ -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")


Ładowanie…
Anuluj
Zapisz