Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008 edited
     

    This test suite uses (almost) all BBCode tags supported by Drupal's BBCode module - as you can see, BBCodeParser doesn't do too badly at all.

    Normal text formatting:

    Test bold text
    Test italic text
    Test underlined text
    Test strikeout text
    Test subscript text - H2O
    Test superscript text - X3

    Font colors:

    Test blue text
    Test red text
    Test green text
    Test #eeff00 text

    Font sizes:

    Test 1px - too small, normalized to 6px
    Test 12px text
    Test 24px text
    Test 100px - too big, normalized to 48px

    Font faces:

    Test Arial typeface text
    Test Arial typeface text
    Test Courier typeface text
    Test Courier New typeface text
    Test Impact typeface text
    Test Helvetica typeface text
    Test Times New Roman typeface text
    Test Verdana typeface text

    Text alignment:

    Left hand side of the screen

    Right hand side of the screen

    Centered

    This paragraph is justified on both sided on the page. By default most browsers render text with a jagged right edge. If you want all text rendered like in a book with an even right edge - use the justify tag.

    Left hand side of the screen

    Right hand side of the screen

    Centered

    This paragraph is justified on both sided on the page. By default most browsers render text with a jagged right edge. If you want all text rendered like in a book with an even right edge - use the justify tag.

    Left hand side of the screen

    Right hand side of the screen

    Centered

    This paragraph is justified on both sided on the page. By default most browsers render text with a jagged right edge. If you want all text rendered like in a book with an even right edge - use the justify tag.

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008
     

    Images:

    Normal image:

    Float image right:

    Image with ALT description:
    The

    Re-sized image:

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008 edited
     

    Let's test some URLs:

    208.77.188.166
    208.77.188.166

    208.77.188.166
    [ url]208.77.188.166[/url]

    http://208.77.188.166/
    http://208.77.188.166/

    ftp://208.77.188.166/
    ftp://208.77.188.166/

    http://localhost/
    http://localhost/

    www.example.com
    www.example.com

    ftp.example.com
    ftp.example.com

    http://example.com/~user/,part,of,url
    http://example.com/~user/,part,of,url

    ftp://example.com:8080/
    ftp://example.com:8080/

    http://example.com/
    [ url]http://example.com/[/url]

    Example URL
    [ url=http://example.com/?q=a+b&z=c]Example URL[/url]

    Anchor (bookmark you can link to):
    [anchor=TEST]URL Anchor[/anchor]
    [ anchor=TEST]URL Anchor[/anchor]

    Some URL's within a sentence: http://url1.com; www.url2.com, (www.url3.com) and www.url4.com. And some more: ftp://url5.com/, (ftp.url6.com/) and ftp.url7.com.
    http://url1.com; www.url2.com, (www.url3.com) and www.url4.com. And some more: ftp://url5.com/, (ftp.url6.com/) and ftp.url7.com

    Google link: [google]BBCode[/google]
    [ google]BBCode[/google]

    Wikipedia link: [wikipedia]BBCode[/wikipedia]
    [ wikipedia]BBCode[/wikipedia]

    Let's test some E-mail addresses:

    email@example.com
    email@example.com

    email@server1.example.com
    email@server1.example.com

    email@example.com
    [ email]email@example.com[/email]

    Email Example
    [ email=email@example.com]Email Example[/email]

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008 edited
     

    Test headings:

    Level 1 Heading

    Level 2 Heading

    Level 3 Heading

    Level 4 Heading

    Test acronyms and abbreviations:

    Abbreviations:
    API
    CMS
    WWW
    1 inch

    Acronyms:
    SQL
    GIF
    radar

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008
     

    Code blocks:

    A normal block of code - check space and return formatting in conjunction with the AutoP and SoftWrap extensions:

    Just testing New line New paragraph three spaces before this paragraph Three carriage returns before this line Four before this - a very long single line (paragraph): Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam consequat commodo libero. Curabitur volutpat, erat at vulputate posuere, arcu mauris sodales enim, a ultrices lectus neque eu odio. Donec ac lectus vitae augue blandit malesuada. Morbi sodales suscipit urna. Integer porta vulputate magna. Sed rhoncus tempor sem. Donec commodo dignissim pede. Donec nibh mi, egestas vitae, semper eget, vestibulum in, urna. Maecenas commodo. Curabitur congue porta sapien. Aenean suscipit, risus non dignissim accumsan, erat nunc mollis felis, eu condimentum pede felis eget odio. Integer ultrices, magna id bibendum lobortis, nulla nulla lacinia nisi, vitae vulputate dolor pede id lacus. Etiam scelerisque ultricies erat. A very long single "word": http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&location=http://www.amazon.co.uk/Disney-Classics-Animals/dp/B000DN5UV8?ie=UTF8&s=dvd&qid=1173748176&sr=1-4&tag=moma-21&linkCode=ur2&camp=1634&creative=6738

    An
    inline code

    block

    Color highlighted PHP code block:
    [php]
    <?php
    echo "Sample PHP code";
    ?>
    [/php]

    Test notag:
    [notag]These BBCode tags are not converted to HTML![/notag]
    [notag]I'm happy[/notag]

    <?php /* Extension Name: AutoP Extension Url: http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=235 Description: Automatically formats paragraphs and new lines using valid XHTML. Version: v5 Author: Luke "[-Stash-]" Scammell Author Url: http://scammell.co.uk */ class AutoPFormatter extends StringFormatter { function Parse($String, $Object, $FormatPurpose) { if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) { $String = $this->wpautop($String); } return $String; } function wpautop($pee, $br = 1) { $pee = $pee . "n"; // just to make things a little easier, pad the end $pee = preg_replace('|<br />s*<br />|', "nn", $pee); // Space things out a little /* Add these to the end? |code|cite|script|object|embed|param */ $allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)'; $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "n$1", $pee); $pee = preg_replace('!(</' . $allblocks . '>)!', "$1nn", $pee); $pee = str_replace(array("rn", "r"), "n", $pee); // cross-platform newlines $pee = preg_replace("/nn+/", "nn", $pee); // take care of duplicates $pee = preg_replace('/n?(.+?)(?:ns*n|z)/s', "<p>$1</p>n", $pee); // make paragraphs, including one at the end $pee = preg_replace('|<p>s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace $pee = preg_replace('!<p>([^<]+)s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee); $pee = preg_replace( '|<p>|', "$1<p>", $pee ); $pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee); // don't pee all over a tag $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee); $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee); $pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee); $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee); if ($br) { $pee = preg_replace('/<(script|style).*?</\1>/se', 'str_replace("n", "<WPPreserveNewline />", "\0")', $pee); $pee = preg_replace('|(?<!<br />)s*n|', "<br />n", $pee); // optionally make line breaks $pee = str_replace('<WPPreserveNewline />', "n", $pee); } $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*<br />!', "$1", $pee); /* Add these to the end? |code|cite */ $pee = preg_replace('!<br />(s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee); /* Replace the below */ /*if (strpos($pee, '<pre') !== false) $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); $pee = preg_replace( "|n</p>$|", '</p>', $pee );*/ if (strpos($pee, '<pre') !== false) $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(str_replace('</p>', '', str_replace('<p>', "n", str_replace('<br />', '', '$2')))) . '</pre>' ", $pee); $pee = preg_replace( "|n</p>$|", '</p>', $pee ); if (strpos($pee, '<code') !== false) $pee = preg_replace('!(<code.*?>)(.*?)</code>!ise', " stripslashes('$1') . stripslashes(str_replace('</p>', '', str_replace('<p>', "n", str_replace('<br />', '', '$2')))) . '</code>' ", $pee); $pee = preg_replace( "|n</p>$|", '</p>', $pee ); return $pee; } } // Instantiate the formatter and add it to the context object's string manipulator $AutoPFormatter = $Context->ObjectFactory->NewObject($Context, "AutoPFormatter"); $Context->StringManipulator->AddGlobalManipulator("AutoPFormatter", $AutoPFormatter); ?>
    • CommentAuthorLuke
    • CommentTimeMar 15th 2008
     

    Quoting

    A simple quote:

    This is a quoted message

    Quote with source:

    This is a quoted message

    Nested quotes:

    Gabor

    This is a quoted message

    This is a nested quote

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008
     

    Lists

    A normal list (circular bullets, same as ulist=c):

    • x
    • y
    • z

    List with discs (ulist=d):

    • x
    • y
    • z

    List with squares (ulist=s):

    • x
    • y
    • z

    A normal list (circular bullets, same as ulist=circle):

    • x
    • y
    • z

    List with discs (ulist=disc):

    • x
    • y
    • z

    List with squares (ulist=square):

    • x
    • y
    • z

    Numeric list (list=1):

    1. x
    2. y
    3. z

    Roman lowercase list (list=i):

    1. x
    2. y
    3. z

    Roman uppercase list (list=I):

    1. x
    2. y
    3. z

    Alfa lowercase list (list=a):

    1. x
    2. y
    3. z

    Alfa uppercase list (list=A):

    1. x
    2. y
    3. z

    A nested list:

    1. x
      1. x.1
      2. x.2
    2. y
    3. z
    • CommentAuthorLuke
    • CommentTimeMar 15th 2008
     

    Table tags

    [table]
    [row]
    [col]row1col1[/col]
    [col]row1col2[/col]
    [/row]
    [row]
    [col]row2col1[/col]
    [col]row2col2[/col]
    [/row]
    [/table]

    [table]
    [r]
    [c]row1col1[/c]
    [c]row1col2[/c]
    [/r]
    [r]
    [c]row2col1[/col]
    [c]row2col2[/col]
    [/r]
    [/table]

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008
     

    Other tags

    Test marquee:
    [move]Move tag - creates a scrolling display[/move]

    Horizontal delimiter:


    Force line break:
    --&gt;
    &lt;--

    Force space:
    --&gt;[sp]&lt;--

    Test tag nesting:

    large red text
    again - large red test with different tag order

    Test multi-line tags:



    test

    Some broken tags

    We need to ensure that bad formatting will not disrupt your site's HTML.

    Broken bold text...

    1. A broken list...

      A broken quote...

    • CommentAuthorLuke
    • CommentTimeMar 15th 2008
     

    Javascript stripped out?

    white red

    [ color=white'onmouseover='javascript:alert(1);]white[/color] [ color=red]red[/color]