[EP-tech] How to customize creators_name in citations

Mathieu Perron mathieu_perron at uqac.ca
Tue May 17 13:34:09 BST 2016


Adam Field <Adam.Field <at> jisc.ac.uk> writes:

> 
> 
> The default rendering of names is with 
EPrints::Utils::make_name_string, which inserts the comma whether you 
like it or not.  See:
> 
> 
https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/Utils.pm#L1
57
> 
> You will need a render method:
> 
> $c->{render_family_name_first_no_comma} = sub
> {
> 
> my ($repo, $field, $value, $allangs, $nolink, $eprint) =  <at> _;
> 
> 
> #please make this a little more sophisticated -- there's currently no 
exception handling for missing values
> 
> return $repo->xml->create_text_node($value->{family} . ' ' . $value->
{given});
> }
> 
> ...and in the field definition:
> 
> 
> 
> 
{name => 'creators',type => 'compound',multiple => 1,fields => [{sub_nam
e => 'name',type => 'name',hide_honourific => 1,hide_lineage => 1,family
_first => 1,
> 
> render_single_value => 'render_family_name_first_no_comma',},
{sub_name => 'id',type => 'text',input_cols => 20,allow_null => 1,}],inp
ut_boxes => 4,
> },
> 
> 
> 
> --
> Adam

Adam,

I just tried your solution and it works like a charm!  You are a life 
saver!

Thank you for a fast and perfect solution!

Have a nice day!

Mathieu Perron



More information about the Eprints-tech mailing list