Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-12-05 14:28:58

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

[textile] Wrapping p tags all over the place since 4.0.4

Hi,

I wasn’t quite aware how much this affects existing articles, but have read quite a few post of others struggling with this, too. I’m wondering why this change was made – it sure makes creating/editing more challenging for non-code savvy users.

The hack for image_popper works fine, but I wish textile would behave more like the older version under txp 4.0.3. If you also make use of for instance rss_thumbpop, like I do, you’ll now need to always insert a leading space before it’s tag.

Cheers Martin

Offline

#2 2006-12-05 22:22:32

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [textile] Wrapping p tags all over the place since 4.0.4

I wish textile would behave more like the older version under txp 4.0.3

Please provide examples.


Alex

Offline

#3 2006-12-06 08:47:15

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: [textile] Wrapping p tags all over the place since 4.0.4

If you place the rss_thumbpop tag in an article without a leading space (or notextile.) like so:

<txp:rss_thumbpop category="cat-1" mode="float" pagepop="1" showcaption="0" />

… you get <p><div> … </div></p> – under 4.0.3 this doesn’t happen.

Offline

#4 2007-01-28 14:43:31

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: [textile] Wrapping p tags all over the place since 4.0.4

Hm, since there haven’t been any more replies I suppose this is just the current state. So far this has prevented me from updating a site that makes extensive use of rss_thumbpop since one would have to open every article and insert spaces manually.

I’m wondering, would it be difficult to modify Textile so it would ignore everything from <txp: … to the closing />?

Offline

#5 2007-02-19 19:59:10

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: [textile] Wrapping p tags all over the place since 4.0.4

masa,

I have no idea if this is possible, but could a SQL query be run in the database that inserts a space before every instance of the thumbpop tag? If so, 1 minute of work and your articles are updated.

Offline

#6 2007-02-20 05:05:03

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [textile] Wrapping p tags all over the place since 4.0.4

I have no idea if this is possible…

Yes, it is:

UPDATE textpattern SET 
	Body = REPLACE(Body, '<txp:rss_thumbpop', 'notextile. <txp:rss_thumbpop'), 
	Body_html = REPLACE(Body_html, '<txp:rss_thumbpop', '<txp:rss_thumbpop') 
	WHERE Body LIKE '%rss_thumbpop%';

(Rather than a space, you want the notextile. command.)

Last edited by Mary (2007-02-20 05:05:31)

Offline

#7 2007-02-20 05:07:21

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [textile] Wrapping p tags all over the place since 4.0.4

But, by the way, articles are not parsed for Textile “on-the-fly”, so you can update without problems; you’d just have to turn off Textile – use notextile. – for each instance of the tag when you update the article again.

Offline

#8 2007-02-20 07:44:45

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: [textile] Wrapping p tags all over the place since 4.0.4

Sweet, that is so wiki material. Thanks, Mary (and I don’t even need it).

Last edited by Destry (2007-02-20 07:45:19)

Offline

#9 2007-02-22 23:36:57

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: [textile] Wrapping p tags all over the place since 4.0.4

Mary & Destry,

thanks very much for your replies! That is very helpful, although I’m really intimidated by performing such surgery on the db.

However it leaves my question unanswered, whether it would be possible to modify Textile to leave any <txp… tags untouched. As I mentioned before, this wasn’t a problem with txp 4.0.3.

Offline

#10 2007-02-22 23:59:33

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [textile] Wrapping p tags all over the place since 4.0.4

masa: the problem is, some txp tags (like <txp:image />) require a wrapping p while others don’t. It’s not Textile’s job to know about Textpattern tags or second-guess their output.

If anyone can suggest a general heuristic for deciding when to wrap tags (xhtml or txp) and when not to, I’d like to hear it. Bear in mind that some tags (img, txp:image) usually do require a wrapping p tag for correct (valid and semantic) markup when used alone as a separate graf like this:

text

<img src="foo" />

text

Alex

Offline

#11 2007-02-24 01:11:47

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [textile] Wrapping p tags all over the place since 4.0.4

…although I’m really intimidated by performing such surgery on the db.

That’s what makes backups great.

…whether it would be possible to modify Textile to leave any <txp… tags untouched.

Possible? Yes. You would have to modify PHP, specifically the regular expressions Textile uses.

Offline

#12 2007-03-01 10:20:13

minusf
Member
Registered: 2005-02-15
Posts: 104

Re: [textile] Wrapping p tags all over the place since 4.0.4

If anyone can suggest a general heuristic for deciding when to wrap tags (xhtml or txp) and when not to, I’d like to hear it. Bear in mind that some tags (img, txp:image) usually do require a wrapping p tag for correct (valid and semantic) markup when used alone as a separate graf like this:

perhaps not a heuristic (i think it’s far from trivial), but i find the other way
around much more intuitive, i.e. no wrapping for any tag, and explicitly
stating a paragraph:

text

p.<img />

text

i was bitten with this wrapping p tag issue quite badly and at that time
there was no clear documentation that adding a leading space “disables”
this wrapping. it’s not very intuitive you see…


we is experts™

Offline

Board footer

Powered by FluxBB