[EP-tech] Re: Paragraph in abstract field

Andrew Beeken anbeeken at lincoln.ac.uk
Mon Mar 17 14:36:12 GMT 2014


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.



More information about the Eprints-tech mailing list