EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #07987
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Building citations based on condition with Regular Expression
- To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>, "Stefan Wellsandt" <wel@biba.uni-bremen.de>
- Subject: Re: [EP-tech] Building citations based on condition with Regular Expression
- From: John Salter <J.Salter@leeds.ac.uk>
- Date: Wed, 2 Oct 2019 13:49:10 +0000
Hi Stefan, You're right - it doesn't. I don't think there is a simple way to achieve what you are trying to do with the EPScript methods available: https://wiki.eprints.org/w/EPScript If you look in EPrints::Script::Compiler::tokenise you'll see the different characters that EPScript expects - it doesn't include RegExps. You could inject a method to EPrints::Script::Compiled that returns a boolean for use in a test, or even rendered xhtml. I used this approach here: https://github.com/eprintsug/dimensions-badge/blob/master/lib/plugins/EPrints/Plugin/Screen/EPrint/Box/DimensionsBadge.pm#L11-L29
(documentation) https://github.com/eprintsug/dimensions-badge/blob/master/lib/plugins/EPrints/Plugin/Screen/EPrint/Box/DimensionsBadge.pm#L117-L149
(method added to EPrints::Script::Compiled) Let me know if that helps - or if you want some more explanation. You *could* inject a method that took a RegExp as a parameter - you would need to be careful about compiling the regex from this string if you do! Cheers, John From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Stefan Wellsandt via Eprints-tech Hello, I want to use a regular _expression_ to assemble a part in a citation. This script (see below) throws me an error – I assume the EprintsScript does not know RegExp.
<when test="type.one_of('conference_item','editor_conference_proceeding')"> In: Proceedings of the <choose> <when test="event_title =~ \International\"> <if test="event_title"><print expr="event_title"/></if> </when> <otherwise> <if test="event_type"><print expr="event_type"/></if> on <if test="event_title"><print expr="event_title"/></if> </otherwise> </choose> </when> What is the easiest way to fix this problem? Best regards Stefan |
- Follow-Ups:
- Re: [EP-tech] Building citations based on condition with Regular Expression
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] Building citations based on condition with Regular Expression
- References:
- [EP-tech] Building citations based on condition with Regular Expression
- From: Stefan Wellsandt <wel@biba.uni-bremen.de>
- Re: [EP-tech] Building citations based on condition with Regular Expression
- From: John Salter <J.Salter@leeds.ac.uk>
- [EP-tech] Building citations based on condition with Regular Expression
- Prev by Date: [EP-tech] Building citations based on condition with Regular Expression
- Next by Date: Re: [EP-tech] Building citations based on condition with Regular Expression
- Previous by thread: [EP-tech] EPrints/CRIS
- Next by thread: [EP-tech] DOI handling in orcid_support_advance
- Index(es):