Skip to content

Commit c37ef1f

Browse files
committedMar 14, 2018
publication_list: Correctly highlight authors with middle names.
Fix #259
1 parent d70b21e commit c37ef1f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎v7/publication_list/publication_list.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,12 @@ def run(self):
126126
pub_html = list(style.format_entries((entry,)))[0].text.render_as('html')
127127
if highlight_authors: # highlight one of several authors (usually oneself)
128128
for highlight_author in highlight_authors:
129+
# We need to replace all occurrence of space except for the last one with
130+
#  , since pybtex does it for all authors
131+
count = highlight_author.count(' ') - 1
129132
pub_html = pub_html.replace(
130-
highlight_author.strip(), '<strong>{}</strong>'.format(highlight_author), 1)
133+
highlight_author.strip().replace(' ', '&nbsp;', count),
134+
'<strong>{}</strong>'.format(highlight_author), 1)
131135
html += '<li class="publication" style="padding-bottom: 1em;">' + pub_html
132136

133137
extra_links = ""

0 commit comments

Comments
 (0)
Please sign in to comment.