list_postprocessing.py 938 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# -*- coding: utf-8 -*-
"""list postprocessing

        A collection of functions to polish the list results.
        
        Each function can be applied on a publications record
        in order to modify its string representation.
        
        All function must have 3 arguments:
            value
                the current string representation of the record
        
            template
                The template apply to the record in order to obtain
                its current representation
                
            record
                The record
                
        Each function must return a string with the new record
        representation.
        
"""
def highlight_cppm_authors(value, template, record):
    
26 27 28 29 30
    li = record.publications.authors_cppm.split(',')
    
    for author in li:
        author = author.strip()
        value = value.replace(author, '<u>%s</u>' % author)
31 32

    return value