[Blends-commit] [SCM] website branch, master, updated. c9481c41ebb3c790ba8f73e10b1639dee221e7ab
Akshita Jha
akshita-guest at users.alioth.debian.org
Wed Aug 5 09:40:43 UTC 2015
The following commit has been merged in the master branch:
commit c9481c41ebb3c790ba8f73e10b1639dee221e7ab
Author: Akshita Jha <akshita-guest at users.alioth.debian.org>
Date: Wed Aug 5 15:07:16 2015 +0530
Modify blendstasktools_udd.py : Add citations/publications information
diff --git a/webtools_py3/blendstasktools_udd.py b/webtools_py3/blendstasktools_udd.py
index 9bf155a..1ff6158 100644
--- a/webtools_py3/blendstasktools_udd.py
+++ b/webtools_py3/blendstasktools_udd.py
@@ -759,6 +759,53 @@ class DependantPackage:
# ret += ", desc['en']:" + str(self.desc['en'])
return ret
+ def SetPublications(self, row):
+ for pub in ("year", "title", "authors", "doi", "pubmed", "url", "journal", "volume", "number", "pages", "eprint" ):
+ if row[pub]:
+ if pub == "pages":
+ row[pub] = re.sub("--", "-", row[pub])
+ if (pub == "authors" and row[pub].count(" and ") or row[pub].count(" AND ")):
+ # assume "authors" string is a regular BibTeX "and" separated list of authors
+ row[pub] = re.sub("AND", "and", row[pub].strip())
+ authors_list = row[pub].split(" and ")
+ # normalize several BibTeX styles to "First Last, First Last and First Last":
+ # 1. "First Last and First Last and First Last"
+ # 2. "Last, First and Last, First and Last, First"
+ # 3. "First Last, First Last and First Last"
+ authors_string = ""
+ while (authors_list):
+ author = authors_list.pop(0)
+ if (author.count(",") > 1):
+ # 3. "First Last, First Last and First Last"
+ # authors string is already in desired format, keep it
+ authors_string = row[pub].strip()
+ break
+ elif (row[pub].count(",") == row[pub].count(" and ") + 1):
+ # 2. "Last, First and Last, First and Last, First"
+ # reverse last and first name
+ (last, first) = author.split(", ")
+ full_author = first + " " + last
+ else:
+ # 1. "First Last and First Last and First Last"
+ full_author = author
+ if (len(authors_list) > 1):
+ authors_string += full_author + ", "
+ elif (len(authors_list) > 0):
+ authors_string += full_author + " and "
+ else:
+ authors_string += full_author
+ if row[pub] != authors_string:
+ # emergency brake if algorithm fails to detect non-names like '1000 Genome Project Data Processing Subgroup'
+ if authors_string.count(',') > row[pub].count(' and '):
+ logger.warning("Refuse to change Author string in %s: '%s'(%i) -> '%s'(%i)", \
+ self.pkg, to_unicode(row[pub]), row[pub].count(' and '), to_unicode(authors_string), authors_string.count(','))
+ else:
+ logger.debug("Author string changed in %s: '%s' -> '%s'", self.pkg, to_unicode(row[pub]), to_unicode(authors_string))
+ row[pub] = authors_string
+ if 'published' not in self.properties:
+ self.properties['published'] = {}
+ self.properties['published'][pub] = row[pub]
+
class Tasks:
# Provide a list of depencencies defined in metapackages
@@ -1207,6 +1254,9 @@ class TaskDependencies:
dep.properties['maintainer'] = (row['maintainer'])
dep.responsible = '<a href="mailto:%s">%s</a>' % (_url, (_name))
+ # Publications
+ dep.SetPublications(row)
+
self._AppendDependency2List(dep)
def GetTaskDependencies(self, source=0):
--
Static and dynamic websites for Debian Pure Blends
More information about the Blends-commit
mailing list