[GRASS-SVN] r73093 - sandbox/wenzeslaus/g.citation

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 13 19:55:47 PDT 2018


Author: wenzeslaus
Date: 2018-08-13 19:55:47 -0700 (Mon, 13 Aug 2018)
New Revision: 73093

Modified:
   sandbox/wenzeslaus/g.citation/g.citation.py
Log:
g.citation: drop academic (prefix) titles from name

Modified: sandbox/wenzeslaus/g.citation/g.citation.py
===================================================================
--- sandbox/wenzeslaus/g.citation/g.citation.py	2018-08-14 02:37:13 UTC (rev 73092)
+++ sandbox/wenzeslaus/g.citation/g.citation.py	2018-08-14 02:55:47 UTC (rev 73093)
@@ -218,6 +218,9 @@
     Andrea Aime
     >>> print(email)
     aaime at libero.it
+    >>> email, text = get_email("Maris Nartiss (maris.nartiss gmail.com)")
+    >>> print(text)
+    Maris Nartiss
     """
     email = None
     # ORCID as text
@@ -331,19 +334,22 @@
             feature, name = name.split(": ", 1)
         elif feature_heading:
             feature = feature_heading
-        # TODO: handles two authors at the same line
-        # TODO: handle "unknown" author
+        # assuming that names with "and" won't be at the same
+        # line/record with author unique info like email or orcid
         if " and " in name:
             names = name.split(" and ", 1)
-            # assuming that names with "and" won't be at the same
-            # line/record with author unique info like email or orcid
         else:
             names = [name]
         for name in names:
+            # drop academic titles from name
+            for title in ["Dr. ", "Prof. "]:
+                if name.startswith(title):
+                    name = name[len(title):]
             authors.append({
                 'name': name, 'institute': institute,
                 'feature': feature, 'email': email,
                 'orcid': orcid})
+        # TODO: handle unknown/Unknown author
     return authors
 
 



More information about the grass-commit mailing list