BBCode: Difference between revisions

From BakaBT Wiki
Jump to navigation Jump to search
Line 19: Line 19:
==Links==
==Links==
First of all, all words that look like links will be replaced with a link. Words that look like links are words that begin with "http://".
First of all, all words that look like links will be replaced with a link. Words that look like links are words that begin with "http://".
  <nowiki>[url]http://www.boxtorrents.com[/url]</nowiki> results in http://en.wikipedia.org/
<nowiki>http://www.boxtorrents.com</nowiki> results in [http://www.boxtorrents.com http://www.boxtorrents.com]
  <nowiki>[url]http://www.boxtorrents.com[/url]</nowiki> results in [http://www.boxtorrents.com http://www.boxtorrents.com]
  <nowiki>[url=http://www.boxtorrents.com]BoxTorrents[/url]</nowiki> results in [http://www.boxtorrents.com BoxTorrents]
  <nowiki>[url=http://www.boxtorrents.com]BoxTorrents[/url]</nowiki> results in [http://www.boxtorrents.com BoxTorrents]



Revision as of 08:06, 21 April 2009

This page will contain a list of all BBCode you can use on BoxTorrents, in the comments and in the torrent description. Keep in mind that our forum software (SMF) has it's own set of BBCode, namely the default set + spoiler tags, if you want more info on that check the SMF website.

General BBCode

All the BBCode tags in this section can be used in the comments as well as in the description

Basic MarkUp

[b] for bold text
[i] for italic (slanted) text
[u] for underlined text
[s] for striked through text
[sup] for superscript text
[sub] for subscript text
[center] for center aligned text
[color=red]text here[/color] for red text
[size=10pt]text here[/size] for bigger/smaller text

Links

First of all, all words that look like links will be replaced with a link. Words that look like links are words that begin with "http://".

http://www.boxtorrents.com results in http://www.boxtorrents.com
[url]http://www.boxtorrents.com[/url] results in http://www.boxtorrents.com
[url=http://www.boxtorrents.com]BoxTorrents[/url] results in BoxTorrents

Images

[img]http://www.boxtorrents.com/images/search.gif[/img] will result in an image

Keep in mind that all images must be uploaded to a remote image host. BoxTorrents will not host your images for you. Also, do not link to images you didn't upload yourself. So do not link images from AniDB or any other site other than your remote image host. Good free image hosts are:

Code

[code]Code here[/code] will keep the formatting of the source text, it will not add colours.

Lists

[list]
 [li]first item[/li]
 [li]second item[/li]..
[/list]

Will make a list like:

  • first item
  • second item

You can nest lists

Tables

[table]
 [tr]
  [td]first cell[/td]
  [td]second cell[/td]
 [/tr]
 [tr]
  [td]third cell[/td]
  [td]last cell[/td]
 [/tr]
[/table]

Will produce a table like:

first cell second cell
third cell last cell

Quotes

[quote]quoted text[/quote] to make a nameless quote
[quote=name]quoted text[/quote] to make a quote by 'name'
[quote author=name]quoted text[/quote] to make a quote by 'name'
[quote author=name link=link date=date]quoted text[/quote] for SMF-style quotes

Pressing the [Quote] button of a comment will automatically load that comment into your add-a-comment page. You can nest quotes.

NoParse

[noparse]don't parse this text[/noparse]

will not apply BBCode parsing to the text, it will still replace http:// links

Description-only tags

Block constructions

All websites are built by stacking 'blocks' (starting at the top left corner). Too make it easier for you to make descriptions I've added block constructors so that you can more easily align text and images without needing tables.

  • [left=300]text goes here[/left]

makes a block 300 pixels wide that 'floats' to the left. If you add another left-floating block it will appear next to it. If there is no more space on the page to put the block beside other left-floating blocks it will 'wrap' to the next line.

  • [right=300]text goes here[/left]

makes a block that 'floats' to the right. Similar to the [left] tag.

  • [clear]

ends the current line, and forces all floating blocks to start on a new line.

  • [center]

makes a block that floats in the center. You can not have two or more blocks floating in the center on the same line. Use the clear-tag to start a new line.

Screenshots

Adding these tags will not do anything to your description, instead it will add screenshots just below your description using a lightbox for easy viewing. If using HTML code, screenshot tags may be placed inside or outside the <html></html> tags, there is no difference in parsing either way.

  • [screenshot]screenshot code goes here[/screenshot]
Inserts screenshot thumbnails below the description. Thumbnails are resized to 150 pixels in width by default.
  • [screenshot=200]screenshot code goes here[/screenshot]
Inserts screenshot thumbnails 200 pixels wide below the description. Change 200 to the pixel width of your screenshot thumbnails as necessary.

You can add more than one block of screenshots, possibly with different size thumbnails.


  • [img]link to image[/img]
Will add one image. You can add as many as you like.
  • [url=link to image][img]link to thumbnail[/img][/url]
Allows you to explicitly define your own thumbnail images. If no thumbnail image is supplied it will use the linked image and resize it to whatever width is supplied for the thumbnail.

Having a lot of big images on your screen can slow down your browser, so if possible supply a thumbnail!


The following image-hosts auto-generate thumbnails for uploaded images. If images from these image-hosts are used, we can auto-detect the thumbnail links and insert them:

  • imageshack
  • photobucket
  • tinypic
  • xs

Example code 1 (thumbnails resized from screenshots)

[screenshot]
 [img]link to image1[/img]
 [img]link to image2[/img]
[/screenshot]

Use this code if your screenshots are hosted on an image-host that we can auto-detect thumbnail images for (mentioned above).

Example code 2 (thumbnails supplied by user)

[screenshot]
 [url=image link1][img]thumbnail link1[/img][/url]
 [url=image link2][img]thumbnail link2[/img][/url]
[/screenshot]

Use this code if you are not using any of the above-mentioned image-hosts and/or wish to supply your own thumbnail.

Everything aside from [img] and [url] tags in the screenshot tags will not be shown.

More about torrent descriptions

Modes

There are two modes:

  • Comment-style mode
    • Line breaks (i.e. pressing Enter) appear as new lines
    • you can use all BBCode tags, including the block constructors
  • HTML mode
    • New lines will not appear as new lines. Use
      to create a line break instead.
    • The text will be treated as HTML code.

By default, descriptions are treated in comment-style mode. To enable HTML-mode you have to include <html> and </html> tags around your description.

Comment-style mode

For all uses of BBCode in comment-style mode see the BBCode section above.

HTML Mode

In HTML mode you can do anything you want, stylesheets, JavaScript, anything. We trust users will not abuse this feature as we realize it is a potential security hazard. Abuse of HTML mode will not be tolerated. We apply a one-strike-no-warning-kiss-your-ass-goodbye policy.

Technical stuff

Additional description information

As you may have realized all descriptions get some 'added' stuff, both comment-style and HTML-style modes. The parser will add a few things to your description that you will get for free :)

  • First of all it will add a proper HTML-header if it's not present, as well as <head></head> and <body></body> tags.
  • It will add a very basic stylesheet containing some default text-formatting settings. You are free to override this stylesheet as it will be inserted before your stylesheet.
  • Finally it will add the jQuery Javascript-library and postifx a script to resize the description. I can implore anyone who uses Javascript on a regular basis to look at jQuery because it really makes your life easy.

Recalculating the size of the iframe

If you have a description that may change it's height as users view it (expanding lists for instance) you can call the

bxt_resize_iframe()

function to recalculate the size of the iframe. Make sure you call it after the new size of the description is set else it will not resize propperly.

Javascript:window.onload

I can only implore you so much to not use an onload event as there is little reason to use it. The added JavaScript-code uses the window.onload event to resize the iframe to it calculated height after all images have been loaded (this is why it needs window.onload), images may affect the height of a description.

If you do supply a window.onload event make sure you put it in your head so the resize-script can call your onload event after it's done resizing.

If you put the window.onload event in the body it will most likely overwrite the call to the resize function and you may end with a description frame that is too small or too big.

Common mistakes

  • Often people forget to include the HTML-tag for HTML description. A typical symptom is a large amount of empty lines at places you didn't expect it.
  • Using code like:
<a href="http://www.boxtorrents.com">BoxTorrents</a>

Will not make your link totally red. The catch is that the text will become red, but the underline will not. To set the colour of a link propperly either apply the style to the link itself or supply the correct colour in a stylesheet.