Skip to content

Commit

Permalink
* trim newlines and multiple spaces from titles in page templates
Browse files Browse the repository at this point in the history
  • Loading branch information
erlehmann committed Jan 14, 2013
1 parent 3013915 commit 8f201fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helpers/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def _escape(text):
pass
return text

def _trim(text):
return ' '.join(text.split())

def page(article_doi, article_pmid, article_pmcid, authors, article_title, journal_title, \
article_year, article_month, article_day, article_url, license_url, label, caption, \
title, categories):
Expand Down Expand Up @@ -47,7 +50,7 @@ def page(article_doi, article_pmid, article_pmcid, authors, article_title, journ
text += "|Source= "
text += "{{Cite journal\n"
text += "| author = %s\n" % _escape(authors)
text += "| title = %s\n" % _escape(article_title)
text += "| title = %s\n" % _escape(_trim(article_title))
text += "| doi = %s\n" % _escape(article_doi)
text += "| journal = %s\n" % _escape(journal_title)
text += "| year = %s\n" % _escape(article_year)
Expand Down

0 comments on commit 8f201fb

Please sign in to comment.