EPrints Technical Mailing List Archive

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

Message: #07488


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

Re: [EP-tech] EPScript - Author Limit


Hi James,

This is what I did for one of the repository I help maintain: 

http://researchonline.ljmu.ac.uk/7570/

I should be able to share the code if I can extract it from the rest of
the codebase, as it requires edits to 3-4 files, if I remember
correctly.  Also, if you have other features like people_with_orcids
that modifies the list of authors in the citation in some way (i.e. in
this case add little ORCID buttons to click), then it may require a bit
more of an effort to merge.

Regards

David Newman

On Wed, 2018-09-19 at 09:36 +0100, James Kerwin via Eprints-tech wrote:
> 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(
> ", " ) );
> 			}
> 		}
> 
> *** 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/