rubb 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,13 @@ RuBB parses BBCode by generating a parse tree, so it is able to handle nested BB
18
18
 
19
19
  RuBB supports the following BBCode tags:
20
20
 
21
+ [h1]text/[/h1] => <h1>text</h1>
22
+ [h2]text/[/h2] => <h2>text</h2>
23
+ [h3]text/[/h3] => <h3>text</h3>
24
+ [h4]text/[/h4] => <h4>text</h4>
25
+ [h5]text/[/h5] => <h5>text</h5>
26
+ [h6]text/[/h6] => <h6>text</h6>
27
+
21
28
  [b]text[/b] => <strong>text</strong>
22
29
  [i]text[/i] => <em>text</em>
23
30
  [u]text[/u] => <ins>text</ins>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.3
1
+ 0.9.4
@@ -27,6 +27,18 @@ module RuBB
27
27
  ignore_bbcode_in_children = false
28
28
 
29
29
  node = case current_tag_name
30
+ when 'h1'
31
+ Node::Simple.new(:html_tag_name => 'h1')
32
+ when 'h2'
33
+ Node::Simple.new(:html_tag_name => 'h2')
34
+ when 'h3'
35
+ Node::Simple.new(:html_tag_name => 'h3')
36
+ when 'h4'
37
+ Node::Simple.new(:html_tag_name => 'h4')
38
+ when 'h5'
39
+ Node::Simple.new(:html_tag_name => 'h5')
40
+ when 'h6'
41
+ Node::Simple.new(:html_tag_name => 'h6')
30
42
  when 'b'
31
43
  Node::Simple.new(:html_tag_name => 'strong')
32
44
  when 'i'
@@ -110,7 +122,7 @@ module RuBB
110
122
  node << Node::Text.new(:text => match_data[0], :ignore_whitespace => true)
111
123
  else
112
124
  case tag_name
113
- when 'b', 'i', 'u', 's', 'code', 'left', 'center', 'right', 'ul', 'ol', 'table'
125
+ when 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'b', 'i', 'u', 's', 'code', 'left', 'center', 'right', 'ul', 'ol', 'table'
114
126
  node << parse(code, tag_name)
115
127
  when 'url', 'email', 'img', 'size', 'color', 'quote'
116
128
  if(tag[1] == '=' && tag.size > 2) # param is present
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rubb}
8
- s.version = "0.9.3"
8
+ s.version = "0.9.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Peter Jihoon Kim"]
12
- s.date = %q{2010-07-13}
12
+ s.date = %q{2010-08-02}
13
13
  s.description = %q{BBCode gem for Ruby that supports nested BBCode tags.}
14
14
  s.email = %q{raingrove@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -17,6 +17,42 @@ class RuBBTest < Test::Unit::TestCase
17
17
  assert_equal html, bb.bb_to_html
18
18
  end
19
19
 
20
+ def test_h1
21
+ bb = '[h1]hello[/h1]'
22
+ html = '<h1>hello</h1>'
23
+ assert_equal html, bb.bb_to_html
24
+ end
25
+
26
+ def test_h2
27
+ bb = '[h2]hello[/h2]'
28
+ html = '<h2>hello</h2>'
29
+ assert_equal html, bb.bb_to_html
30
+ end
31
+
32
+ def test_h3
33
+ bb = '[h3]hello[/h3]'
34
+ html = '<h3>hello</h3>'
35
+ assert_equal html, bb.bb_to_html
36
+ end
37
+
38
+ def test_h4
39
+ bb = '[h4]hello[/h4]'
40
+ html = '<h4>hello</h4>'
41
+ assert_equal html, bb.bb_to_html
42
+ end
43
+
44
+ def test_h5
45
+ bb = '[h5]hello[/h5]'
46
+ html = '<h5>hello</h5>'
47
+ assert_equal html, bb.bb_to_html
48
+ end
49
+
50
+ def test_h6
51
+ bb = '[h6]hello[/h6]'
52
+ html = '<h6>hello</h6>'
53
+ assert_equal html, bb.bb_to_html
54
+ end
55
+
20
56
  def test_b
21
57
  bb = '[b]hello[/b]'
22
58
  html = '<strong>hello</strong>'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 3
9
- version: 0.9.3
8
+ - 4
9
+ version: 0.9.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Peter Jihoon Kim
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-13 00:00:00 +09:00
17
+ date: 2010-08-02 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies: []
20
20