[EP-tech] Re: Paragraph in abstract field
Sebastien Francois
sf2 at ecs.soton.ac.uk
Mon Mar 17 12:13:22 GMT 2014
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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20140317/1ce1c3f2/attachment.html
More information about the Eprints-tech
mailing list