[Collab-qa-commits] r2279 - udd/udd

Andreas Tille tille at alioth.debian.org
Mon May 7 21:06:12 UTC 2012


Author: tille
Date: 2012-05-07 21:06:12 +0000 (Mon, 07 May 2012)
New Revision: 2279

Modified:
   udd/udd/bibref_gatherer.py
Log:
Replace illegal BibTeX string ', and ' by ' and ' in author field


Modified: udd/udd/bibref_gatherer.py
===================================================================
--- udd/udd/bibref_gatherer.py	2012-05-07 20:21:41 UTC (rev 2278)
+++ udd/udd/bibref_gatherer.py	2012-05-07 21:06:12 UTC (rev 2279)
@@ -126,6 +126,12 @@
         ref['value']   = str(references[r])
       else:
         ref['value']   = references[r].strip()
+        if key == 'author':
+          # Try to catch broken author formating
+          new_author = re.sub(',\s* and\s*' , ' and ', ref['value'])
+          if new_author != ref['value']:
+            self.log.warning("Author of source package %s does contain invalid BibTeX format: %s will be turned into %s", source, ref['value'], new_author)
+            ref['value'] = new_author
       self.bibrefs.append(ref)
       if r.lower() == 'year':
         year = ref['value']




More information about the Collab-qa-commits mailing list