Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-07-30 17:16:23

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Partially disable textile in an escape="textile" block? [resolved]

I have a textarea custom field that holds content in textile format, primarily contact details. Something like this.

h5. Organisation Name

Street address 1
Street address 2
ZIP Town
<txp::tel tel="01234 567 890" />
<txp::email email="email@domain.com" />

The two shortcodes txp::tel and txp::email output formatted and clean telephone links with a little icon. The email short also calls my jcr_email_enkode plugin to create a spam-protected email link.

I include that in my template with:

<txp:custom_field name="contact_block" escape="textile" />

It mostly works except that escape="textile" also textiles the quotes in the javascript output by the plugin, breaking the javascript. I tried putting == or notextile. or <notextile>…</notextile> in my shortcode but to no avail. I’m trying to keep it simple for the site users so I’d like to avoid adding the notextile to the custom field itself.

Can I somehow programmatically prevent the shortcode being processed by textile, either in the shortcode, or perhaps even in my plugin?

—-

If it helps, this is a simplified version of my shortcode form:

<txp:if_yield name="email">
<p class="contact email">
    <txp::icon name="mail" />
    <span class="sr-only">E-Mail</span>
    <txp:jcr_email_enkode email='<txp:yield name="email" />' />
</p>
</txp:if_yield>

TXP Builders – finely-crafted code, design and txp

Offline

#2 2024-07-30 18:17:49

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Re: Partially disable textile in an escape="textile" block? [resolved]

Oh well, I resolved it after all … like this:

<txp:if_yield name="email">
<p class="contact email">
    <txp::icon name="mail" />
    <span class="sr-only">E-Mail</span>
    <notextile><txp:jcr_email_enkode email='<txp:yield name="email" />' /></notextile>
</p>
</txp:if_yield>

but with the small caveat that when the tag is used in a non-textiled situation, <notextile> and </notextile> show up in the source code. The validator doesn’t like that but it has no other effect.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB