EPrints Technical Mailing List Archive

Message: #05713


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] How to customize creators_name in citations


The default rendering of names is with EPrints::Utils::make_name_string, which inserts the comma whether you like it or not.  See:


You will need a render method:

$c->{render_family_name_first_no_comma} = sub
{
my ($repo, $field, $value, $allangs, $nolink, $eprint) = @_;

#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_name => '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,
}
],
input_boxes => 4,
},


--
Adam

On 16 May 2016, at 21:18, Mathieu Perron <mathieu_perron@uqac.ca> wrote:

Hi,

I've been searching in the code and in this tech list to find a way to
customize the creators_name list in the citations.  I'm trying to
accomplish the following citation style:

lastname firstname, lastname firstname, lastname firstname and lastname
firstname. [rest of citation here].

I've been able to put the " and " for the last author by changing the
"lib/metafield:join_name.last" phrase.  I've read that I can order the
creators_name by using "gf" or "fg" but there's no option to keep it "fg"
but without the ", " between the family and given names.

I tried creating a custom "render_value" or "render_single_value" sub but
to no avail.  Can anyone help me on this?

Thank you for any help you can give me and have a nice day!

Mathieu

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/



Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800.

Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.