ClothRed 0.3.0 → 0.3.1

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.
data/lib/clothred.rb CHANGED
@@ -19,24 +19,25 @@ class ClothRed < String
19
19
  ["</b>", "*"], ["<cite>", "??"], ["</cite>", "??"], ["<code>", "@"],
20
20
  ["</code>", "@"], ["<del>", "-"], ["</del>", "-"], ["<ins>", "+"],
21
21
  ["</ins>", "+"], ["<sup>","^"], ["</sup>","^"], ["<sub>","~"], ["</sub>","~"],
22
- ["<strong>", "*"], ["</strong>", "*"], ["<i>","__"], ["</i>", "__"]
22
+ ["<strong>", "*"], ["</strong>", "*"], ["<i>","__"], ["</i>", "__"]
23
23
  ]
24
24
 
25
25
  HEADINGS = [
26
- ["<h1>","h1. "], ["</h1>", ""], ["<h2>","h2. "], ["</h2>", ""],
27
- ["<h3>","h3. "], ["</h3>", ""], ["<h4>","h4. "], ["</h4>", ""],
28
- ["<h5>","h5. "], ["</h5>", ""], ["<h6>","h6. "], ["</h6>", ""],
29
- ["<h7>","h7. "], ["</h7>", ""]
26
+ ["<h1>","h1. "], ["</h1>", "\n\n"], ["<h2>","h2. "], ["</h2>", "\n\n"],
27
+ ["<h3>","h3. "], ["</h3>", "\n\n"], ["<h4>","h4. "], ["</h4>", "\n\n"],
28
+ ["<h5>","h5. "], ["</h5>", "\n\n"], ["<h6>","h6. "], ["</h6>", "\n\n"],
29
+ ["<h7>","h7. "], ["</h7>", "\n\n"]
30
30
  ]
31
31
 
32
32
  STRUCTURES = [
33
- ["<p>", ""],["</p>","\n\n"], ["<blockquote>", "bq. "], ["</blockquote>",""]
33
+ ["<p>", ""],["</p>","\n\n"], ["<blockquote>", "bq. "], ["</blockquote>",""],
34
+ ["<br />", "\n"], ["<br>", "\n"]
34
35
  ]
35
36
 
36
37
  ENTITIES = [
37
38
  ["&#8220;", '"'], ["&#8221;", '"'], ["&#8212;", "--"], ["&#8212;", "--"],
38
39
  ["&#8211;","-"], ["&#8230;", "..."], ["&#215;", " x "], ["&#8482;","(tm)"],
39
- ["&#174;","(R)"], ["&#169;","(C)"], ["&#8217;", "'"]
40
+ ["&#174;","(R)"], ["&#169;","(c)"], ["&#8217;", "'"]
40
41
  ]
41
42
 
42
43
  TABLES = [
@@ -18,7 +18,7 @@ class TestClothRedEntities < Test::Unit::TestCase
18
18
  ENTITIES_TEST = [
19
19
  ["&#8220;", '"'], ["&#8221;", '"'], ["&#8212;", "--"], ["&#8212;", "--"],
20
20
  ["&#8211;","-"], ["&#8230;", "..."], ["&#215;", " x "], ["&#8482;","(tm)"],
21
- ["&#174;","(R)"], ["&#169;","(C)"], ["&#8217;", "'"]
21
+ ["&#174;","(R)"], ["&#169;","(c)"], ["&#8217;", "'"]
22
22
  ]
23
23
 
24
24
  def test_entities
@@ -14,14 +14,14 @@ end
14
14
  require 'test/unit'
15
15
 
16
16
  class TestClothRedHeadings < Test::Unit::TestCase
17
-
17
+
18
18
  HEADING_TEST = [
19
- ["<h1>Heading 1</h1>","h1. Heading 1"], ["<h2>Heading 2</h2>", "h2. Heading 2"],
20
- ["<h3>Heading 3", "h3. Heading 3"], ["<h4>Heading 4</h4>", "h4. Heading 4"],
21
- ["<h5>Heading 5", "h5. Heading 5"], ["<h6>Heading 6</h6>", "h6. Heading 6"]
19
+ ["<h1>Heading 1</h1>","h1. Heading 1\n\n"], ["<h2>Heading 2</h2>", "h2. Heading 2\n\n"],
20
+ ["<h3>Heading 3", "h3. Heading 3\n\n"], ["<h4>Heading 4</h4>", "h4. Heading 4\n\n"],
21
+ ["<h5>Heading 5", "h5. Heading 5\n\n"], ["<h6>Heading 6</h6>", "h6. Heading 6\n\n"]
22
22
  ]
23
-
24
-
23
+
24
+
25
25
  def test_headings
26
26
  HEADING_TEST.each do |html, textile|
27
27
  test_html = ClothRed.new(html)
@@ -29,4 +29,18 @@ class TestClothRedHeadings < Test::Unit::TestCase
29
29
  assert_equal(textile,result)
30
30
  end
31
31
  end
32
+
33
+ MIST_TEST = [
34
+ ["<h1>Heading 1</h1><h2>Heading 2</h2>","h1. Heading 1\n\nh2. Heading 2\n\n"],
35
+ ]
36
+
37
+
38
+ def test_headings
39
+ MIST_TEST.each do |html, textile|
40
+ test_html = ClothRed.new(html)
41
+ result = test_html.to_textile
42
+ assert_equal(textile,result)
43
+ end
44
+ end
45
+
32
46
  end
@@ -17,7 +17,8 @@ class TestClothRedStructures < Test::Unit::TestCase
17
17
 
18
18
  STRUCTURE_TEST = [
19
19
  ["<blockquote>blockquote</blockquote>","bq. blockquote"],
20
- ["<p>paragraph</p><p>another paragraph</p>", "paragraph\n\nanother paragraph\n\n"]
20
+ ["<p>paragraph</p><p>another paragraph</p>", "paragraph\n\nanother paragraph\n\n"],
21
+ ["HTML page break<br>", "HTML page break\n"], ["XHTML page break<br />", "XHTML page break\n"]
21
22
  ]
22
23
 
23
24
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.1
3
3
  specification_version: 1
4
4
  name: ClothRed
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.0
7
- date: 2007-04-12 00:00:00 +02:00
6
+ version: 0.3.1
7
+ date: 2007-04-13 00:00:00 +02:00
8
8
  summary: "RedCloth in reverse: Converting HTML into Textile markup"
9
9
  require_paths:
10
10
  - lib