[EP-tech] Re: Paragraph in abstract field

Sebastien Francois sf2 at ecs.soton.ac.uk
Mon Mar 17 14:53:18 GMT 2014


As is will work.

$c is the main config object so you're adding some sort of anonymous 
function to it -> $c->{render_paras} = sub {...};

Seb

On 17/03/14 14:54, Andrew Beeken wrote:
> Oh right, cool! Do I need to include any dependencies or just the code as
> you¹ve presented it?
>
> On 17/03/2014 14:38, "Sebastien Francois" <sf2 at ecs.soton.ac.uk> wrote:
>
>> Hello,
>>
>> In whichever file you want inside archives/<id>/cfg/cfg.d/
>>
>> e.g. create new file "render_paras.pl" or "render_methods.pl" and put
>> all your render methods there. As you wish!
>>
>> Seb
>>
>> On 17/03/14 14:36, Andrew Beeken wrote:
>>> Hi Seb,
>>>
>>> This is also something I¹m looking for ­ where would this go in local
>>> conf (which file)?
>>>
>>> Andrew
>>>
>>> From: Sebastien Francois
>>> <sf2 at ecs.soton.ac.uk<mailto:sf2 at ecs.soton.ac.uk>>
>>> Reply-To:
>>> "eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>"
>>> <eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>>
>>> Date: Monday, 17 March 2014 12:13
>>> To: "eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>"
>>> <eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>>
>>> Subject: [EP-tech] Re: Paragraph in abstract field
>>>
>>> Hi,
>>>
>>> In your local conf, add:
>>>
>>> $c->{render_paras} = sub {
>>>           my( $session, $field, $value, $object ) = @_;
>>>
>>>           my $frag = $session->make_doc_fragment;
>>>
>>>           # normalise newlines
>>>           $value =~ s/(\r\n|\n|\r)/\n/gs;
>>>
>>>           my @paras = split( /\n\n/, $value );
>>>           foreach my $para( @paras )
>>>           {
>>>                   $para =~ s/^\s*\n?//;
>>>                   $para =~ s/\n?\s*$//;
>>>                   next if $para eq "";
>>>
>>>                   my $p = $session->make_element( "p",
>>> class=>"ep_field_para" );
>>>
>>>                   my @lines = split( /\n/, $para );
>>>                   for( my $i=0; $i<scalar( @lines ); $i++ )
>>>                   {
>>>                           $p->appendChild( $session->make_text(
>>> $lines[$i] ) );
>>>                           $p->appendChild( $session->make_element( "br"
>>> ) ) unless $i == $#lines;
>>>                   }
>>>
>>>                   $frag->appendChild( $p );
>>>           }
>>>
>>>           return $frag;
>>> }
>>>
>>>
>>> Then in your eprint_fields:
>>>
>>> {
>>>       name=>'abstract',
>>> #etc
>>>       render_value => 'render_paras'
>>> }
>>>
>>> Seb
>>>
>>>
>>> On 14/03/14 13:14, Lourdes Calvo Montero wrote:
>>> Hi all,
>>>
>>> we have upgraded to 3.3.12, is there any way to render paragraphs
>>> inside the abstract field?
>>>
>>> Thanks
>>>
>>> Lourdes
>>>
>>>
>>>
>>> *** 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/
>>>
>>>
>>> The University of Lincoln, located in the heart of the city of Lincoln,
>>> has established an international reputation based on high student
>>> satisfaction, excellent graduate employment and world-class research.
>>>
>>> The information in this e-mail and any attachments may be confidential.
>>> If you have received this email in error please notify the sender
>>> immediately and remove it from your system. Do not disclose the contents
>>> to another person or take copies.
>>>
>>> Email is not secure and may contain viruses. The University of Lincoln
>>> makes every effort to ensure email is sent without viruses, but cannot
>>> guarantee this and recommends recipients take appropriate precautions.
>>>
>>> The University may monitor email traffic data and content in accordance
>>> with its policies and English law. Further information can be found at:
>>> http://www.lincoln.ac.uk/legal.
>>>
>>> *** 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/
>> *** 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/
>
> *** 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/



More information about the Eprints-tech mailing list