[GRASS-SVN] r73085 - sandbox/wenzeslaus/g.citation
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 12 20:58:38 PDT 2018
Author: wenzeslaus
Date: 2018-08-12 20:58:38 -0700 (Sun, 12 Aug 2018)
New Revision: 73085
Modified:
sandbox/wenzeslaus/g.citation/g.citation.py
Log:
g.citation: parse features which are a separate line with colon (several more modules parsed)
Modified: sandbox/wenzeslaus/g.citation/g.citation.py
===================================================================
--- sandbox/wenzeslaus/g.citation/g.citation.py 2018-08-13 03:56:38 UTC (rev 73084)
+++ sandbox/wenzeslaus/g.citation/g.citation.py 2018-08-13 03:58:38 UTC (rev 73085)
@@ -305,12 +305,18 @@
raw_author_lines = remove_html_tags(raw_author_lines)
authors = []
+ feature_heading = None
for line in raw_author_lines:
+ line = line.strip() # strip after HTML tag strip
if not line:
continue
institute = None
feature = None
-
+
+ if line.endswith(":"):
+ feature_heading = line[:-1]
+ continue
+
email, text = get_email(text)
orcid, text = get_orcid(text)
ai = line.split(",", 1)
@@ -321,6 +327,10 @@
institute = clean_line_item(ai[1])
if " by " in name:
feature, name = name.split(" by ", 1)
+ elif feature_heading:
+ feature = feature_heading
+ # TODO: handles two authors at the same line
+ # TODO: handle "unknown" author
authors.append({'name': name, 'institute': institute,
'feature': feature, 'orcid': orcid})
return authors
More information about the grass-commit
mailing list