Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.


edited March 2006 in Vanilla 1.0 Help
Has anybody written a quoting extension yet? Like a button or link on a post that will quote it in the reply box at the bottom, in a format that will make it readable if text-only, or markdown, or html or whatever...


  • Quoting is really only a matter of assigning a different class to a paragraph/div and giving it a different color. It would be a simple addition, but it would be very useful.
  • edited July 2005
    How simple? I could probably do it myself with a few pointers.. And how would it work seamlessly with Text, Markdown, Html, BBCode, etc? And adding a simple div thing to format it differently won't help actually getting the quote in the message in the first place unless you copy/paste text. :)
  • edited July 2005
    Quoting should be done like so: <blockquote cite="originalPostURL"> <cite>user wrote:</cite> quoted comment goes here </blockquote> And then styles should be applied to the blockquote and cite elements in the forum stylesheet. As far as compatibility goes, I assume Markdown and BBCode would translate their syntax to this semantically correct type of markup, anyway. EDIT: Why does code enclosed in <code> tags still render in HTML mode? :( Am I being dense?
  • You have to escape your HTML for it to show the >s and the <s. - Pop your HTML in, get escaped HTML out. M.
  • I thought the point of the <code> tag was that you didn't have to escape within it?
  • Scottish, the BBcode file is incomplete, I've added some more commands to mine, if you open up extensions/bbcode.php and replace the current BBencode function with the code below - you will get more BBcode functionality.

    function BBEncode($String) { //[img] tags $String = preg_replace("/\[img\](.+?)\[\/img\]/","<img src=\"$1\" />",$String); //[url] tags $String = preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/","<a href=\"$1\" target=\"_blank\">$2</a>",$String); $String = preg_replace("/\[url\](.+?)\[\/url\]/","<a href=\"$1\" target=\"_blank\">$1</a>",$String); $String = preg_replace("/\[email\](.+?)\[\/email\]/","<a title=\"Send an Email to this address\" href=\"mailto:$1\">$1</a>",$String); // other stuff $String = preg_replace("/\[b\](.+?)\[\/b\]/","<strong>$1</strong>",$String); $String = preg_replace("/\[u\](.+?)\[\/u\]/","<span class=\"underline\">$1</span>",$String); $String = preg_replace("/\[i\](.+?)\[\/i\]/","<em>$1</em>",$String); $String = preg_replace("/\[code\](.+?)\[\/code\]/","<code>$1",$String);
    $String = preg_replace("/\[quote\](.+?)\[\/quote\]/","$1",$String);
    $String = preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/","$2",$String);
    $String = preg_replace("/\[img\](.+?)\[\/img\]/","\",$String);
    return $String;
  • Hey cool, thanks :) Still, it'd be nice to have a quote button on each post which auto-populates the reply-box with the quote.
  • definatley agree, its a key feature of messageboards which is actually worthwhile!
  • i also agree. my users are dying for this feature.
  • MarkMark Vanilla Staff
    hey stuart - want to link that extension up on the wiki?
  • edited July 2005

    You can fake it, no?

    Outbreak said:
    i also agree. my users are dying for this feature.


  • I was thinking of just a simple JS way to do this, which I thought would be feasable..

    User clicks on Quote button on certain post, that entire post is copied into the message box with needed code; blockquote, cite etc.

    Logically it should work with a little tweaking of certain things...
  • Something that needs to be taken into consideration is that we'll need some CSS to pretty it up. We could theive the CSS already used for the <code> blocks... perhaps just alter the colors? But the important question is... where does it go? Can an extension insert CSS into the default stylesheet? What if a user is running a different style? Hrmmm....
  • my feeling is that the default stylesheet should cover blockquote as it's a pretty standard piece of markup. I've altered my own local vanilla style to include this, it looks pretty much like <code> but with different colors and borders. my feeling on the second question is that theme authors should be thorough but you really can't control that, so fuck it. as long as the html is sensible there's no reason it shouldn't display reasonably on any complete style.
  • lechlech Chicagoland
    You'll also need to take into account for the text formatting that user is using, are you going to be quoting in plain text, html, markdown... ?
  • it shouldn't matter, as mentioned above, since all those parsers simply translate whatever you've written to html. so by the time it's quotable, it's HTML and nothing else.
  • lechlech Chicagoland
    Since I've been using the wiki lately, I've been finding it a breeze to mix some html in with markdown and plain text all in one shot. I think what could probably be done, is instead of having to pick between the 3 or more format types, one parser does the job for all differentiating between different markups to reach it back to output proper html.
  • edited July 2005
    Yeah, the thing is, Unipus... if you put HTML quotes into the comment input box... and the entry mode is Text... it will escape all the HTML and not render the quote properly.

    I agree with your feeling that the default stylesheet should cover it. You're right about the fact that if the HTML is sensible, it should display reasonably. Well, you can see what it does unstyled already. (Adding in <b> around the username from my previous sample code.)

    Scottish wrote:
    It looks pretty decent.
    I Maybe we pull together some CSS for Mark to put in, if he's okay with that?
  • Oh, something else I just thought of. We could link the <cite> part of it to the original post. Making the code something like: <blockquote cite="originalPostURL"> <cite><b>user</b> <a href="originalPostURL">wrote</a>:</cite> quoted comment goes here </blockquote>
  • lechlech Chicagoland
    You would need to do either 1 of 2 things in this scenario both involving JS. #1 would be grabbing the selected post text, copying it and throwing it into the add comment box. or #2 doing the same except already having the appropriate JS loaded into a quote button with the users comments preformatted within the source waiting for the copy job. Much like your markup code buttons idea. So it would need to be via source rewriting extension with JS or via pure JS.
This discussion has been closed.