RE: [EP-underground] changing the way multiple authors is displayed in a citation.

"Whitsel, Kurt W" <[email protected]> Fri, 17 Jan 2003 10:39:18 -0500
Newsgroups gmane.comp.web.eprints.general
Message-ID <29F16A81821EE844861C4349FE34406B536647@iu-mssg-mbx08.exchange.iu.edu>
Thank you for answering this but would this apply to lists of authors?

For example the first author in a list of three would be displayed
"lastname, firstname middle honorific"

But then my boss wanted the second displayed

"firstname middlename lastname honorific" separated from the second and
third by a comma.



-----Original Message-----
From: ePrints Support [mailto:[email protected]] 
Sent: Friday, January 17, 2003 10:12 AM
To: EPrints Underground List
Subject: Re: [EP-underground] changing the way multiple authors is
displayed in a citation.

OK. The way any field is rendered in the citation can be modified
properly
by adding a render_value option to the field's configuration. This is a 
pointer to a function. The function below is just an example, change it
to do what you want. This is much better than hacking the code as it
avoids oddness in upgrades.

Something like
{ name=>"authors", type=>"name", render_value=>\&local_name_render, ...
...}

then later in ArchiveMetadataFieldsConfig...


sub local_name_render
{
	my( $session, $field, $value, $alllangs, $nolink ) = @_;
	# the important bit's are $session and $value

	my $f = $session->make_doc_fragment;
        my $first = 1;
        foreach my $auth ( @{$value} )
        {
                my $id = $auth->{id};
                my $name = $auth->{main};
		# only care about the name 
		my $namestr = $name->{given}." ".$name->{family};
		# (ignoring honourific and lineage)

                if( !$first )
                {
                        $f->appendChild( $session->make_text( " and "
));
                }
                $first = 0;
                $f->appendChild( $session->make_text( $namestr ) );
        }

        return $f;
}

	


On Tue, Jan 14, 2003 at 03:59:33 -0500, Whitsel, Kurt W wrote:
> My boss did not like the way lists of author names where displayed in
> citations.
> 
> I was hoping there was an easy way to configure this and maybe there
is
> but couldn't find it.  What I eventually did was alter a couple of
perl
> routines in the Utils.pm file.
> 
> 
> -----Original Message-----
> From: Whitsel, Kurt W 
> Sent: Tuesday, December 03, 2002 11:52 AM
> To: EPrints Underground List
> Subject: [EP-underground] changing the way multiple authors is
displayed
> in a citation.
> 
> 
> I have been asked to change the way multiple authors are
> displayed in a citation in Eprints 2.
> 
> I have looked hard through the configuration files and code and could
> not find it.
> I admit this question is sort of lame but maybe someone knows the
answer
> off the top of thier head.
> 
> Any Suggestions?? 
> 

-- 

 Christopher Gutteridge
[email protected]
 ePrints2 Coder, Support and Stuff        +44 23 8059 4833