xwisdom
Foundation

Posts: 1,732
|
 |
« on: Jun 21, 2005, 11:08 AM » |
|
Ok here's a beta version of the Textile Paraser: Plugin Name: Textile Description: Textile parser Event: OnWebPagePrerender Code: /** * Textile Parser for MODx * * Based on the textile parser at www.textism.com * */
$e = &$modx->Event;
switch ($e->name) { case "OnWebPagePrerender": include_once($modx->config["base_path"].'/assets/plugins/textile/textile.php'); $doc = $modx->documentOutput; preg_match_all("|<textile>(.*)</textile>|Uis",$doc,$matches); for ($i=0;$i<count($matches[0]);$i++) { $tag = $matches[0][$i]; $text = $matches[1][$i]; $text = textile($text); $doc = str_replace($tag,$text,$doc); } $modx->documentOutput = $doc; break; default: // stop here return; break; }
return $textile;
Please unzip the attached plugin.textile.zip file and copy the assets/plugins/textile/ folder structure along with files into the root of you website. USAGE:Also remember to put your textile tags inside a the <textile></textile>tags. You could even use a TV to do this. Check out the HTML Generic tag control. This control can wrap the <textile> tags around your textile content. PS. I think the textile.php file is very old. It does not parse things like h2{color:green}. My title. Is there a more up-to-date parser?
|
|
|
« Last Edit: Jan 04, 2006, 12:06 PM by zi »
|
Logged
|
|
|
|
afkuz
Jr. Member

Posts: 15
|
 |
« Reply #1 on: Jun 21, 2005, 01:42 PM » |
|
This is great! I'm going to try this out as soon as I get a chance. For updated versions and whatnot, you may want to try emailing Dean Allen, the creator of Textile. His email address is dean@textism.com. I'm sure if you explain what you're using this for, he will probably give you all the necessary information and maybe even some other tips and tricks as far as integration is concerned. Can't hurt. Thanks so much for the plugin!
|
|
|
|
|
Logged
|
|
|
|
davidm
Marketing & Design Team

Posts: 6,777
The best way to predict the future is to invent it
|
 |
« Reply #2 on: Nov 25, 2005, 05:54 AM » |
|
As a textpattern user, I'd love to use Textile in MODx (I guess many people will be interrested in MarkDown as well, considering the existence of phpMarkdown it should be even easier to integrate) Where are we on this ? Anyone tested it  I most certainly will... Thanks Raymond 
|
|
|
|
|
Logged
|
|
|
|
grad
Coding Team

Posts: 139
|
 |
« Reply #3 on: Nov 25, 2005, 07:45 AM » |
|
Raymond, is it possible to make it work as an editor not parser? I mean, the one that you choose in site config.
|
|
|
|
|
Logged
|
|
|
|
davidm
Marketing & Design Team

Posts: 6,777
The best way to predict the future is to invent it
|
 |
« Reply #4 on: Nov 25, 2005, 08:04 AM » |
|
Textile is not an editor indeed but a parser. Sometime ago on textpattern's forum I suggested we create a javascript toolbar for Textile. This lead to two quicktag plugins : It works pretty much like BBcode formating in boards  The only thing I have been pushing for is live preview (end users like WYSIWYG). It would allow for the best of both worlds, since Textile or Markdown do a pretty good job of outputting compliant code, while hmtl WYSIWYGS Editor are not... (But TinyMCE is better than FCK in this area...) Maybe those plugins could be ported to MODx, this I don't know...
|
|
|
|
« Last Edit: Nov 25, 2005, 08:07 AM by davidm »
|
Logged
|
|
|
|
xwisdom
Foundation

Posts: 1,732
|
 |
« Reply #5 on: Nov 25, 2005, 08:12 AM » |
|
Hi, This sounds like a nice idea  I don't remember but I think Jeff was working on something like this. Btw, Jeff's the RTE/TE expert
|
|
|
|
|
Logged
|
|
|
|
grad
Coding Team

Posts: 139
|
 |
« Reply #6 on: Nov 25, 2005, 01:52 PM » |
|
David, I know what Textile is. I also used it with TXP.
Maybe I wasn't clear in my post. I think about Textile used without <textile> elements but parsing the input by default. Just like FCK does. I'd like to be able to set it as the default 'editor' for the site.
The toolbar wouldn't be necessary, a short list of most common tags or a link to small help window would be enough.
|
|
|
|
|
Logged
|
|
|
|
Bravado
Coding Team

Posts: 1,078
"I can learn to resist anything but temptation..."
|
 |
« Reply #7 on: Nov 28, 2005, 09:32 AM » |
|
I concur with others here. Textile is really more of a context specific parser than anything else. It's possible to use it as a parser and then use whatever editor you wish to enter Textile specific tags. However, I'm not sure if some of the editors (FCK, TinyMCE, etc.) will allow for "previewing" Textile specific tags. I'm sure there's a way to have the best of both worlds...that is, implement Textile with two separate plugins: one for the actual parser and another to allow selection of a textarea only editor field for Textile use (maybe have a key added above or below the textarea with Textile hints). I'm not entirely familiar with Textile since I haven't really used it...but I'm sure with a little research I could probably figure out a worthwhile solution. 
|
|
|
|
|
Logged
|
Jeff Whitfield
"When someone asks you, A penny for your thoughts, and you put your two cents in, what happens to the other penny?"
-George Carlin
|
|
|
grad
Coding Team

Posts: 139
|
 |
« Reply #8 on: Nov 28, 2005, 10:21 AM » |
|
another to allow selection of a textarea only editor field for Textile use (maybe have a key added above or below the textarea with Textile hints)
That's exactly what I thought about.
|
|
|
|
|
Logged
|
|
|
|
davidm
Marketing & Design Team

Posts: 6,777
The best way to predict the future is to invent it
|
 |
« Reply #9 on: Jan 03, 2006, 06:43 AM » |
|
I finally took some time to install the plugin.
My question is, how do I use it. Since it's not recognized as an editor, I can't select it to edit documents.
Is there some Plugin configuration that could solve this ? I know Textile is not a WYSIWYG editor but it should be easy to turn on or off.
Thanks !
|
|
|
|
|
Logged
|
|
|
|
xwisdom
Foundation

Posts: 1,732
|
 |
« Reply #10 on: Jan 04, 2006, 11:35 AM » |
|
Also remember to put your textile tags inside a the <textile></textile>tags. You could even use a TV to do this. Check out the HTML Generic tag control. This control can wrap the <textile> tags around your textile content.
|
|
|
|
|
Logged
|
|
|
|
davidm
Marketing & Design Team

Posts: 6,777
The best way to predict the future is to invent it
|
 |
« Reply #11 on: Jan 04, 2006, 12:05 PM » |
|
Oops, seems like I should learn to read ! Thanks, I'll now get down to testing it 
|
|
|
|
|
Logged
|
|
|
|
Berlueur
Jr. Member

Posts: 12
I love MODx!
|
 |
« Reply #12 on: Feb 27, 2006, 03:39 AM » |
|
OK, 2 things.
1. I tried installing and using the Textile plugin. I can't seem to make it work. The tags remain and no formatting is applied.
Should I see the plugin in the Manager's Assets/Plugins? Cause I don't see it currently...
(Everything is in the right path, I'm pretty sure. And everything is 755.)
2. Despite my knowing almost no PHP, I tried making my own Markdown plugin based on yours and PHP Markdown Extra -- since there was none... and since I really like Markdown. Seemed ridiculously easy.
Alas, I failed. I can neither get the (professional) Textile plugin nor my own attempted Markdown to work. Same (non-)result in both cases.
Help...?
|
|
|
|
|
Logged
|
|
|
|
davidm
Marketing & Design Team

Posts: 6,777
The best way to predict the future is to invent it
|
 |
« Reply #13 on: Feb 27, 2006, 03:59 AM » |
|
To install the plugin :
1. Copy/Paste the code of thread in a new plugin (Resources > Manage Resources > Plugins >> New plugin)
2. Before you save the plugin, go to System Events and look for OnWebPagePrerender. Tick the checkbox. Save.
You should know be able to use the plugin. For this, better disable Rich Text Editing. Type your content with whatever textile formatting you need to. Either wrap it in <textile> </textile> or better yet, adapt your template to have any document content parsed with textile : <textile>[*content*]</textile>.
It will work with whatever TV or field you choose to use textile with (It works for me but please Jeff, correct any of this if it's inaccurate). Still have to test the full syntax though. But so far, no problem whatsovever.
|
|
|
|
« Last Edit: Feb 27, 2006, 04:03 AM by davidm »
|
Logged
|
|
|
|
Berlueur
Jr. Member

Posts: 12
I love MODx!
|
 |
« Reply #14 on: Feb 27, 2006, 11:20 AM » |
|
Doh... I didn't think of turning off FCKEditor... so it was encoding the brackets. Hello, I'm Berlueur and I'm a newbie... It now works! (I also had to follow your advice of creating the plugin in the Manager; simply dropping the .tpl file didn't work.) Thank you. Added bonus: my oh-so-very-complex Markdown plugin also works! Yippee! My first MODx plugin! (Ha...)
|
|
|
|
« Last Edit: Feb 27, 2006, 11:27 AM by Berlueur »
|
Logged
|
|
|
|
|