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 +8 -7
- data/test/test_entities.rb +1 -1
- data/test/test_headings.rb +20 -6
- data/test/test_structure.rb +2 -1
- metadata +2 -2
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
|
["“", '"'], ["”", '"'], ["—", "--"], ["—", "--"],
|
38
39
|
["–","-"], ["…", "..."], ["×", " x "], ["™","(tm)"],
|
39
|
-
["®","(R)"], ["©","(
|
40
|
+
["®","(R)"], ["©","(c)"], ["’", "'"]
|
40
41
|
]
|
41
42
|
|
42
43
|
TABLES = [
|
data/test/test_entities.rb
CHANGED
@@ -18,7 +18,7 @@ class TestClothRedEntities < Test::Unit::TestCase
|
|
18
18
|
ENTITIES_TEST = [
|
19
19
|
["“", '"'], ["”", '"'], ["—", "--"], ["—", "--"],
|
20
20
|
["–","-"], ["…", "..."], ["×", " x "], ["™","(tm)"],
|
21
|
-
["®","(R)"], ["©","(
|
21
|
+
["®","(R)"], ["©","(c)"], ["’", "'"]
|
22
22
|
]
|
23
23
|
|
24
24
|
def test_entities
|
data/test/test_headings.rb
CHANGED
@@ -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
|
-
|
20
|
-
|
21
|
-
|
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
|
data/test/test_structure.rb
CHANGED
@@ -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.
|
7
|
-
date: 2007-04-
|
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
|