ravicious-clothmark 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/clothmark.gemspec +2 -5
- data/lib/clothmark.rb +4 -2
- data/spec/clothmark_spec.rb +10 -8
- metadata +2 -12
data/Rakefile
CHANGED
@@ -14,7 +14,6 @@ begin
|
|
14
14
|
gem.add_dependency('bb-ruby', '>=0.9.3')
|
15
15
|
gem.add_dependency('BlueCloth', '>=1.0.0')
|
16
16
|
gem.add_dependency('RedCloth', '>=4.2.2')
|
17
|
-
gem.add_development_dependency "rspec"
|
18
17
|
gem.executables = ['clothmark']
|
19
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
19
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/clothmark.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{clothmark}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rafal Cieslak"]
|
12
|
-
s.date = %q{2009-08-
|
12
|
+
s.date = %q{2009-08-22}
|
13
13
|
s.default_executable = %q{clothmark}
|
14
14
|
s.description = %q{With ClothMark you can easily convert your files formatted with Markdown, Textile or BBCode to HTML files.}
|
15
15
|
s.email = %q{ravicious@gmail.com}
|
@@ -48,17 +48,14 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.add_runtime_dependency(%q<bb-ruby>, [">= 0.9.3"])
|
49
49
|
s.add_runtime_dependency(%q<BlueCloth>, [">= 1.0.0"])
|
50
50
|
s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.2"])
|
51
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
52
51
|
else
|
53
52
|
s.add_dependency(%q<bb-ruby>, [">= 0.9.3"])
|
54
53
|
s.add_dependency(%q<BlueCloth>, [">= 1.0.0"])
|
55
54
|
s.add_dependency(%q<RedCloth>, [">= 4.2.2"])
|
56
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
57
55
|
end
|
58
56
|
else
|
59
57
|
s.add_dependency(%q<bb-ruby>, [">= 0.9.3"])
|
60
58
|
s.add_dependency(%q<BlueCloth>, [">= 1.0.0"])
|
61
59
|
s.add_dependency(%q<RedCloth>, [">= 4.2.2"])
|
62
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
63
60
|
end
|
64
61
|
end
|
data/lib/clothmark.rb
CHANGED
@@ -28,7 +28,7 @@ class ClothMark
|
|
28
28
|
@additional_html = additional_html # If true, then ClothMark will generate additional CSS and HTML
|
29
29
|
end
|
30
30
|
|
31
|
-
#
|
31
|
+
# Read lines from input file and put them to array
|
32
32
|
def read_from_file
|
33
33
|
begin
|
34
34
|
File.open(@file) do |file|
|
@@ -40,6 +40,7 @@ class ClothMark
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
# Convert input to HTML with predefined markup language.
|
43
44
|
def to_html
|
44
45
|
case @markup
|
45
46
|
when 'markdown'
|
@@ -51,7 +52,8 @@ class ClothMark
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
|
-
#
|
55
|
+
# Save output to the output file (one paragraph per line).
|
56
|
+
# Include additional HTML and CSS if attr additional_html = true
|
55
57
|
def save_to_file
|
56
58
|
File.open(@output, 'w+') do |file|
|
57
59
|
file.puts HEADER if @additional_html
|
data/spec/clothmark_spec.rb
CHANGED
@@ -58,11 +58,15 @@ Lorem _ipsum_ dolor sit amet, *consectetur* adipiscing elit."
|
|
58
58
|
lambda { ClothMark.new('rotfl', 'wikitext') }.should raise_error(ArgumentError)
|
59
59
|
end
|
60
60
|
|
61
|
+
it "should raise an error if specified input file doesn't exist" do
|
62
|
+
lambda { ClothMark.new('dunnolol').read_from_file }.should_not raise_error(Errno::ENOENT)
|
63
|
+
end
|
64
|
+
|
61
65
|
it "should generate valid default 'output' filename" do
|
62
66
|
@foo.output.should == 'nothing_special_clothmark.html'
|
63
67
|
end
|
64
68
|
|
65
|
-
it "should
|
69
|
+
it "should get output filename if it is specified" do
|
66
70
|
@bar = ClothMark.new('rails.txt', 'markdown', true, 'rubyonrails.txt')
|
67
71
|
@bar.output.should == 'rubyonrails.txt'
|
68
72
|
end
|
@@ -77,8 +81,8 @@ Lorem _ipsum_ dolor sit amet, *consectetur* adipiscing elit."
|
|
77
81
|
counter = 0
|
78
82
|
|
79
83
|
File.open(@foo.output, 'r') do |file|
|
80
|
-
# There's more than one paragraph in
|
81
|
-
# so we
|
84
|
+
# There's more than one paragraph in input file (data_for_output),
|
85
|
+
# so we wanna see a few paragraphs also in output file.
|
82
86
|
file.each_line do |line|
|
83
87
|
counter += 1 unless line.empty?
|
84
88
|
end
|
@@ -94,7 +98,7 @@ Lorem _ipsum_ dolor sit amet, *consectetur* adipiscing elit."
|
|
94
98
|
|
95
99
|
test_string = ''
|
96
100
|
|
97
|
-
#
|
101
|
+
# Put each file from output to string for test
|
98
102
|
File.open(@foo.output, 'r') do |file|
|
99
103
|
file.each_line do |line|
|
100
104
|
test_string << "#{line} \n"
|
@@ -116,7 +120,7 @@ Lorem _ipsum_ dolor sit amet, *consectetur* adipiscing elit."
|
|
116
120
|
|
117
121
|
test_string = ''
|
118
122
|
|
119
|
-
#
|
123
|
+
# Put each file from output to string for test
|
120
124
|
File.open(@egg.output, 'r') do |file|
|
121
125
|
file.each_line do |line|
|
122
126
|
test_string << "#{line} \n"
|
@@ -141,14 +145,12 @@ Lorem _ipsum_ dolor sit amet, *consectetur* adipiscing elit."
|
|
141
145
|
end
|
142
146
|
|
143
147
|
it "should convert data from input file to HTML (Textile -> HTML)" do
|
144
|
-
@redmark.read_from_file
|
145
|
-
@redmark.to_html
|
146
148
|
@redmark.data_for_output.should_not be_empty
|
147
149
|
@redmark.data_for_output.join("\n").should match(/<.+>/)
|
148
150
|
end
|
149
151
|
|
150
152
|
after :all do
|
151
|
-
# Remove testfiles (outputs)
|
153
|
+
# Remove testfiles (outputs and inputs)
|
152
154
|
[@bbcode_file, @markdown_file, @textile_file].each do |file|
|
153
155
|
FileUtils.rm(file)
|
154
156
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ravicious-clothmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafal Cieslak
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-22 00:00:00 -07:00
|
13
13
|
default_executable: clothmark
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,16 +42,6 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 4.2.2
|
44
44
|
version:
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: rspec
|
47
|
-
type: :development
|
48
|
-
version_requirement:
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: "0"
|
54
|
-
version:
|
55
45
|
description: With ClothMark you can easily convert your files formatted with Markdown, Textile or BBCode to HTML files.
|
56
46
|
email: ravicious@gmail.com
|
57
47
|
executables:
|