EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #00174


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

[EP-tech] Re: using a creator's inital in a citation


You may be able to do this with a custom render function for the field (see below). I haven't tried this on a name field before - only text fields which don't appear in the citation - so proceed with caution!
Alternatively, look in ~/perl_lib/EPrints/Utils.pm at 'make_name_string' - this may also be useful (but will affect all fields of type 'name').
 
In eprint_fields.pl, add a 'render_value' to the field:
{
    'name' => 'creators',
    'type' => 'compound',
    'multiple' => 1,
    'fields' => [
        {
            'sub_name' => 'name',
            'type' => 'name',
            'hide_honourific' => 1,
            'hide_lineage' => 1,
            'family_first' => 1,
        },
        {
            'sub_name' => 'id',
            'type' => 'text',
            'input_cols' => 20,
            'allow_null' => 1,
        }
    ],
    'input_boxes' => 4,
    'render_value' => 'my_lovely_creator_renderer'
},
In another file (my_lovely_creator_rendered.pl?):
$c->{my_lovely_creator_renderer} = sub {
    my( $session , $field , $value ) = @_;
    my $frag = $session->make_doc_fragment;
#do some perl magic to return the value how you want it
 
    return $frag;
};
Cheers,
John


From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Chris Keene
Sent: 14 March 2012 14:40
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] using a creator's inital in a citation

Hi

We are currently reviewing how we add author names in to the creators fields of eprints, e.g. do we use the same format as the official source, do we use full names, or surname and initial.

 

I’d like to know if it is possible to configure a eprints citation / view so that it only shows an initial for the forename, even if the field itself contains a full version of the forename?

 

This would allow us to store the full name where we have it, while showing a consistent citation style of author names on the public site.

 

Many thanks for any tips

 

Chris

 

Chris Keene
Technical Development Manager, University of Sussex Library
Contact: http://www.sussex.ac.uk/profiles/150000