Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-11-21 11:26:48

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 734
Website

Can I escape <p> without Textile?

With smd_thumbnail and smd_macro I’ve made a user friendly tag (slideshow) > <txp:lightbox_more id="6,25,47" label="" rel="schilderijen" />

Now this will render a list (<ul>) between <p> tags. I can avoid this by using Textile > 1) type a space before the tag or 2) use notextile. … it’s simple but can be easily forgotten by my clients.

My question is: can it be done inside the source tag? >

<txp:images id="{img_id}" category="{cat}" wraptag="ul" break="li" class="lightbox-one" sort="rand()" label="{titel}" labeltag="h6">
<a href="<txp:image_url />" class="fancybox" rel="{gallery}">
<txp:smd_thumbnail type="thumb" />
</a>
</txp:images>

… so my clients have to do nothing special. Thanks for tips and tricks.

Offline

#2 2012-11-21 11:31:57

gaekwad
Member
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 2,436

Re: Can I escape <p> without Textile?

Use rah_replace to zap the <p>?

Offline

#3 2012-11-21 11:57:30

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 734
Website

Re: Can I escape <p> without Textile?

Thanks Pete …

… but when looking closer I’ve a problem with the output of the tag even before doing some magic with Textile or whatever … look at this piece of HTML >

<article>
<h3>Schilderijen</h3>
<p class="intro">In haar schilderijen houdt Clara ervan zich op de grens tussen figuratief en abstract te begeven. </p>
<p></p>
<h6>Museumnacht (2)</h6>
<ul class="lightbox-one">
<li>
<a class="fancybox" rel="museumnacht" href="http://www.claraelders.nl/txpnew/images/20.jpg">
</li>
<li style="display: none;">
</ul>
<p></p>
<p>Haar werk is vaak helder en vrolijk van kleur. Thema’s zijn elementen uit de natuur zoals organische vormen ontleend aan bloemen, vissen en vogels of de sfeer van vuur/aarde/lucht/water.</p>
<p></p>

<p> tags all over the place … !?

They disappear after using Textile so I presume it has something to do with using the <txp:lightbox_...> tag … !?

What’s happening here?

Last edited by RedFox (2012-11-21 11:58:15)

Offline

#4 2012-11-21 12:27:40

gaekwad
Member
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 2,436

Re: Can I escape <p> without Textile?

Hi Joop – the <p> tags are all appearing outside of the images code in your opening post, which I assume means they’re all within an article body, right? The blank lines in the article body are making the <p></p> appear, I think. Can I ask why you want to remove the <p> tags? I’m curious.

Offline

#5 2012-11-21 12:53:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,620
Website

Re: Can I escape <p> without Textile?

It’s a limitation of the way Textile treats paragraphs, irrespective of content. A leading space or notextile. helps but, as you say, clients forget. Trying to defer the output to inside the macro fails because Textile has already rendered it on article save.

The only way I can think to do it is a “vacuum up empty tags in the HTML output” plugin (perhaps on article save). Dunno if there is one of those yet. Or you could do it on the public side by using jQuery to remove wrapper <p> tags.

Last edited by Bloke (2012-11-21 12:54:34)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2012-11-21 14:34:09

etc
Developer
Registered: 2010-11-11
Posts: 3,125
Website

Re: Can I escape <p> without Textile?

Replacing <txp:body /> in article form by

<rah_replace from="<p></p>" to="">
  <txp:body />
</rah_replace>

should (over)kill empty paragraphs. You can replace other stuff this way, of course. All this will (?) be easier in 4.6.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#7 2012-11-21 14:50:46

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 734
Website

Re: Can I escape <p> without Textile?

Oleg … LOL, that’s heavy stuff man … :)

Bloke … I expected the <ul> would be rendered into a <p> tag … but instead the <ul> is on its own and everywhere else there are empty <p> tags. Maybe I don’t understand what you’re saying, but can you give it another try?

[edit]
Oleg … it doesn’t work … !?

Last edited by RedFox (2012-11-21 15:08:29)

Offline

#8 2012-11-21 15:16:51

etc
Developer
Registered: 2010-11-11
Posts: 3,125
Website

Re: Can I escape <p> without Textile?

RedFox wrote:

Oleg … it doesn’t work … !?

Jukka’s plugin not working? Impossible! I guess then body is rendered with <p><ul>...</ul></p>, and it’s the browser that does the cleanup, unwrapping uls. Try

<rah_replace from="<p><ul,</ul></p>" to="<ul,</ul>">
  <txp:body />
</rah_replace>

etc_[ query | search | pagination | date | tree | cache ]

Offline

#9 2012-11-21 15:21:31

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 734
Website

Re: Can I escape <p> without Textile?

Oleg … no, the article renders as follows (e.g.) >

<p></p>
<ul>...</ul>
<p></p>

See a former post

Last edited by RedFox (2012-11-21 15:23:08)

Offline

#10 2012-11-21 15:36:22

etc
Developer
Registered: 2010-11-11
Posts: 3,125
Website

Re: Can I escape <p> without Textile?

RedFox wrote:

Oleg … no, the article renders as follows (e.g.) >

How do you see it? Browsers do some html cleanup, so viewing doc source is not very reliable. Can you look into textpattern db table?

Edit: looking at the source I see

	<p><ul class="lightbox-more">
...
</ul>
</p>

Last edited by etc (2012-11-21 15:45:22)


etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB