Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-23 15:27:32

jwpadgett
Member
Registered: 2008-03-20
Posts: 11

XML and HTML in articles

I’m having trouble with TXP stripping my XML and HTML elements when writing articles with code examples. I prefer to hand code my articles instead of using textile, and I thought that using the pre and code elements would be enough, but alas. Is this possible without using textile? Must I convert the control characters to UTF-8 entities? This would make proofing/editing the code a nightmare.

Thanks for any feedback!

Offline

#2 2010-04-23 15:55:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,028
Website GitHub Mastodon Twitter

Re: XML and HTML in articles

hi jwpadgett,

textile is not compulsory. If you go to Admin>Preferences, you can disable it. Also check out “Problems with code in article bodies” and “How do I post tags and code on the forum?” (which is also valid for the txp install, if you opt to join the textile way) in the FAQ


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2010-04-23 16:17:28

jwpadgett
Member
Registered: 2008-03-20
Posts: 11

Re: XML and HTML in articles

Thanks for the prompt reply, Colak!

I had already disabled textile in my admin preferences. I have my xml and html code inside of pre elements, but Textpattern is stripping the elements or interpreting the html instead of honoring the pre declaration.

Offline

#4 2010-04-23 20:49:15

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: XML and HTML in articles

jwpadgett wrote:

I had already disabled textile in my admin preferences.

Did you save articles before you did that? Because Txp also saves the textiled version, you’ll still see that as long as you haven’t re-saved these articles.

Offline

#5 2010-04-23 20:59:49

jwpadgett
Member
Registered: 2008-03-20
Posts: 11

Re: XML and HTML in articles

No, I had textile disabled before saving. I did use textile on the excerpt, but not the article body.

Offline

#6 2010-04-23 21:36:08

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: XML and HTML in articles

Hmm, just tried this myself and you are right. If Textile is off, < and > aren’t being converted into &lt; and &gt;. If I were you I’d enable Textile and use pre.. and a space at the start of your article (note the double dot for extended formatted blocks). Like this:

pre.. <a href="#">link</a>
     <strong>blah</strong>

<div>
     some text
</div>

which displays:

<a href="#">link</a>
     <strong>blah</strong>

<div>
     some text
</div>

Offline

#7 2010-04-24 13:06:43

jwpadgett
Member
Registered: 2008-03-20
Posts: 11

Re: XML and HTML in articles

Would this be considered a bug?

Offline

#8 2010-04-24 13:39:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,028
Website GitHub Mastodon Twitter

Re: XML and HTML in articles

jwpadgett wrote:

Would this be considered a bug?

most probably. Submitted it in Dev Support.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2010-04-24 20:42:42

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: XML and HTML in articles

I wouldn’t consider it a bug. You sometimes need html tags in an article, for instance for the (few) things Textile can’t handle.
And using bc.. just once is not that much trouble, is it?

Offline

#10 2010-04-24 22:41:47

jwpadgett
Member
Registered: 2008-03-20
Posts: 11

Re: XML and HTML in articles

Not much trouble, no. However, my expectation of “Leave Text Untouched” is just that; my article should have been rendered as intended.

Offline

#11 2010-04-24 22:54:29

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: XML and HTML in articles

jwpadgett wrote:

my article should have been rendered as intended.

How should Txp know if you want to display <strong>this is strong</strong> or this is strong? ;)

Offline

#12 2010-04-25 01:01:56

jwpadgett
Member
Registered: 2008-03-20
Posts: 11

Re: XML and HTML in articles

That’s just it, though. TXP shouldn’t care when I’ve specified “Leave text alone.” the HTML elements and the user agent will handle how I want my content displayed. I used the PRE element to tell the agent how I want <strong>text</strong> to display.

I’m not trying to be difficult, I just expected the system to behave as specified.

Offline

Board footer

Powered by FluxBB