DISQUS

Huddled Masses: Textile Plugin 2.6 released

  • Patrick Lawrence · 4 years ago
    Hello,

    I installed your textile 2.6 plugin and like it so far. However, I've got a problem with inserting Amazon images. I've got a code snipet like this:

    !1!:2

    [1] http://images.amazon.com/images/P/B000AJJNFE.01...
    [2] http://www.amazon.com/gp/redirect.html..blah..b...>

    < < snip >>
    The result is that the serial number in the first link gets screwed up by textile and turned into an < em > block, and nothing works after that.

    In your Flickr example, I would expect the same behavior with the underscores becoming blocks. Got any idea what's going on?
  • Jaykul · 4 years ago
    Well, the simplest answer to Patrick's problem is to change the _ to a &#95; which textile will pretty much ignore, but which will render properly in the image.

    The complicated answer is that you should go to http://textism.com/tools/textile/ and post a bug to Dean ;)
  • asd · 4 years ago
    textile2.6 cannot supoort chinese character
    when i put star around chinese word(ex: *a?????* )
    it has no effect
  • Kerim Friedman · 3 years ago
    This plugin produces invalid HTML when used with blockquote, as discussed in this WordPress Support Forum thread. Basically, it should not wrap the tag inside tags, since it ends up overlapping tags if there are multiple paragraphs inside the blockquote. You end up with: !!! It would be great if this could be fixed, since some people on a group blog I manage depend on your plugin!
  • Kerim Friedman · 3 years ago
    Ugh. That didn't come out right:

    No This plugin produces invalid HTML when used with blockquote, as discussed inthis WordPress Support Forum thread:

    http://wordpress.org/support/topic/19587

    Basically, it should not wrap the blockquote tag inside p tags, since it ends up overlapping tags if there are multiple paragraphs inside the blockquote. You end up with: p-blockquote-/p!!! It would be great if this could be fixed, since some people on a group blog I manage depend on your plugin!
  • Jaykul · 3 years ago
    If you're using textile ... you should be using "bq. " at the begginning of the line for blockquotes, not the @blockquote@ tag ...

    You *can* use xhtml while using textile, but you need to take into account that you *are* using textile. Which is to say: if you leave a blank line, textile is going to start a new paragraph for you, unless you're in a @notextile@ block -- which does weird things converting everything to code blocks-- so to accommodate the fact that your are using textile, you need to put a leading space on the line if you're starting a block-level xhtml tag after blank lines ... or use textile markup.

    bq. For example, this blockquote was put in using the bq. textile markup.
    It breaks on lines like a @pre@ section, but you can use XHTML inside it, or the usual textile markup.

    Now, here's some normal text, and we'll break for a new paragraph.

    Lastly, I've got a simple @blockquote@ tag with a space in front of it ...

    This is that simple @blockquote@ tag with a space in front of it that they mentioned in the "textpattern wiki":http://textpattern.net/wiki/index.php?title=Troubleshooting_Common_XHTML_Validation_Issues_in_a_Textpattern_Site#Block_Elements_Wrapped_by_Paragraph_Elements.
    Again, you can use textile markup or XHTML...


    So, I guess I'm not sure what else to say.
  • Clemens · 3 years ago
    as far as i can see, textile2.6beauty breaks the more-teaser-separator by enclosing it in del-tags. probably breaks other html comments, too. in the preq in function span (line 508 in my version), i replaced
    ($f)
    with
    (?&lt;!&lt;!-)($f)
  • Jaykul · 3 years ago
    Hmm... it should leave html alone, I'll have to check that one out.
  • Nick Curry · 3 years ago
    it seems the img tag gets garbled if an alignement = indicator is added. To fix, replace image and fImage functions with the following:

    // -------------------------------------------------------------
    function image($text)
    {
    return preg_replace_callback("/
    \! # opening !
    #REPLACE THIS
    #(\)?
    #WITH THIS:
    ($this->hlgn) # optional alignment atts
    ($this->c) # optional style,class atts
    (?:\. )? # optional dot-space
    ([^\s(!]+) # presume this is the src
    \s? # optional space
    (?:\(([^\)]+)\))? # optional title
    \! # closing
    (?::(\S+))? # optional href
    (?=\s|$) # lookahead: space or end of string
    /Ux", array(&$this, "fImage"), $text);
    }

    // -------------------------------------------------------------
    function fImage($m)
    {
    //$this->dump($m);

    list(, $algn, $atts, $url) = $m;
    $atts = $this->pba($atts);
    /*
    REPLACE THIS
    $atts .= ($algn != '') ? ' align="' . $this->iAlign($algn) . '"' : '';
    WITH THIS:
    */
    $atts .= (isset($m[1])) ? ' align="' . $this->iAlign($m[1]) . '"' : 'ALIGNNOTFOUND-m0='.$m[1];

    $atts .= (isset($m[4])) ? ' title="' . $m[4] . '"' : '';
    $atts .= (isset($m[4])) ? ' alt="' . $m[4] . '"' : ' alt=""';
    $size = @getimagesize($url);
    if ($size) $atts .= " $size[3]";

    $href = (isset($m[5])) ? $this->checkRefs($m[5]) : '';
    $url = $this->checkRefs($url);
    $out = array(
    ($href) ? '' : '',
    '',
    ($href) ? '' : ''
    );

    return join('',$out);
    }


    // -------------------------------------------------------------

    I hope this helps...
  • Nick Curry · 3 years ago
    hmmm, looks like the textile plugin garbled the above... the important bits are

    #REPLACE THIS
    #(\)?
    #WITH THIS:

    and

    /*
    REPLACE THIS
    ==$atts .= ($algn != a??a??) ? a?? align=a??a?? . $this->iAlign($algn) . a??a??a?? : a??a??;==
    WITH THIS:

    */
    ==$atts .= (isset($m[1])) ? ' align="' . $this->iAlign($m[1]) . '"' : '';==
  • Michael · 3 years ago
    Great plugin. I have been using it for a couple of weeks, and now I can't live without it. Keep up the good work :-)
  • Jim Jeffers · 3 years ago
    Hey, when I use the 2.6b.php file the geshi code still gets turned into html. Any advice? Checkout "my page":http://www.donttrustthisguy.com/2005/12/29/transition-to-dreamhost/ to see what I mean.
  • Jaykul · 3 years ago
    The trick is the priority you assign to the plugins... for instance, if you look at my "geshi plugin":http://www.huddledmasses.org/wp-content/plugins/source.php?file=geshi_plugin.php, you'll see I have it set to priority 5 (the priority is the last number in the @add_filter('the_content', 'GeshiSyntaxColorer', 5);@ command at the bottom of the file. And if you check my "textile 2.6":http://www.huddledmasses.org/wp-content/plugins/source.php?file=textile2.6b.php plugin, you'll see that I've set it to priority 6. This way seems to work for me ;)
  • Kyle Rove · 3 years ago
    I have found that punctuation after an abbreviation (i.e. ... USA(United States of America), ... rest of my sentence) does not properly convert the textile markup to the abbr html element. Any possibility of fixing this?
  • Kyle Rove · 3 years ago
    never mind.... I guess it does here... :-p
  • DocGuy · 3 years ago
    I'm wondering if in a future release you might consider allowing people to turn this off in WordPress on a post-by-post basis. Maybe there could be a custom field or something that allows you to turn off Textile for a specific post.

    I'm having trouble with WP2.0 putting double spaces between lines because I'm using the WP2.0 rich text editor. Is there something I should be doing to make it work with WP2.0?
  • Jaykul · 3 years ago
    There's a "TextControl plugin":http://dev.wp-plugins.org/wiki/TextControl that allows switching post-processors per-post ... I'm not really planning on supporting that here ... Honestly, if you're using the rich-text editor, I don't see any reason to use Textile on those posts, and I'm frankly rather frustrated with Matt and the WordPress team for putting the rich text editor in as default even though people are using Textile and Markdown and others -- and can't disable them, because the original WordPress design for these plugins was that they should leave the unprocessed text in the database.
  • Jeremy · 3 years ago
    Great plugin, I love it!!!

    I'm trying to push it a little further, to use it in titles and meta fields, and here's where I'm running into a problem:

    Is there a way to keep Textile from adding p tags when the content is only one line long? Then I can hard-code a field to be a header, for example, without getting a nested p tag...

    Any help you could offer would be appreciated.

    Thanks!
    -Jeremy
  • Arne · 3 years ago
    hi there,

    is there any chance to use the plugin without harming the function allowed_tags() (used in comments.php to show what html tags are allowed)? whenever i active the textile plugin, it strips away allowed_tags' output.
  • Arne · 3 years ago
    and another problem here... the contact form plugin doesnt work, also because of textile. isnt there a notextile-tag like in txp?
  • Jaykul · 3 years ago
    Jeremy: That's a good question. I'm not 100% sure if this will do what you want, but you can try using the 'lite' version... You will see on lines 992-995 the function @textile@ which calls @TextileThis@, and passes only one parameter. Make yourself a copy, call it @textileLite@ and change the call to @return $textile->TextileThis($string, true);@ ... then, in your @add_filter@ calls, use @textileLite@ instead of @textile@.

    Arne: Look at the bottom of the file. Line 1008.
    Arne: Contact form plugin? It must be (inappropriately) calling a filter for 'the_content', 'the_excerpt', or 'comment_text' ...
  • Arne · 3 years ago
    thx, commenting out these two lines did it for me :-)
    @contact form plugin: well, i dont know anything about wp's plugin structure, so i dont know in which way i could change the plugin. i only can see that you're right: it's calling a filter for "the_content".

    thats the plugin: http://johannesries.de/webwork/contactform/
  • Whisper · 3 years ago
    I installed your plugin on one of my blogs that I share with some family members. After they played with it and decided they would rather just use the rich text editor I uninstalled it (deactivated it and deleted the file) Now I have a problem. The rich text editor is gone, everyone has the option enabled in their profile, it's also enabled on the Options page, but it will not load on the "Write" pages. I have looked everywhere I can think of even in the DB and cleared my cache folder too. I cannot find whats causing this and the last thing that happened right before it disappeared was the instalation of Textile. Can you help me please :)

    BTW I do have this installed on MY blog and I *LOVE* it thank you so much. Though I wish I could get mine to work with Geshi like you did, but no biggie I would so rather have Textile than Geshi. Beautiful plugin now if only my family would understand how nice it is :P
  • Whisper · 3 years ago
    I must sincerely appologize. It was not Textile at all that was messing with TinyMCE it was in fact another plugin. Apparently it took it a little while to kick in though __sigh__ . I am so sorry for my assumption. So the TinyMCE problem is solved ;) again I'm sorry.
  • Whisper · 3 years ago
    OK I hate being annoying but after very close look at the files (textile2b and geshi) I found out why it wasn't working.

    In your textile2b file it says this around line 812:
    @/* when using a code beautifire, we don't want this between code tags - Joel
    NOTICE: this will (still) break if you use both: */
    $offtags = ('pre.*|kbd.*|notextile');@

    and in the geshi file (geshi.php) around line 116:
    @ var $header_type = GESHI_HEADER_PRE; // The type of header to use@

    That variable needs to be set to GESHI_HEADER_DIV *knocks self on head*
    I can't believe how long it was staring at me. Geshi was putting pre inside the within code so it was breaking it. So yeah this will fix the problem for those that wanna use Geshi ;)


    (BTW you can delete my previous posts I won't be offended and this little aside too :* )
  • Jim · 3 years ago
    I love this plugin, but I've discovered that this recent version breaks the WordPress ability to use quicktags. Do you have a workaround solution for this?
  • Jaykul · 3 years ago
    What on earth do you mean? The quicktags are just little javascripts that insert html tags. There's nothing in Textile that affects them ... in fact, I just tried it and they work fine. Or are you talking about tags in the COMMENTS? They're disabled by default, but you can see in the comments above how to to enable them again.
  • Jim · 3 years ago
    I have a contact form plugin that I use. The plugin requires a quicktag (==<!--contactform-->==) to be inserted into a page in order for the contact form to appear. When I upgraded from Textile1 to Textile2, my quicktags suddenly stopped working. I even turned Textile2 off for a moment to verify that it was, indeed, the thing that was breaking the quicktags. The nearest I can figure is that Textile sees the dashes before and after the quicktag and tries to convert them into formatted text.
  • Jim · 3 years ago
    Hmm, and I'm noticing that it did it here, as well - removed the
  • Jim · 3 years ago
    left arrow, exclamation point, dash, dash from the left side and one dash from the right side of the quicktag, which essentially renders it useless. I had the same problem when testing it on the textism site. Dunno if it's something I'm doing wrong or a bug in the system.... Any help you can provide would be greatly appreciated. You can see what it's doing to my contact form here.
  • PA?l DegerstrA?m · 3 years ago
    When doing this:

    ==
    * "Some text":http://www.example.com
    Text on a new line.
    * "Some more text":http://www.foo.bar
    More text on a new line
    ==

    the list isn't closed (the last and are missing). It seems having text on a separate line (using double space after the link) breaks something. Is this something you can fix?

    Thanks for a great plugin!
  • Paul · 3 years ago
    Questions: I started using the latest Textile 2 plugin and then started using FeedBurner so I could publish summaries of the weblog entries on another site. FeedBurner is including the Textile markup in the feed data. I'm guessing this is because WP 2 is responding to feed requests straight from the database so the markup never goes through the textile plugin to get converted on its way to FeedBurner. Is this right? If so, is there a way to fix it?
  • Jaykul · 3 years ago
    PA?l: You should probably submit that to the author of textile itself, through his testing and bug-reporting page, "here":http://www.textism.com/tools/textile/.

    Paul: You *can* parse your feeds (I just don't think RSS should have HTML embedded in it). Just uncomment the next-to-last line in the plugin: @// add_filter('the_excerpt_rss', 'textile', 6);@ (that is, delete the slashes at the front so it just looks like: @add_filter('the_excerpt_rss', 'textile', 6);@).
  • Paul · 3 years ago
    Thanks. I finally figured out that the marked up text that was showing up in the feed was coming from text in the WP2 "excerpt" entry area. I don't remember putting it there, but there it was anyway. I removed that (which as I understand was overriding what WP2 would normally provide the feed as a post excerpt) and things are back to normal. I agree with you about HTML not being in RSS. I was confused about where the markup was coming from and just figured that WP2 normally stripped the HTML out but didn't recognize the textile markup as such and left it alone. Anyway, thanks for the quick reply (and the plugin!) -- much appreciated.
  • Matt · 3 years ago
    I installed your plugin - thanks, I love Textile2! I got fed up with the default WordPress editor because it kept messing up my pre tags, and now I'm glad I started looking for a replacement. This is a much more sensible way to create content than hand-coding HTML! :-)
  • PA?l DegerstrA?m · 3 years ago
    @Jaykul: Thanks, I will.
  • Jon Zuck · 3 years ago
    I'm having trouble with Textile plugins since I upgraded to WordPress 2.0.3. It seems all the plugins, (including 2.6) seem to start all posts with two beginning paragraph tags, and end with two closing p tags. This is driving me crazy. Am I doing something wrong? Please help. Thanks
  • Jon Zuck · 3 years ago
    Disregard my last post... I got that problem fixed. I REALLY like Textile 2.6, but there's just one thing that's not working for me. I give my external links a class, e.g.

    "(ext)This link":http://thislink.com

    Textile 2.6 seems to recognize classes on spans and block-level elements only. Is there any way I can get it to recognize classes on my links? Thanks for your help.
  • Jon Boyd · 3 years ago
    I also have a problem, which I've noticed only since WP 2.0.3 (so it's easy to blame the upgrade): editing a comment with single quotes in it turns the single quotes into backslash-single-quotes. (That is, \' )

    Submitting the original comment works fine, and they work fine in posts -- it's only when editing a comment that this seems to happen.

    Can you advise us whether this is a bug in WP or in Textile 2.6 Beta?
  • Rocky Davidson · 3 years ago
    I just installed textile. I guess I just don't get it. Nothing appears different in my editing box. What am I supposed to see. I have not found any installation instructions. Maybe I am missing something.
  • g · 3 years ago
    Man! I love you!!! Textules!!!!!

    sorty, meant to say Textile Rules!!!!!!!!
  • Jeremy Helms · 2 years ago
    bq. You *can* use xhtml while using textile, but you need to take into account that you *are* using textile. Which is to say: if you leave a blank line, textile is going to start a new paragraph for you...

    For those who aren't familiar with authoring WordPress plugins, you can easily alter the main textile() function [which WordPress calls for rendering text into textile output] so that it will not take action unless the post being displayed has a custom field value specifying to do so.

    Simply replace the textile() function inside textileWrapperForWordPress.php with the following code block. Then, for the posts you want to be rendered with textile, you'll need a custom field named "mime_type" that has the value of "textile" and _viola_, you've got textile output for that post only and your other posts aren't affected.



    function textile( $string='' ) {
    global $post;
    $mime = get_post_meta($post->ID, 'mime_type', true);

    if (isset($mime) && $mime == 'textile') :
    $textile = new Textile;
    return $textile->TextileThis($string, false, false, false, false);
    else :
    return $string;
    endif;
    }