• [PlugIn]Textile Plugin Beta#

  • xwisdom Reply #1, 6 years, 11 months ago

    Reply
    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?





  • afkuz Reply #2, 6 years, 11 months ago

    Reply
    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!


  • davidm Reply #3, 6 years, 5 months ago

    Reply
    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


  • gadamiak Reply #4, 6 years, 5 months ago

    Reply
    Raymond, is it possible to make it work as an editor not parser? I mean, the one that you choose in site config.


  • davidm Reply #5, 6 years, 5 months ago

    Reply
    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 :
      [list]
    • one for the admin, in textpattern we have "admin-side plugins", what we would call Modules in MODx
    [/list]

    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...


  • xwisdom Reply #6, 6 years, 5 months ago

    Reply
    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





  • gadamiak Reply #7, 6 years, 5 months ago

    Reply
    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.


  • Bravado Reply #8, 6 years, 5 months ago

    Reply
    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.


  • gadamiak Reply #9, 6 years, 5 months ago

    Reply
    Quote from: Bravado at Nov 28, 2005, 09:32 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.


  • davidm Reply #10, 6 years, 4 months ago

    Reply
    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 !