This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
bb-ruby / README.markdown
| 7337937b » | cpjolicoeur | 2008-06-03 | 1 | # bb-ruby | |
| 2 | |||||
| 83c2a0c4 » | cpjolicoeur | 2008-06-27 | 3 | bb-ruby is a [BBCode](http://www.bbcode.org) implementation for Ruby. | |
| 4 | |||||
| 5 | It will convert strings with BBCode markup to their HTML equivalent. | ||||
| 7337937b » | cpjolicoeur | 2008-06-03 | 6 | ||
| 7a0638a8 » | ferblape | 2008-08-20 | 7 | This version is a fork from original [bb-ruby](git://github.com/cpjolicoeur/bb-ruby) for adding support | |
| 7ffd27bb » | ferblape | 2008-08-22 | 8 | to the [BBCode version of PphpBB forums](http://www.phpbb.com/community/faq.php?mode=bbcode), that adds some tag ids inside of each tag. For example: | |
| 7a0638a8 » | ferblape | 2008-08-20 | 9 | ||
| 10 | `[b:2131ds]some text[/b:2131ds]` | ||||
| 11 | |||||
| 7ffd27bb » | ferblape | 2008-08-22 | 12 | I have been adding too another special features, like redefinition of the HTML that each BBCode tag should be translated to. | |
| 13 | |||||
| 14 | |||||
| c61f3ea9 » | cpjolicoeur | 2008-06-27 | 15 | ## Installation | |
| 16 | |||||
| 17 | To install as a plugin: | ||||
| 18 | |||||
| 19 | `./script/plugin install git://github.com/cpjolicoeur/bb-ruby.git` | ||||
| 20 | |||||
| 21 | To install as a gem: | ||||
| 22 | |||||
| 517272f3 » | cpjolicoeur | 2008-06-27 | 23 | `sudo gem install cpjolicoeur-bb-ruby --source=http://gems.github.com/` | |
| c61f3ea9 » | cpjolicoeur | 2008-06-27 | 24 | ||
| 7ffd27bb » | ferblape | 2008-08-22 | 25 | ||
| 88adc843 » | cpjolicoeur | 2008-06-03 | 26 | ## Usage | |
| 27 | |||||
| 517272f3 » | cpjolicoeur | 2008-06-27 | 28 | `require 'bb-ruby'` (only needed if installed as a gem) | |
| 88adc843 » | cpjolicoeur | 2008-06-03 | 29 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 30 | BBRuby has been included directly into the String class for use on any string object: | |
| 17854c9f » | cpjolicoeur | 2008-06-03 | 31 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 32 | `text = "[b]Here is some bold text[/b] followed by some [u]underlined text[/u]"` | |
| 17854c9f » | cpjolicoeur | 2008-06-03 | 33 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 34 | `output = text.bbcode_to_html` | |
| 88adc843 » | cpjolicoeur | 2008-06-03 | 35 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 36 | `text.bbcode_to_html!` | |
| 17854c9f » | cpjolicoeur | 2008-06-03 | 37 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 38 | Only allow certain tags: | |
| 88adc843 » | cpjolicoeur | 2008-06-03 | 39 | ||
| 7ffd27bb » | ferblape | 2008-08-22 | 40 | `output = text.bbcode_to_html({}, :enable, :image, :bold, :quote)` | |
| 9ed03fa7 » | cpjolicoeur | 2008-06-03 | 41 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 42 | Disable certain tags: | |
| 17854c9f » | cpjolicoeur | 2008-06-03 | 43 | ||
| 7ffd27bb » | ferblape | 2008-08-22 | 44 | `output = text.bbcode_to_html({}, :disable, :image, :bold, :quote)` | |
| 17854c9f » | cpjolicoeur | 2008-06-03 | 45 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 46 | Alternative Direct usage: | |
| 9ed03fa7 » | cpjolicoeur | 2008-06-03 | 47 | ||
| 381817a7 » | cpjolicoeur | 2008-06-05 | 48 | `output = BBRuby.to_html(bbcode_markup)` | |
| 9ed03fa7 » | cpjolicoeur | 2008-06-03 | 49 | ||
| 7ffd27bb » | ferblape | 2008-08-22 | 50 | Define your own translation, in order to be more flexible: | |
| 51 | |||||
| 52 | my_blockquote = { | ||||
| 53 | 'Quote' => [ | ||||
| 54 | /\[quote(:.*)?=(.*?)\](.*?)\[\/quote\1?\]/mi, | ||||
| 55 | '<div class="quote"><p><cite>\2</cite></p><blockquote>\3</blockquote></div>', | ||||
| 56 | 'Quote with citation', | ||||
| 57 | nil, nil, | ||||
| 58 | :quote], | ||||
| 59 | } | ||||
| 60 | |||||
| 61 | text.bbcode_to_html(my_blockquote) | ||||
| 62 | |||||
| 63 | |||||
| 5147c499 » | cpjolicoeur | 2008-06-03 | 64 | ## Developers | |
| 7337937b » | cpjolicoeur | 2008-06-03 | 65 | ||
| 7a0638a8 » | ferblape | 2008-08-20 | 66 | * [Fernando Blat](http://github.com/ferblape) | |
| 7ffd27bb » | ferblape | 2008-08-22 | 67 | * [Craig P Jolicoeur](http://github.com/cpjolicoeur) | |
| 68 | |||||
| 7337937b » | cpjolicoeur | 2008-06-03 | 69 | ||
| 5147c499 » | cpjolicoeur | 2008-06-03 | 70 | ## License | |
| 7337937b » | cpjolicoeur | 2008-06-03 | 71 | ||
| 7a0638a8 » | ferblape | 2008-08-20 | 72 | Copyright (c) 2008 Craig P Jolicoeur, Fernando Blat | |
| 7337937b » | cpjolicoeur | 2008-06-03 | 73 | ||
| 74 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| 75 | of this software and associated documentation files (the "Software"), to deal | ||||
| 76 | in the Software without restriction, including without limitation the rights | ||||
| 77 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| 78 | copies of the Software, and to permit persons to whom the Software is | ||||
| 79 | furnished to do so, subject to the following conditions: | ||||
| 80 | |||||
| 81 | The above copyright notice and this permission notice shall be included in | ||||
| 82 | all copies or substantial portions of the Software. | ||||
| 83 | |||||
| 84 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| 85 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| 86 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| 87 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| 88 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| 89 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
| 90 | THE SOFTWARE. | ||||
| b12cf539 » | cpjolicoeur | 2008-06-03 | 91 | ||
| 7ffd27bb » | ferblape | 2008-08-22 | 92 | ||
| 5147c499 » | cpjolicoeur | 2008-06-03 | 93 | ## Acknowledgements | |
| b12cf539 » | cpjolicoeur | 2008-06-03 | 94 | ||
| cf07d95d » | cpjolicoeur | 2008-06-03 | 95 | * [ruby-bbcode project](http://code.google.com/p/ruby-bbcode/) | |
| 77132187 » | cpjolicoeur | 2008-06-04 | 96 | * [Nazgum's Blog](http://www.nazgum.com/2008/01/08/bbcode-with-ruby-on-rails-part-1/) | |
| 97 | |||||
| 7ffd27bb » | ferblape | 2008-08-22 | 98 | ||
| 77132187 » | cpjolicoeur | 2008-06-04 | 99 | ## TODO | |







