[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[EP-tech] Phrases, Pins and If
> emboldened with epscript / citation file
You may be able to do what you need using a citation style instead.
You could copy e.g. the document/default.xml citation file to document/email_embargo_details.xml
In this file you could test whether values are set - and create the statement regarding the embargo details you need.
In your perl, you can then set the 'emreason' to
$emreason = $document->render_citation( "email_embargo_details" );
$mail = $repo->html_phrase( "eprint_thesis_notify_mail", emreason => $emreason ); #include other pins too!
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of James Kerwin via Eprints-tech
Sent: 04 October 2018 11:09
To: Alan Stiles <alan.stiles at open.ac.uk>
Cc: eprints-tech at ecs.soton.ac.uk
Subject: Re: [EP-tech] Phrases, Pins and If
Ahhh I see! It's such a relief to know that what I can't do... can't be done that way.
I was emboldened with epscript when I was altering a citation file last week so thought I would push it with phrases.
Alan, these phrases are for an email that gets generated based on user fields that may be either empty or populated (e.g. an embargo reason may be provided, or it won't). I was attempting to test for emreason being eual to '' (single quotes) so that might be why they look unbalanced.
Anyway, thank you both for helping and tolerating my silly questions.
On Thu, Oct 4, 2018 at 10:45 AM Alan.Stiles <alan.stiles at open.ac.uk<mailto:alan.stiles at open.ac.uk>> wrote:
James, if that?s a copy-paste from your phrase file then the quotes look very unbalanced in the ?if?s ? some may need backslash delimiting or swapping with single quotes?
Not actually sure if what you?re trying to do is feasible, but hopefully it helps?
From: eprints-tech-bounces at ecs.soton.ac.uk<mailto:eprints-tech-bounces at ecs.soton.ac.uk> [mailto:eprints-tech-bounces at ecs.soton.ac.uk<mailto:eprints-tech-bounces at ecs.soton.ac.uk>] On Behalf Of James Kerwin via Eprints-tech
Sent: 04 October 2018 10:18
To: eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>
Subject: [EP-tech] Phrases, Pins and If
I'm looking for some guidance with this problem:
I have an EPrints phrase that uses pins. I can see where the pins are set up and create my own, so I could solve this using Perl.
I want to include a condition in my phrase that depends on the value contained in the pin. Example:
The embargo period has been set at: <epc:pin name="emperiod" /> with the reason being given as testZZZZZZZZZZZZZZZZZtest:<br/>
<epc:if test="emreason = ''"> No reason has been provided.</epc:if>
<epc:if test="<epc:pin name='emreason' /> != ''"> <epc:pin name="emreason" /> <br/><br/></epc:if>
I've used different format in each IF. I comment one out depending on which I'm testing. The second one won't work which I'm not surprised about). The pin in question is this "emreason" pin. Importantly, the phrase is in the perl script like this:
$mail = $repo->html_phrase( "eprint_thesis_notify_mail", %pins );
I could do what I need in the Perl script, but this seems like a good chance to become more familiar with phrases, plus I want to use a similar set-up for another idea I have.
If anybody could point me in the right direction, I would really appreciate it.
-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority in relation to its secondary activity of credit broking.
-------------- next part --------------
An HTML attachment was scrubbed...