filters 1.0.0 → 1.0.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/History.rdoc +4 -0
- data/filters.gemspec +2 -2
- data/lib/filters/markup.rb +3 -3
- data/lib/filters/version.rb +1 -1
- data/spec/filter_markup_spec.rb +9 -8
- metadata +2 -2
data/History.rdoc
CHANGED
data/filters.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{filters}
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["TJ Holowaychuk"]
|
9
|
-
s.date = %q{2009-10-
|
9
|
+
s.date = %q{2009-10-23}
|
10
10
|
s.description = %q{Text filters including phrases, profanity, mini-markdown, uri, email, etc}
|
11
11
|
s.email = %q{tj@vision-media.ca}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/filters.rb", "lib/filters/all.rb", "lib/filters/email.rb", "lib/filters/filter.rb", "lib/filters/markup.rb", "lib/filters/phrase.rb", "lib/filters/profanity.rb", "lib/filters/uri.rb", "lib/filters/version.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
|
data/lib/filters/markup.rb
CHANGED
@@ -14,10 +14,10 @@ class Filter
|
|
14
14
|
string.gsub! /['"](.*?)['"]:(\S+)/, '<a href="\2">\1</a>'
|
15
15
|
string.gsub! /@@@\s*\n(.*?)@@@/m, "<pre>\n\\1</pre>"
|
16
16
|
string.gsub! /@@@\s*(\w+)(.*?)@@@/m, '<code class="\1">\2</code>'
|
17
|
-
string.gsub! /h(\d)
|
17
|
+
string.gsub! /h(\d)\.\s*([^\n]+)/, '<h\1>\2</h\1>'
|
18
18
|
string.gsub! /^\s*(={1,5})\s*([^\n]+)/ do |heading|
|
19
|
-
bar, contents = heading.split
|
20
|
-
"<h#{bar.length}>#{contents}</h#{bar.length}>"
|
19
|
+
bar, *contents = heading.split
|
20
|
+
"<h#{bar.length}>#{contents.join(' ')}</h#{bar.length}>"
|
21
21
|
end
|
22
22
|
string
|
23
23
|
end
|
data/lib/filters/version.rb
CHANGED
data/spec/filter_markup_spec.rb
CHANGED
@@ -85,14 +85,15 @@ describe Filter::Markup do
|
|
85
85
|
h2. Article
|
86
86
|
h3. Sub Article
|
87
87
|
EOF
|
88
|
-
|
89
|
-
expected = <<-EOF
|
90
|
-
<h1>Welcome</h1>
|
91
|
-
<h2>Article</h2>
|
92
|
-
<h3>Article</h3>
|
93
|
-
EOF
|
94
88
|
|
95
|
-
Filter::Markup(string)
|
96
|
-
|
89
|
+
filtered = Filter::Markup(string)
|
90
|
+
filtered.should include('<h1>Welcome</h1>')
|
91
|
+
filtered.should include('<h2>Article</h2>')
|
92
|
+
filtered.should include('<h3>Sub Article</h3>')
|
93
|
+
|
94
|
+
filtered2 = Filter::Markup(string2)
|
95
|
+
filtered2.should include('<h1>Welcome</h1>')
|
96
|
+
filtered2.should include('<h2>Article</h2>')
|
97
|
+
filtered2.should include('<h3>Sub Article</h3>')
|
97
98
|
end
|
98
99
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TJ Holowaychuk
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-23 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|