[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] EPScript - Author Limit



Hi All,

I have been tasked with limiting the number of authors that display in any
given EPrint Abstract page as when there are many authors/creators
associated with an EPrint it ruins the abstract page.

I have edited default.xml in citations and can make it show ten authors and
add an "et al" to the end if there are more than ten authors.

However, previously the creators/authors list was generated via:

<print expr="people_with_orcids(creators)" />

I wasn't able to iterate through this so I instead used:

<epc:foreach expr="creators_name" iterator="name" limit="10">
<print expr="$name" />

If I wanted to change the behaviour of "people_with_orcids(creators) how
would I do this? I don't need detailed instruction, just a nudge towards
which file(s) control this if anybody knows.

My suspicion is that I need to change the sub "run_people_with_orcids" in a
file named z_orcid_support.pl in ../[Archive_Id]/cfg/cfg.d, but I'm not
super excited about chopping and changing things without fully knowing if I
should (sub snippet below).

Thanks,
James

#Rendering ORCIDs
{
package EPrints::Script::Compiled;
use strict;

sub run_people_with_orcids
{
my( $self, $state, $value ) = @_;

my $session = $state->{session};
my $r = $state->{session}->make_doc_fragment;

my $creators = $value->[0];

foreach my $i (0..$#$creators)
{

my $creator = @$creators[$i];

if( $i > 0 )
{
#not first item (or only one item)
if( $i == $#$creators )
{
#last item
$r->appendChild( $session->make_text( " and " ) );
}
else
{
        $r->appendChild( $session->make_text( ", " ) );
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20180919/ae631967/attachment.html