Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2004-04-22 07:32:57

jbrew
Member
From: Imperial Beach, California
Registered: 2004-03-04
Posts: 78
Website

Re: XHTML in text field

Using SubEthaEdit, so… it may be fine. I just didn’t want to change it and have it screw it up. If its all fine regardless of synatx highlighting then I am gonna do it tomorrow!!!

Thanks.


To even the least of these…

Offline

#14 2004-04-23 12:08:26

kevin
New Member
From: Dublin
Registered: 2004-04-20
Posts: 8
Website

Re: XHTML in text field

Hi,

Just a quick question.
Which file is it that you modify that regex?

Thanks,

- Kevin

Offline

#15 2004-04-23 20:29:48

thekolonel
Archived Plugin Author
From: NYC
Registered: 2004-03-01
Posts: 28
Website

Re: XHTML in text field

<code>classTextile.php</code>

Offline

#16 2004-04-23 22:43:04

thekolonel
Archived Plugin Author
From: NYC
Registered: 2004-03-01
Posts: 28
Website

Re: XHTML in text field

I just realized I’m running a slightly newer version that solves the definition list problem. This will match any chunks of text that begin with an XHTML tag and prevent textile from auto-adding p tags, so now something like <code><tag></code>blah blah blah<code></tag></code> will also be left alone. You can always place a p. at the front if you still need the paragraph wrapper.

Updated:

On line 437, just replace this:

<code>$line = preg_replace(‘/^(?!\\t|<\\/?pre|<\\/?code|$| )(.*)/’, “\\t<p>$1</p>”, $line);</code>

with this:

<code>if (!preg_match(‘/^<[\\/\\!]*?[^<>]*?>(<br \\/>)?/si’, $line)) { $line = preg_replace(‘/^(?!\\t|<\\/?pre|<\\/?code|$| )(.*)/’, “\\t<p>$1</p>”, $line); }</code>

Last edited by thekolonel (2004-04-23 22:45:59)

Offline

#17 2004-04-25 00:47:40

Cantide
Member
From: Wellington, New Zealand
Registered: 2004-03-03
Posts: 27
Website

Re: XHTML in text field

Thanks thekolonel! Can’t wait to try this out :) I have a bunch o’ ‘rich’ content that I wish to bring into TP which has been waiting for the XHTML go-ahead, and this problem was the only thing making me unsure about trying to manage my entire site with TP in general. Kickass!

Offline

#18 2004-04-29 06:57:41

davidm
Member
From: Paris, France
Registered: 2004-04-27
Posts: 719

Re: XHTML in text field

Wouldn’t contextual selector be much simpler ?

something like

#content p.firststyle

#content p.secondstyle

… etc

Works fine for me


.: Retired :.

Offline

#19 2004-04-29 09:16:42

kevin
New Member
From: Dublin
Registered: 2004-04-20
Posts: 8
Website

Re: XHTML in text field

You can already use class names with paragraphs, but there’s lots of content that cannot be contained in a paragraph, which is why this hack is cool!

Offline

#20 2004-04-29 15:42:37

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

Re: XHTML in text field

Yes, this new version of the hack enables you to use definition lists, of which I’m a fan.

Only one quirk: lets say you have a paragraph like this:

<code><pre>
Notice: “Howell Creek Radio will return to the air next
week, after a considerable delay owing to Mr. Aldrich’s
extreme particularity in consenting to renew our license.”
</pre></code>

With the hack, Textile will no longer wrap this in paragraph tags, presumably because it begins with markup. Using * instead of <code><strong></code> produces the same result.

Of course, adding p. before the paragraph is a fix, but it would be nice not to have to pick through it all.

Last edited by jdueck (2004-04-29 15:45:43)

Offline

#21 2004-07-03 19:49:42

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: XHTML in text field

> thekolonel wrote:

> On line 437, just replace this:

<code>$line = preg_replace(‘/^(?!\\t|<\\/?pre|<\\/?code|$| )(.*)/’, “\\t<p>$1</p>”, $line);</code>

with this:

<code>if (!preg_match(‘/^<[\\/\\!]*?[^<>]*?>(<br \\/>)?/si’, $line)) { $line = preg_replace(‘/^(?!\\t|<\\/?pre|<\\/?code|$| )(.*)/’, “\\t<p>$1</p>”, $line); }</code>

This is now on line 440 of classTextile.php in 1.19. However, I’m still having a problem with definition lists—Textile introduces <code><br /></code> tags at the end of each line of XHTML in the definition list. Obviously, this causes the definition list to not validate, but, more importantly, it seems to cause problems in some browsers.

This also definitely causes a problem if you try to create a table in XHTML…when Textile processes it, it adds a <code><br /></code> to the end of each line, and as with a definition list, that leads to invalid code and display problems.

The root of the problem, however, isn’t in using definition lists, it’s really that there needs to be some Textile tag that will suspend all Textile processing and pass the contents through unmodified.

Last edited by KurtRaschke (2004-07-03 19:59:39)


kurt@kurtraschke.com

Offline

#22 2004-09-02 00:27:19

Cantide
Member
From: Wellington, New Zealand
Registered: 2004-03-03
Posts: 27
Website

Re: XHTML in text field

That would be very nice yes. I’m finding it easier and easier to do more through textile’s processing, without having to resort to XHTML (especially by using forms), but there are always going to be fiddly things that are not in textile’s best interests to support, that need to go on our sites. A simple TP:escape would go a long way here.

Textpattern rocks BTW :)

Offline

#23 2004-10-10 20:08:25

stevechamp
Member
Registered: 2004-08-13
Posts: 12

Re: XHTML in text field

I’ve tried this hack, but throws up errors

Every paragraph if not using p. gets \t before it, and ul/ol/dl get a <br/> instead of a </li,ol,etc> for the last item, when enclosed in say a div.

Can anyone improve upon this?

Offline

#24 2004-10-27 07:24:12

Cantide
Member
From: Wellington, New Zealand
Registered: 2004-03-03
Posts: 27
Website

Re: XHTML in text field

Bump! Pleasepleaseplease add an escaping tag for Textile formatting. It can’t do everything HTML can, it’s overly simplistic in places, so it needs this for content authors to accept it in the place of full HTML. Even just making Textile automatically suspend its own formatting rules when it finds <code><html></code> would be sweet, like Textile for MT does.

Last edited by Cantide (2004-10-27 07:28:03)

Offline

Board footer

Powered by FluxBB