Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[textile] Textile in another CMS (e. g. Symphony)
Hello everybody!
For a project I’m using Symphony as CMS which is XML and XSTL based. There is a plugin for being able to use Textile as textformater but it’s kind of buggy. That’s why I’m investigating and I hope to find some answers here in the Textpattern community.
The Textile class that’s been used in Symphony is the same than in the latest Textpattern release. The plugin calls the textformater in the following way:
function run($string){
$textile = new Textile;
$result = $textile->TextileThis($string);
return $result;
}
Everything works fine expect the fact that ampersands are not properly encoded. If I’m looking further at the Textile class it seem obvious that I need to specify a value for $encode
to get this problem solved. My problem is that no matter if I use $textile->TextileThis($string, '', 1)
, $textile->TextileThis($string, 0, 1)
or $textile->TextileThis($string, false, 1)
I always get a result that is formatted with Textile lite – which I don’t want.
So my question is: How do I have to call TextileThis
to get a full featured Textile support and encoded ampersands?
Thanks for your help!
Nils
Offline
Re: [textile] Textile in another CMS (e. g. Symphony)
Nils, it may be this problem now reported as resolved in the most recent svn classtextile.php.
TXP Builders – finely-crafted code, design and txp
Offline
#3 2007-04-06 16:04:36
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [textile] Textile in another CMS (e. g. Symphony)
jakob is correct. As you’ve discovered, $encode
does not do what you thought it does.
Offline
Re: [textile] Textile in another CMS (e. g. Symphony)
Ah, I see. Thanks for the link to the other thread. The SVN version did the trick.
I’ve got an additional question: Is there anywhere a documentation what Textile Lite and Textile Strict do (or do not) in comparison with the standard Textile processor?
Offline
#5 2007-04-07 18:25:04
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [textile] Textile in another CMS (e. g. Symphony)
Nope, I don’t think there is.
Textile Lite doesn’t allow: any block tags, turning off Textile/raw (X)HTML, code, lists or tables.
Textile Restricted also has a Lite mode, which determines whether you’re allowed all block tags or only blockquotes and paragraphs. It also does various security restrictions and checks of things like attribute values, etc.
Offline
#6 2007-04-07 23:02:27
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [textile] Textile in another CMS (e. g. Symphony)
Textile Lite allows bq and p, but no other block tags. It doesn’t prevent raw XHTML by itself.
Textile Restricted escapes all raw HTML and special characters and turns off class/id/style/lang attributes, to prevent certain types of XSS attacks from untrusted users (it’s intended for comment forms, forum posts etc). It also uses ‘rel=nofollow’ on external links by default, but you can control that via the function parameters.
Both the “normal” (TextileThis()
) and “restricted” (TextileRestricted()
) functions can be used with or without Lite mode. I believe the Textpattern support forum uses Textile Restricted without Lite. I’d suggest:
- TextileThis with Lite=0 for article content from trusted users
- TextileRestricted with Lite=0 for article content, forum posts and larger content from untrusted users
- TextileRestricted with Lite=1 for comment posts, short descriptions etc
- TextileThis with Lite=1 is probably not very useful
I’m considering adding a new ‘Graf’ mode that would process a single block without wrapping it in a ‘p’ tag. That would be useful for things like link descriptions, file descriptions and so on, where you want to produce a list of items each enclosed with a specific tag, like a div, dd or li. Not sure when I’ll have time to get around to that tho.
Last edited by zem (2007-04-07 23:13:03)
Alex
Offline
Re: [textile] Textile in another CMS (e. g. Symphony)
Thanks Zem (and Mary, too).
That exactly what I needed to know!
Offline