Codex

What?!

A recipe that maps some html tags into BBCode.

First things first

Let's first list the tags we are about to transform into BBCode:

Name Html markup BBCode markup
Comments <!--...--> [comment] ... [/comment]
Link <a> [link] ... [/link]
Abreviation <abbr> [abbr] ... [/abbr]
Acronym <acronym> [acronym] ... [/acronym]
Address <address> [address] ... [/address]
Bold <b> [bold] ... [/bold]
Bdo - Bi Directional Orientation <bdo> [bdo] ... [/bdo]
Big Text - Big <big> [big] ... [/big]
Blockquote <blockquote> [blockquote] ... [/blockquote]
Break Row <br> [br/]
Button <button> [button] ... [/button]
Caption <caption> [caption] ... [/caption]
Cite - citation, used inline <cite> [cite] ... [/cite]
Code - surrounds a piece of computer code <code> [code] ... [/code]
Col - define attributes for a table column <col> [col] ... [/col]
Colgroup - Provides attributes for a group of columns <colgroup> [colgroup] ... [/colgroup]
Dd - Definition <dd> [description] ... [/description]
Del - Deletes a word or phrase <del> [del] ... [/del]
Dfn - Definition <dfn> [dfn] ... [/dfn]
Div - Defines a block of text <div> [div] ... [/div]
Dl - Definition list <dl> [definition] ... [/definition]
Dt - Definition terms <dt> [term] ... [[/term]
Em - Emphasis <em> [em] ... [/em]
Fieldset - Groups form related elements <fieldset> [field] ... [/field]
Form - Defines a form <form> [form] ... [/form]
H1 ... h6 - Headers <h1> ... <h6> [h1] ... [/h1]
Hr - Horizontal Line <hr> [hr/]
Italic <i> [italic] ... [/i]
Img <img> [img] ... [/img]
Input - Data entry controls <input> [input/]
Ins - Data insertion <ins> [ins] ... [/ins]
Kbd - Keyboard <kbd> [kbd] ... [/kbd]
Label <label> [label] ... [/label]
Legend - Defines a title for fieldset <legend> [legend] ... [/legend]
Li - List item <li> [li] ... [/li]
Ol - Ordered list <ol> [ol] ... [/ol]
Optgroup - Groups options in a drop-down list <optgroup> [optgroup] ... [/optgroup]
Option - Select list item <option> [option] ... [/option]
P - Paragraph <p> [p] ... [/p]
Pre - Preformatted text <pre> [pre] ... [/pre]
Q <q> [q] ... [/q]
S - Strike a word or phrase <s> [s] ... [/s]
Select - A drop down list <select> [select] ... [/select]
Small - Small text <small> [small] ... [/small]
Span - <span> [span] ... [/span]
Strike <strike> [strike] ... [/strike]
Strong - Emphasised text <strong> [strong] ... [/strong]
Style <style> [style] ... [/style]
Sub - Subscripted text <sub> [sub] ... [/sub]
Sup - Superscripted text <sup> [sup] ... [/sup]
Table <table> [table] ... [/table]
Tbody <tbody> [tbody] ... [/tbody]
Td - Table cell <td> [td] ... [/td]
Tfoot <tfoot> [tfoot] ... [/tfoot]
Th - Table header cell <th> [th] ... [/]
Thead <thead> [thead] ... [/thead]
Tr - Table row <tr> [tr] ... [/tr]
Underlined <u> [u] ... [/u]
Ul - Unordered list <ul> [ul] ... [/ul]
Var - Surround a variable <var> [var] ... [/var]
HTML 5 - Elements
Article <article> [article] ... [/article]
Aside <aside> [aside] ... [/aside]
Audio <audio> [audio] ... [/audio]
Bdi <bdi> [bdi] ... [/bdi]
Canvas <canvas> [canvas] ... [/canvas]
Command <command> [command] ... [/command]
Datalist <datalist> [datalist] ... [/datalist]
Details <details> [details] ... [/details]
Embed <embed> [embed] ... [/embed]
Figcaption <figcaption> [figcaption] ... [/figcaption]
Figure <figure> [figure] ... [/figure]
Footer <footer> [footer] ... [/footer]
Header <header> [header] ... [/header]
Hgroup <hgroup> [hgroup]...[/hgroup]
Keygen <keygen> [keygen] ... [/keygen]
Mark <mark> [mark] ... [/mark]
Meter <meter> [meter] ... [/meter]
Nav <nav> [nav] ... [/nav]
Output <output> [output] ... [/output]
Progress <progress> [progress] ... [/progress]
Rp <rp> [rp] ... [/rp]
Rt <rt> [rt] ... [/rt]
Ruby <ruby> [ruby] ... [/ruby]
Section <section> [section] ... [/section]
Source <source> [source] ... [/source]
Summary <summary> [summary] ... [/summary]
Time <time> [time] ... [/time]
Track <track> [track] ... [/track]
Video <video> [video] ... [/video]
Wbr <wbr> [wbr/]

Huge list!

Sandbox

[time] 1234567890 [/time]

[comment] Etiam nec iaculis risus. [strong]Vestibulum[/strong] porttitor [sub]elementum[/sub] [sup]lectus[/sup], [b][i]vulputate[/i][/b] gravida enim volutpat vel. [hr/]Phasellus in enim turpis, quis hendrerit est. Aenean luctus sodales purus ac pulvinar. Nulla in velit ipsum. Curabitur tempor sodales metus vitae ornare. [/comment]

[block style="border:1px solid red"] Lorem ipsum dolor sit amet, [span color=red]consectetur[/span] adipiscing [link ref="http://cnn.com&google.com/search?q=tulips" id=legit class=pill]elit[/link]. Ut sit amet tristique elit.[br/] Etiam pellentesque [wbr/]dolor sed urna interdum sed scelerisque enim [wbr/] rutrum. Proin at lacus id libero malesuada feugiat. [/block]

[video width="320" height="240" controls="controls"] [source src="trailer.mp4" type="video/mp4" /] [source src="trailer.ogg" type="video/ogg" /] [source src="trailer.webm" type="video/webm" /] [/video]

[audio controls="controls" height="50px" width="100px"] [source src="som.mp3" type="audio/mpeg" /] [source src="som.ogg" type="audio/ogg" /] [/audio]

[table border="1"] [colgroup] [col span="2" style="background-color:red" /] [col style="background-color:yellow" /] [/colgroup> [thead] [tr] [th]Narcissus abscissus[/th] [th]Narcissus alpestris[/th] [th]Narcissus assoanus[/th] [/tr] [/thead] [tfoot] [tr] [td]Narcissus asturiensis[/td] [td]Narcissus atlanticus[/td] [td]Narcissus aureus[/td] [/tr] [tfoot] [tbody] [tr] [td]Narcissus barlae[/td] [td]Narcissus bertolonii[/td] [td]Narcissus bicolor[/td] [/tr] [tr] [td]Narcissus broussonetii[/td] [td]Narcissus bulbocodium[/td] [td]Narcissus calcicola[/td] [/tr] [/tbody] [/table]

[nav] [ul class=til] [li]limes[/li] [li]lemons[/li] [li]oranges[/li] [li]tangerine[/li] [/ul] [/nav]

[ol class=til] [li]limes[/li] [li]lemons[/li] [li]oranges[/li] [li]tangerine[/li] [/ol]

[p id=lumix class=lupi] Sed enim [s]dui[/s], [strike]dignissim[/strike] sit amet blandit id, aliquet at diam. Aenean a elit et augue rutrum imperdiet eleifend ac lorem.

[q]Praesent molestie enim nec tellus scelerisque non laoreet augue tempus. Praesent tristique posuere turpis fringilla commodo. Ut at dapibus purus. [/q]

Pellentesque lobortis rhoncus justo at cursus. Duis sed dui vel nulla aliquet placerat ut sit amet tortor. In hac habitasse platea dictumst. Praesent pretium consequat odio, in placerat tellus feugiat in. Cras sit amet tristique turpis. Duis tempor ipsum nec dui semper imperdiet. Ut fringilla egestas egestas. [/p]