Skip to content

Commit

Permalink
Fixed some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HazardSJ committed Jul 3, 2013
1 parent 5db8619 commit 0c8bf81
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions citationstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,20 @@ def fixEmptyCitations(self):
break
if not empty:
return
self.code.replace(self.template, self.citationNeededTemplate)
ref = re.compile(r'(?ism)<ref[ >].*?</ref>')
refTags = ref.findall(unicode(self.code))
inRefTag = False
for refTag in refTags:
if unicode(self.template) in refTag:
inRefTag = True
break
if not inRefTag:
self.code.replace(self.template, self.citationNeededTemplate)

def getURLFromArchive(self):
if not (self.template.has_param("archiveurl") and not self.template.has_param("url")):
if not (self.template.has_param("archiveurl") and not \
self.template.has_param("url") and not \
self.template.has_param("deadurl")):
return
archiveURL = self.template.get("archiveurl").strip()
URL = None
Expand Down Expand Up @@ -179,7 +189,7 @@ def run(self):
if not self.template.name.lower().strip() in self.citationTemplates:
continue
try:
self.removeWikilinks()
# self.removeWikilinks() # too many issues, unless coded for specific cases
self.fixEmptyCitations()
self.getURLFromArchive()
self.getArchiveDate()
Expand Down

0 comments on commit 0c8bf81

Please sign in to comment.