radiant-smarty_pants_filter-extension 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/Rakefile +136 -0
- data/lib/radiant-smarty_pants_filter-extension.rb +2 -0
- data/lib/radiant-smarty_pants_filter-extension/version.rb +3 -0
- data/lib/smarty_pants_filter.rb +7 -0
- data/lib/smarty_pants_tags.rb +18 -0
- data/lib/tasks/smarty_pants_filter_extension_tasks.rake +28 -0
- data/radiant-smarty_pants_filter-extension.gemspec +30 -0
- data/smarty_pants_filter_extension.rb +18 -0
- data/smartypants.html +47 -0
- data/spec/models/smarty_pants_filter_spec.rb +19 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +36 -0
- data/test/test_helper.rb +19 -0
- data/test/unit/smarty_pants_filter_test.rb +14 -0
- data/vendor/rubypants/README +114 -0
- data/vendor/rubypants/Rakefile +84 -0
- data/vendor/rubypants/install.rb +9 -0
- data/vendor/rubypants/rubypants.rb +490 -0
- data/vendor/rubypants/test_rubypants.rb +162 -0
- metadata +106 -0
@@ -0,0 +1,162 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubypants'
|
3
|
+
|
4
|
+
# Test EVERYTHING against SmartyPants.pl output!
|
5
|
+
|
6
|
+
|
7
|
+
class TestRubyPants < Test::Unit::TestCase
|
8
|
+
def assert_rp_equal(str, orig, options=[2])
|
9
|
+
assert_equal orig, RubyPants.new(str, options).to_html
|
10
|
+
end
|
11
|
+
|
12
|
+
def assert_verbatim(str)
|
13
|
+
assert_rp_equal str, str
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_verbatim
|
17
|
+
assert_verbatim "foo!"
|
18
|
+
assert_verbatim "<div>This is HTML</div>"
|
19
|
+
assert_verbatim "<div>This is HTML with <crap </div> tags>"
|
20
|
+
assert_verbatim <<EOF
|
21
|
+
multiline
|
22
|
+
|
23
|
+
<b>html</b>
|
24
|
+
|
25
|
+
code
|
26
|
+
|
27
|
+
EOF
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_quotes
|
31
|
+
assert_rp_equal '"A first example"', '“A first example”'
|
32
|
+
assert_rp_equal '"A first "nested" example"',
|
33
|
+
'“A first “nested” example”'
|
34
|
+
|
35
|
+
assert_rp_equal '".', '”.'
|
36
|
+
assert_rp_equal '"a', '“a'
|
37
|
+
|
38
|
+
assert_rp_equal "'.", '’.'
|
39
|
+
assert_rp_equal "'a", '‘a'
|
40
|
+
|
41
|
+
assert_rp_equal %{<p>He said, "'Quoted' words in a larger quote."</p>},
|
42
|
+
"<p>He said, “‘Quoted’ words in a larger quote.”</p>"
|
43
|
+
|
44
|
+
assert_rp_equal %{"I like the 70's"}, '“I like the 70’s”'
|
45
|
+
assert_rp_equal %{"I like the '70s"}, '“I like the ’70s”'
|
46
|
+
assert_rp_equal %{"I like the '70!"}, '“I like the ‘70!”'
|
47
|
+
|
48
|
+
assert_rp_equal 'pre"post', 'pre”post'
|
49
|
+
assert_rp_equal 'pre "post', 'pre “post'
|
50
|
+
assert_rp_equal 'pre "post', 'pre “post'
|
51
|
+
assert_rp_equal 'pre--"post', 'pre–“post'
|
52
|
+
assert_rp_equal 'pre--"!', 'pre–”!'
|
53
|
+
|
54
|
+
assert_rp_equal "pre'post", 'pre’post'
|
55
|
+
assert_rp_equal "pre 'post", 'pre ‘post'
|
56
|
+
assert_rp_equal "pre 'post", 'pre ‘post'
|
57
|
+
assert_rp_equal "pre--'post", 'pre–‘post'
|
58
|
+
assert_rp_equal "pre--'!", 'pre–’!'
|
59
|
+
|
60
|
+
assert_rp_equal "<b>'</b>", "<b>‘</b>"
|
61
|
+
assert_rp_equal "foo<b>'</b>", "foo<b>’</b>"
|
62
|
+
|
63
|
+
assert_rp_equal '<b>"</b>', "<b>“</b>"
|
64
|
+
assert_rp_equal 'foo<b>"</b>', "foo<b>”</b>"
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_dashes
|
68
|
+
assert_rp_equal "foo--bar", 'foo—bar', 1
|
69
|
+
assert_rp_equal "foo---bar", 'foo—-bar', 1
|
70
|
+
assert_rp_equal "foo----bar", 'foo——bar', 1
|
71
|
+
assert_rp_equal "foo-----bar", 'foo——-bar', 1
|
72
|
+
assert_rp_equal "--foo--bar--quux--",
|
73
|
+
'—foo—bar—quux—', 1
|
74
|
+
|
75
|
+
assert_rp_equal "foo--bar", 'foo–bar', 2
|
76
|
+
assert_rp_equal "foo---bar", 'foo—bar', 2
|
77
|
+
assert_rp_equal "foo----bar", 'foo—-bar', 2
|
78
|
+
assert_rp_equal "foo-----bar", 'foo—–bar', 2
|
79
|
+
assert_rp_equal "--foo--bar--quux--",
|
80
|
+
'–foo–bar–quux–', 2
|
81
|
+
|
82
|
+
assert_rp_equal "foo--bar", 'foo—bar', 3
|
83
|
+
assert_rp_equal "foo---bar", 'foo–bar', 3
|
84
|
+
assert_rp_equal "foo----bar", 'foo–-bar', 3
|
85
|
+
assert_rp_equal "foo-----bar", 'foo–—bar', 3
|
86
|
+
assert_rp_equal "--foo--bar--quux--",
|
87
|
+
'—foo—bar—quux—', 3
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_ellipses
|
91
|
+
assert_rp_equal "foo..bar", 'foo..bar'
|
92
|
+
assert_rp_equal "foo...bar", 'foo…bar'
|
93
|
+
assert_rp_equal "foo....bar", 'foo….bar'
|
94
|
+
|
95
|
+
# Nasty ones
|
96
|
+
assert_rp_equal "foo. . ..bar", 'foo….bar'
|
97
|
+
assert_rp_equal "foo. . ...bar", 'foo. . …bar'
|
98
|
+
assert_rp_equal "foo. . ....bar", 'foo. . ….bar'
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_backticks
|
102
|
+
assert_rp_equal "pre``post", 'pre“post'
|
103
|
+
assert_rp_equal "pre ``post", 'pre “post'
|
104
|
+
assert_rp_equal "pre ``post", 'pre “post'
|
105
|
+
assert_rp_equal "pre--``post", 'pre–“post'
|
106
|
+
assert_rp_equal "pre--``!", 'pre–“!'
|
107
|
+
|
108
|
+
assert_rp_equal "pre''post", 'pre”post'
|
109
|
+
assert_rp_equal "pre ''post", 'pre ”post'
|
110
|
+
assert_rp_equal "pre ''post", 'pre ”post'
|
111
|
+
assert_rp_equal "pre--''post", 'pre–”post'
|
112
|
+
assert_rp_equal "pre--''!", 'pre–”!'
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_single_backticks
|
116
|
+
o = [:oldschool, :allbackticks]
|
117
|
+
|
118
|
+
assert_rp_equal "`foo'", "‘foo’", o
|
119
|
+
|
120
|
+
assert_rp_equal "pre`post", 'pre‘post', o
|
121
|
+
assert_rp_equal "pre `post", 'pre ‘post', o
|
122
|
+
assert_rp_equal "pre `post", 'pre ‘post', o
|
123
|
+
assert_rp_equal "pre--`post", 'pre–‘post', o
|
124
|
+
assert_rp_equal "pre--`!", 'pre–‘!', o
|
125
|
+
|
126
|
+
assert_rp_equal "pre'post", 'pre’post', o
|
127
|
+
assert_rp_equal "pre 'post", 'pre ’post', o
|
128
|
+
assert_rp_equal "pre 'post", 'pre ’post', o
|
129
|
+
assert_rp_equal "pre--'post", 'pre–’post', o
|
130
|
+
assert_rp_equal "pre--'!", 'pre–’!', o
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_stupefy
|
134
|
+
o = [:stupefy]
|
135
|
+
|
136
|
+
assert_rp_equal "<p>He said, “‘Quoted’ words " +
|
137
|
+
"in a larger quote.”</p>",
|
138
|
+
%{<p>He said, "'Quoted' words in a larger quote."</p>}, o
|
139
|
+
|
140
|
+
assert_rp_equal "– — ‘’ “” …",
|
141
|
+
%{- -- '' "" ...}, o
|
142
|
+
|
143
|
+
assert_rp_equal %{- -- '' "" ...}, %{- -- '' "" ...}, o
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_process_escapes
|
147
|
+
assert_rp_equal %q{foo\bar}, "foo\\bar"
|
148
|
+
assert_rp_equal %q{foo\\\bar}, "foo\bar"
|
149
|
+
assert_rp_equal %q{foo\\\\\bar}, "foo\\\bar"
|
150
|
+
assert_rp_equal %q{foo\...bar}, "foo...bar"
|
151
|
+
assert_rp_equal %q{foo\.\.\.bar}, "foo...bar"
|
152
|
+
|
153
|
+
assert_rp_equal %q{foo\'bar}, "foo'bar"
|
154
|
+
assert_rp_equal %q{foo\"bar}, "foo"bar"
|
155
|
+
assert_rp_equal %q{foo\-bar}, "foo-bar"
|
156
|
+
assert_rp_equal %q{foo\`bar}, "foo`bar"
|
157
|
+
|
158
|
+
assert_rp_equal %q{foo\#bar}, "foo\\#bar"
|
159
|
+
assert_rp_equal %q{foo\*bar}, "foo\\*bar"
|
160
|
+
assert_rp_equal %q{foo\&bar}, "foo\\&bar"
|
161
|
+
end
|
162
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: radiant-smarty_pants_filter-extension
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Radiant CMS Dev Team
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-12 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rubypants
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
version: 0.2.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Allows you to compose page parts or snippets using the Markdown text filter.
|
38
|
+
email:
|
39
|
+
- radiant@radiantcms.org
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- lib/radiant-smarty_pants_filter-extension/version.rb
|
48
|
+
- lib/radiant-smarty_pants_filter-extension.rb
|
49
|
+
- lib/smarty_pants_filter.rb
|
50
|
+
- lib/smarty_pants_tags.rb
|
51
|
+
- lib/tasks/smarty_pants_filter_extension_tasks.rake
|
52
|
+
- radiant-smarty_pants_filter-extension.gemspec
|
53
|
+
- Rakefile
|
54
|
+
- README
|
55
|
+
- smarty_pants_filter_extension.rb
|
56
|
+
- smartypants.html
|
57
|
+
- spec/models/smarty_pants_filter_spec.rb
|
58
|
+
- spec/spec.opts
|
59
|
+
- spec/spec_helper.rb
|
60
|
+
- test/test_helper.rb
|
61
|
+
- test/unit/smarty_pants_filter_test.rb
|
62
|
+
- vendor/rubypants/install.rb
|
63
|
+
- vendor/rubypants/Rakefile
|
64
|
+
- vendor/rubypants/README
|
65
|
+
- vendor/rubypants/rubypants.rb
|
66
|
+
- vendor/rubypants/test_rubypants.rb
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: http://radiantcms.org/
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message: "\n Add this to your radiant project with:\n config.gem \"radiant-smarty_pants_filter-extension\", :version => \"~> 1.0.0\"\n "
|
72
|
+
rdoc_options: []
|
73
|
+
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
requirements: []
|
95
|
+
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 1.6.2
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Markdown Filter for Radiant CMS
|
101
|
+
test_files:
|
102
|
+
- test/test_helper.rb
|
103
|
+
- test/unit/smarty_pants_filter_test.rb
|
104
|
+
- spec/models/smarty_pants_filter_spec.rb
|
105
|
+
- spec/spec.opts
|
106
|
+
- spec/spec_helper.rb
|