Normalize parsed cite targets

This commit is contained in:
Tim Van Baak 2020-04-11 11:45:08 -07:00
parent a3ccb537ca
commit a9a025094a

View File

@ -54,7 +54,8 @@ class CitationSpan(SpanContainer):
"""A citation to another article"""
def __init__(self, spans, cite_target):
super().__init__(spans)
self.cite_target = cite_target
# Normalize citation target by eliminating most whitespace
self.cite_target = re.sub(r'\s+', " ", cite_target.strip())
def __str__(self):
return f"{{{' '.join([str(span) for span in self.spans])}:{self.cite_target}}}"