Permalink
Browse files

per BRFA

  • Loading branch information...
HazardSJ committed Dec 28, 2015
1 parent 66f3648 commit 9b3fae847079ee6bf9cd467dac577cc8d84bf4bc
Showing with 10 additions and 17 deletions.
  1. +10 −17 enwiki/start_date.py
@@ -42,22 +42,10 @@ def _get_date(self, template, always_use_monthname=True):
else:
return "%(month)s %(day)s, %(year)s" % date
elif template.has_param(1) and template.has_param(2):
if always_use_monthname:
return "%(month)s %(year)s" % {
"month": site.expand_text("{{MONTHNAME|%s}}" % template.get(2).strip()),
"year": template.get(1).strip()
}
else:
month = template.get(2).value.strip()
try:
if int(month) < 10 and not month.startswith("0"):
month = "0" + month
return "%s %s" % (
template.get(1).value.strip(),
month
)
except ValueError:
return None
return "%(month)s %(year)s" % {
"month": site.expand_text("{{MONTHNAME|%s}}" % template.get(2).strip()),
"year": template.get(1).strip()
}
elif template.has_param(1):
return template.get(1).strip()
else:
@@ -96,7 +84,12 @@ def process_template(self, template):
)
if text != code:
try:
page.put(code, "[[Wikipedia:Bots|Bot]]: Replacing {{[[Template:Start date|start date]]}} with date")
page.put(
code,
"[[Wikipedia:Bots|Bot]]: Replacing {{[[Template:Start date|start date]]}} with the actual date"
" (it should only be used once in a template that emits microformats;"
" see [[Template:Start date/doc]])"
)
except pywikibot.Error:
continue

0 comments on commit 9b3fae8

Please sign in to comment.