public
Fork of cpjolicoeur/bb-ruby
Description: BBCode implementation for Ruby
Homepage: http://github.com/cpjolicoeur/bb-ruby
Clone URL: git://github.com/ferblape/bb-ruby.git
bb-ruby / README.markdown
7337937b » cpjolicoeur 2008-06-03 added initial readme 1 # bb-ruby
2
83c2a0c4 » cpjolicoeur 2008-06-27 small readme update 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 added initial readme 6
7a0638a8 » ferblape 2008-08-20 Updating README 7 This version is a fork from original [bb-ruby](git://github.com/cpjolicoeur/bb-ruby) for adding support
7ffd27bb » ferblape 2008-08-22 Make your own patterns 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 Updating README 9
10 `[b:2131ds]some text[/b:2131ds]`
11
7ffd27bb » ferblape 2008-08-22 Make your own patterns 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 add installation instructio... 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 update README with proper g... 23 `sudo gem install cpjolicoeur-bb-ruby --source=http://gems.github.com/`
c61f3ea9 » cpjolicoeur 2008-06-27 add installation instructio... 24
7ffd27bb » ferblape 2008-08-22 Make your own patterns 25
88adc843 » cpjolicoeur 2008-06-03 update README with usage in... 26 ## Usage
27
517272f3 » cpjolicoeur 2008-06-27 update README with proper g... 28 `require 'bb-ruby'` (only needed if installed as a gem)
88adc843 » cpjolicoeur 2008-06-03 update README with usage in... 29
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 30 BBRuby has been included directly into the String class for use on any string object:
17854c9f » cpjolicoeur 2008-06-03 README cleanup 31
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 32 `text = "[b]Here is some bold text[/b] followed by some [u]underlined text[/u]"`
17854c9f » cpjolicoeur 2008-06-03 README cleanup 33
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 34 `output = text.bbcode_to_html`
88adc843 » cpjolicoeur 2008-06-03 update README with usage in... 35
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 36 `text.bbcode_to_html!`
17854c9f » cpjolicoeur 2008-06-03 README cleanup 37
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 38 Only allow certain tags:
88adc843 » cpjolicoeur 2008-06-03 update README with usage in... 39
7ffd27bb » ferblape 2008-08-22 Make your own patterns 40 `output = text.bbcode_to_html({}, :enable, :image, :bold, :quote)`
9ed03fa7 » cpjolicoeur 2008-06-03 added more test cases 41
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 42 Disable certain tags:
17854c9f » cpjolicoeur 2008-06-03 README cleanup 43
7ffd27bb » ferblape 2008-08-22 Make your own patterns 44 `output = text.bbcode_to_html({}, :disable, :image, :bold, :quote)`
17854c9f » cpjolicoeur 2008-06-03 README cleanup 45
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 46 Alternative Direct usage:
9ed03fa7 » cpjolicoeur 2008-06-03 added more test cases 47
381817a7 » cpjolicoeur 2008-06-05 update readme with instruct... 48 `output = BBRuby.to_html(bbcode_markup)`
9ed03fa7 » cpjolicoeur 2008-06-03 added more test cases 49
7ffd27bb » ferblape 2008-08-22 Make your own patterns 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 README updates 64 ## Developers
7337937b » cpjolicoeur 2008-06-03 added initial readme 65
7a0638a8 » ferblape 2008-08-20 Updating README 66 * [Fernando Blat](http://github.com/ferblape)
7ffd27bb » ferblape 2008-08-22 Make your own patterns 67 * [Craig P Jolicoeur](http://github.com/cpjolicoeur)
68
7337937b » cpjolicoeur 2008-06-03 added initial readme 69
5147c499 » cpjolicoeur 2008-06-03 README updates 70 ## License
7337937b » cpjolicoeur 2008-06-03 added initial readme 71
7a0638a8 » ferblape 2008-08-20 Updating README 72 Copyright (c) 2008 Craig P Jolicoeur, Fernando Blat
7337937b » cpjolicoeur 2008-06-03 added initial readme 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 add acknowledgement to readme 91
7ffd27bb » ferblape 2008-08-22 Make your own patterns 92
5147c499 » cpjolicoeur 2008-06-03 README updates 93 ## Acknowledgements
b12cf539 » cpjolicoeur 2008-06-03 add acknowledgement to readme 94
cf07d95d » cpjolicoeur 2008-06-03 added more BBCode tags 95 * [ruby-bbcode project](http://code.google.com/p/ruby-bbcode/)
77132187 » cpjolicoeur 2008-06-04 add TODO section to readme ... 96 * [Nazgum's Blog](http://www.nazgum.com/2008/01/08/bbcode-with-ruby-on-rails-part-1/)
97
7ffd27bb » ferblape 2008-08-22 Make your own patterns 98
77132187 » cpjolicoeur 2008-06-04 add TODO section to readme ... 99 ## TODO