Permalink
Browse files

added support for removal of 'accessdate' param if no url

  • Loading branch information...
1 parent 241c412 commit 3755e84dfcf56716d60370fd2e6cde61e6d1a344 @HazardSJ committed Aug 28, 2013
Showing with 12 additions and 2 deletions.
  1. +12 −2 citationstyle.py
View
@@ -18,6 +18,7 @@ class CitationStyleRobot(object):
def __init__(self):
self.site = pywikibot.Site("en", "wikipedia")
self.categories = [
+ Category(self.site, "Category:Pages using citations with accessdate and no URL"),
Category(self.site, "Category:Pages with archiveurl citation errors"),
Category(self.site, "Category:Pages with citations having wikilinks embedded in URL titles"),
Category(self.site, "Category:Pages with empty citations")
@@ -170,6 +171,14 @@ def getArchiveDate(self):
date = datetime.strptime(timestamp,'%Y%m%d%H%M%S')
self.template.add("archivedate", (date.strftime("%d %B %Y")).lstrip("0"))
+ def removeAccessdate(self):
+ if not (self.template.has_param("accessdate") and not
+ self.template.has_param("url") and not
+ self.template.has_param("archiveurl") and not
+ self.template.has_param("deadurl")):
+ return
+ self.template.remove("accessdate")
+
def run(self):
for category in self.categories:
self.checkDoTaskPage()
@@ -186,10 +195,11 @@ def run(self):
if not self.template.name.lower().strip() in self.citationTemplates:
continue
try:
- self.removeWikilinks()
self.fixEmptyCitations()
- self.getURLFromArchive()
self.getArchiveDate()
+ self.getURLFromArchive()
+ self.removeAccessdate()
+ self.removeWikilinks()
except:
print "Skipping: Error encountered while processing"
if text == self.code:

0 comments on commit 3755e84

Please sign in to comment.