ravicious-clothmark 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -56,16 +56,9 @@ else
56
56
  end #begin
57
57
  end
58
58
 
59
- case options[:markup]
60
- when 'markdown'
61
- @cloth = BlueMark.new(options[:input], options[:output], options[:additional_html])
62
- when 'textile'
63
- @cloth = RedMark.new(options[:input], options[:output], options[:additional_html])
64
- when 'bbcode'
65
- @cloth = BBMark.new(options[:input], options[:output], options[:additional_html])
66
- end
67
-
68
- @cloth.convert
59
+ @cloth = ClothMark.new(options[:input], options[:markup], options[:additional_html], options[:output])
60
+ @cloth.read_from_file
61
+ @cloth.to_html
69
62
  @cloth.save_to_file
70
63
 
71
64
  puts "File converted and saved to #{File.expand_path(@cloth.output)}"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{clothmark}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
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-20}
12
+ s.date = %q{2009-08-21}
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}
@@ -26,12 +26,7 @@ Gem::Specification.new do |s|
26
26
  "bin/clothmark",
27
27
  "clothmark.gemspec",
28
28
  "lib/clothmark.rb",
29
- "lib/clothmark/markups.rb",
30
- "lib/clothmark/module.rb",
31
- "spec/clothmark/bbmark_spec.rb",
32
- "spec/clothmark/bluemark_spec.rb",
33
- "spec/clothmark/clothmark_spec.rb",
34
- "spec/clothmark/redmark_spec.rb",
29
+ "spec/clothmark_spec.rb",
35
30
  "spec/spec_helper.rb"
36
31
  ]
37
32
  s.has_rdoc = true
@@ -41,10 +36,7 @@ Gem::Specification.new do |s|
41
36
  s.rubygems_version = %q{1.3.1}
42
37
  s.summary = %q{With ClothMark you can easily convert your files formatted with Markdown, Textile or BBCode to HTML files.}
43
38
  s.test_files = [
44
- "spec/clothmark/bbmark_spec.rb",
45
- "spec/clothmark/bluemark_spec.rb",
46
- "spec/clothmark/clothmark_spec.rb",
47
- "spec/clothmark/redmark_spec.rb",
39
+ "spec/clothmark_spec.rb",
48
40
  "spec/spec_helper.rb"
49
41
  ]
50
42
 
@@ -3,5 +3,100 @@ require "BlueCloth"
3
3
  require "RedCloth"
4
4
  require "bb-ruby"
5
5
 
6
- require File.dirname(__FILE__) + '/clothmark/module'
7
- require File.dirname(__FILE__) + '/clothmark/markups'
6
+ class ClothMark
7
+ attr_accessor :data_for_output, :file, :output
8
+ attr_reader :markup
9
+
10
+ # ClothMark will generate a default filename if user don't want to save output to a specific file
11
+ # and will use Markdown as a default markup language.
12
+ def initialize(file, markup = "markdown", additional_html = false, output = nil)
13
+ @file = file
14
+
15
+ # ClothMark will raise an error if unknown markup language has been sent
16
+ if %w(markdown textile bbcode).include? markup
17
+ @markup = markup
18
+ else
19
+ raise ArgumentError, "Unknown markup language (#{markup})"
20
+ end
21
+
22
+ if (!output || output.empty?)
23
+ @output = "#{file.gsub(/(\.[a-z]{3,4})/, '')}_clothmark.html"
24
+ else
25
+ @output = output
26
+ end
27
+ @data_for_output = []
28
+ @additional_html = additional_html # If true, then ClothMark will generate additional CSS and HTML
29
+ end
30
+
31
+ # Reads data from input file and puts it to array
32
+ def read_from_file
33
+ begin
34
+ File.open(@file) do |file|
35
+ file.each_line {|line| @data_for_output << line}
36
+ end
37
+ rescue Errno::ENOENT => e
38
+ puts e
39
+ exit
40
+ end
41
+ end
42
+
43
+ def to_html
44
+ case @markup
45
+ when 'markdown'
46
+ @data_for_output.collect! {|line| BlueCloth.new(line).to_html}
47
+ when 'textile'
48
+ @data_for_output.collect! {|line| RedCloth.new(line).to_html}
49
+ when 'bbcode'
50
+ @data_for_output.collect! {|line| line.bbcode_to_html}
51
+ end
52
+ end
53
+
54
+ # Saves output to a file (one paragraph per line).
55
+ def save_to_file
56
+ File.open(@output, 'w+') do |file|
57
+ file.puts HEADER if @additional_html
58
+ file.puts @data_for_output.join("\n")
59
+ file.puts FOOTER if @additional_html
60
+ end
61
+ end
62
+ end
63
+
64
+ # Header for an output file.
65
+ HEADER = <<-EOF
66
+ <html>
67
+ <head>
68
+ <style type="text/css">
69
+ #wrapper {
70
+ width: 600px; margin: 0 auto;
71
+ font-family: "Trebuchet MS", Verdana, sans-serif;
72
+ border-top: 1px solid black;
73
+ border-bottom: 1px solid black;
74
+ line-height: 1.5em;
75
+ }
76
+ pre {
77
+ font-size:90%;
78
+ line-height:1.5em !important;
79
+ overflow:auto;
80
+ margin:1em 0;
81
+ padding:0.5em;
82
+ }
83
+
84
+ pre, code {
85
+ font-family:Monaco, "Courier New", monospace;
86
+ color:#444;
87
+ background-color:#F8F8FF;
88
+ border:1px solid #DEDEDE;
89
+ }
90
+ </style>
91
+ <title>ClothMark file preview</title>
92
+ </head>
93
+ <body>
94
+ <div id="wrapper">
95
+ EOF
96
+
97
+ # Footer for an output file.
98
+ FOOTER = <<-EOF
99
+ </div>
100
+ </body>
101
+ </html>
102
+ EOF
@@ -0,0 +1,164 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe ClothMark do
4
+ before :all do
5
+ @egg = ClothMark.new('example.txt', 'markdown', false)
6
+
7
+ # Create input text for BBCode
8
+ @bbcode_file = 'bbcode.txt'
9
+ BBCODE = "[b]O HAI![/b]
10
+
11
+ Lorem [i]ipsum[/i] dolor sit amet, [b]consectetur[/b] adipiscing elit.
12
+
13
+ [quote]Blaargh![/quote]"
14
+
15
+ # Create input text for Markdown
16
+ @markdown_file = 'markdown.txt'
17
+ MARKDOWN = "# O HAI!
18
+
19
+ Lorem *ipsum* dolor sit amet, **consectetur** adipiscing elit."
20
+
21
+ # Create input text for Textile
22
+ @textile_file = 'textile.txt'
23
+ TEXTILE = "h1. O HAI!
24
+
25
+ Lorem _ipsum_ dolor sit amet, *consectetur* adipiscing elit."
26
+
27
+ # Save input text to files
28
+ [@bbcode_file, @markdown_file, @textile_file, 'example.txt'].each do |markup|
29
+ File.open(markup, 'w+') do |file|
30
+ case markup
31
+ when @bbcode_file
32
+ file.puts BBCODE
33
+ when @markdown_file
34
+ file.puts MARKDOWN
35
+ when @textile_file
36
+ file.puts TEXTILE
37
+ else
38
+ file.puts "OH MY!"
39
+ end
40
+ end
41
+ end
42
+
43
+ @bbmark = ClothMark.new(@bbcode_file, 'bbcode')
44
+ @bluemark = ClothMark.new(@markdown_file, 'markdown')
45
+ @redmark = ClothMark.new(@textile_file, 'textile')
46
+
47
+ [@bbmark, @bluemark, @redmark].each do |clothmark|
48
+ clothmark.read_from_file
49
+ clothmark.to_html
50
+ end
51
+ end
52
+
53
+ before :each do
54
+ @foo = ClothMark.new('nothing_special.txt', 'markdown', true, nil)
55
+ end
56
+
57
+ it "should raise an error if unknown markup language has been specified" do
58
+ lambda { ClothMark.new('rotfl', 'wikitext') }.should raise_error(ArgumentError)
59
+ end
60
+
61
+ it "should generate valid default 'output' filename" do
62
+ @foo.output.should == 'nothing_special_clothmark.html'
63
+ end
64
+
65
+ it "should gets output filename if it is specified" do
66
+ @bar = ClothMark.new('rails.txt', 'markdown', true, 'rubyonrails.txt')
67
+ @bar.output.should == 'rubyonrails.txt'
68
+ end
69
+
70
+ it "should save valid data (one paragraph per line)" do
71
+ @foo.data_for_output = ['Donec ultrices tortor non lorem egestas ut pharetra diam vestibulum.',
72
+ 'Etiam magna urna, porta non scelerisque ut, porttitor non purus.',
73
+ 'Mauris blandit dui ac eros varius quis lacinia velit semper.']
74
+
75
+ @foo.save_to_file
76
+
77
+ counter = 0
78
+
79
+ File.open(@foo.output, 'r') do |file|
80
+ # There's more than one paragraph in 'input file' (data_for_output),
81
+ # so we wan't a few paragraphs also in 'output' file.
82
+ file.each_line do |line|
83
+ counter += 1 unless line.empty?
84
+ end
85
+ end
86
+
87
+ # File should have at least two paragraphs
88
+ counter.should > 1
89
+ end
90
+
91
+ it "should save data for output to the output file with additional CSS and HTML" do
92
+ @foo.data_for_output = ["OH MY!"]
93
+ @foo.save_to_file
94
+
95
+ test_string = ''
96
+
97
+ # Puts each file from output to string for test
98
+ File.open(@foo.output, 'r') do |file|
99
+ file.each_line do |line|
100
+ test_string << "#{line} \n"
101
+ end
102
+ end
103
+
104
+ # Additional HTML and CSS should be added
105
+ test_string.should match(/<html/)
106
+ test_string.should match(/<head/)
107
+ test_string.should match(/<style/)
108
+ test_string.should match(/<body/)
109
+ end
110
+
111
+ it "should save data for output to the output file without additional HTML and CSS" do
112
+
113
+
114
+ @egg.read_from_file
115
+ @egg.save_to_file
116
+
117
+ test_string = ''
118
+
119
+ # Puts each file from output to string for test
120
+ File.open(@egg.output, 'r') do |file|
121
+ file.each_line do |line|
122
+ test_string << "#{line} \n"
123
+ end
124
+ end
125
+
126
+ # Additional HTML and CSS should not be added
127
+ test_string.should_not match(/<html/)
128
+ test_string.should_not match(/<head/)
129
+ test_string.should_not match(/<style/)
130
+ test_string.should_not match(/<body/)
131
+ end
132
+
133
+ it "should convert data from input file to HTML (BBCode -> HTML)" do
134
+ @bbmark.data_for_output.should_not be_empty
135
+ @bbmark.data_for_output.join("\n").should match(/<.+>/) # <.+> is the HTML tag
136
+ end
137
+
138
+ it "should convert data from input file to HTML (Markdown -> HTML)" do
139
+ @bluemark.data_for_output.should_not be_empty
140
+ @bluemark.data_for_output.join("\n").should match(/<.+>/)
141
+ end
142
+
143
+ it "should convert data from input file to HTML (Textile -> HTML)" do
144
+ @redmark.read_from_file
145
+ @redmark.to_html
146
+ @redmark.data_for_output.should_not be_empty
147
+ @redmark.data_for_output.join("\n").should match(/<.+>/)
148
+ end
149
+
150
+ after :all do
151
+ # Remove testfiles (outputs)
152
+ [@bbcode_file, @markdown_file, @textile_file].each do |file|
153
+ FileUtils.rm(file)
154
+ end
155
+ [@foo, @egg].each do |file|
156
+ begin
157
+ FileUtils.rm(file.output)
158
+ FileUtils.rm(file.file)
159
+ rescue Errno::ENOENT => e
160
+ # puts e
161
+ end
162
+ end
163
+ end
164
+ 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.2
4
+ version: 0.2.3
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-20 00:00:00 -07:00
12
+ date: 2009-08-21 00:00:00 -07:00
13
13
  default_executable: clothmark
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -69,12 +69,7 @@ files:
69
69
  - bin/clothmark
70
70
  - clothmark.gemspec
71
71
  - lib/clothmark.rb
72
- - lib/clothmark/markups.rb
73
- - lib/clothmark/module.rb
74
- - spec/clothmark/bbmark_spec.rb
75
- - spec/clothmark/bluemark_spec.rb
76
- - spec/clothmark/clothmark_spec.rb
77
- - spec/clothmark/redmark_spec.rb
72
+ - spec/clothmark_spec.rb
78
73
  - spec/spec_helper.rb
79
74
  has_rdoc: true
80
75
  homepage: http://github.com/ravicious/clothmark
@@ -104,8 +99,5 @@ signing_key:
104
99
  specification_version: 2
105
100
  summary: With ClothMark you can easily convert your files formatted with Markdown, Textile or BBCode to HTML files.
106
101
  test_files:
107
- - spec/clothmark/bbmark_spec.rb
108
- - spec/clothmark/bluemark_spec.rb
109
- - spec/clothmark/clothmark_spec.rb
110
- - spec/clothmark/redmark_spec.rb
102
+ - spec/clothmark_spec.rb
111
103
  - spec/spec_helper.rb
@@ -1,35 +0,0 @@
1
- class BlueMark
2
- include ClothMark
3
-
4
- # Converts all lines from input file from Markdown format to HTML
5
- # and pushes them to an array data_for_output.
6
- def convert
7
- File.open(@file) do |file|
8
- file.each_line {|line| @data_for_output << BlueCloth.new(line).to_html}
9
- end
10
- end
11
- end
12
-
13
- class RedMark
14
- include ClothMark
15
-
16
- # Converts all lines from input file from Textile format to HTML
17
- # and pushes them to an array data_for_output.
18
- def convert
19
- File.open(@file) do |file|
20
- file.each_line {|line| @data_for_output << RedCloth.new(line).to_html}
21
- end
22
- end
23
- end
24
-
25
- class BBMark
26
- include ClothMark
27
-
28
- # Converts all lines from input file from BBCode format to HTML
29
- # and pushes them to an array data_for_output.
30
- def convert
31
- File.open(@file) do |file|
32
- file.each_line {|line| @data_for_output << line.bbcode_to_html}
33
- end
34
- end
35
- end
@@ -1,64 +0,0 @@
1
- module ClothMark
2
- attr_accessor :data_for_output, :file, :output
3
-
4
- # Header for an output file.
5
- HEADER = <<-EOF
6
- <html>
7
- <head>
8
- <style type="text/css">
9
- #wrapper {
10
- width: 600px; margin: 0 auto;
11
- font-family: "Trebuchet MS", Verdana, sans-serif;
12
- border-top: 1px solid black;
13
- border-bottom: 1px solid black;
14
- line-height: 1.5em;
15
- }
16
- pre {
17
- font-size:90%;
18
- line-height:1.5em !important;
19
- overflow:auto;
20
- margin:1em 0;
21
- padding:0.5em;
22
- }
23
-
24
- pre, code {
25
- font-family:Monaco, "Courier New", monospace;
26
- color:#444;
27
- background-color:#F8F8FF;
28
- border:1px solid #DEDEDE;
29
- }
30
- </style>
31
- <title>ClothMark file preview</title>
32
- </head>
33
- <body>
34
- <div id="wrapper">
35
- EOF
36
-
37
- # Footer for an output file.
38
- FOOTER = <<-EOF
39
- </div>
40
- </body>
41
- </html>
42
- EOF
43
-
44
- # ClothMark will generate a default filename if user don't want to save output to a specific file.
45
- def initialize(file, output = nil, additional_html = true)
46
- @file = file
47
- if (!output || output.empty?)
48
- @output = "#{file.gsub(/(\.[a-z]{3,4})/, '')}_clothmark.html"
49
- else
50
- @output = output
51
- end
52
- @data_for_output = []
53
- @additional_html = additional_html # If true, then ClothMark will generate additional CSS and HTML
54
- end
55
-
56
- # Saves output to a file (one paragraph per line).
57
- def save_to_file
58
- File.open(@output, 'w+') do |file|
59
- file.puts HEADER if @additional_html
60
- file.puts @data_for_output.join("\n")
61
- file.puts FOOTER if @additional_html
62
- end
63
- end
64
- end
@@ -1,36 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe BBMark do
4
- before :all do
5
- @testfile = 'testfile.txt'
6
-
7
- File.open(@testfile, 'w+') do |file|
8
- file.puts "[b]O HAI![/b]
9
-
10
- Lorem [i]ipsum[/i] dolor sit amet, [b]consectetur[/b] adipiscing elit. Sed iaculis rutrum lobortis. Integer vitae magna dolor, luctus venenatis lorem. Etiam magna urna, porta non scelerisque ut, porttitor non purus. Nunc et tortor at eros venenatis molestie. Maecenas ut nulla ac leo congue porttitor. Phasellus vitae sem dolor, vitae elementum diam. Phasellus adipiscing augue nec dui fermentum bibendum. Donec ultrices tortor non lorem egestas ut pharetra diam vestibulum.
11
-
12
- [quote]Blaargh![/quote]
13
-
14
- In ullamcorper placerat justo, ut dictum lorem sollicitudin a. Pellentesque dictum volutpat nisl, non rutrum dolor pharetra ut. Curabitur a elementum mi. Duis eu tellus eu justo ultrices tincidunt. Mauris blandit dui ac eros varius quis lacinia velit semper. Vivamus eu augue elit. Quisque lacinia sapien vel purus eleifend scelerisque feugiat quam sollicitudin. Pellentesque accumsan adipiscing leo, ut porttitor felis adipiscing id. Fusce cursus, lorem quis mollis commodo, dolor ipsum mattis lacus, ut suscipit augue lorem malesuada felis."
15
- end
16
- end
17
-
18
- before :each do
19
- @bbmark = BBMark.new(@testfile)
20
- end
21
-
22
- it "should convert data from input file to HTML (BBCode -> HTML)" do
23
-
24
- @bbmark.convert
25
-
26
- @bbmark.data_for_output.should_not be_empty
27
-
28
- @bbmark.data_for_output.join("\n").should match(/<.+>/) # <.+> is the HTML tag
29
-
30
- end
31
-
32
- after :all do
33
- # Remove testfile (input)
34
- FileUtils.rm(@bbmark.file)
35
- end
36
- end
@@ -1,36 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe BlueMark do
4
- before :all do
5
- @testfile = 'testfile.txt'
6
-
7
- File.open(@testfile, 'w+') do |file|
8
- file.puts "# O HAI!
9
-
10
- Lorem **ipsum** dolor sit amet, *consectetur* adipiscing elit. Sed iaculis rutrum lobortis. Integer vitae magna dolor, luctus venenatis lorem. Etiam magna urna, porta non scelerisque ut, porttitor non purus. Nunc et tortor at eros venenatis molestie. Maecenas ut nulla ac leo congue porttitor. Phasellus vitae sem dolor, vitae elementum diam. Phasellus adipiscing augue nec dui fermentum bibendum. Donec ultrices tortor non lorem egestas ut pharetra diam vestibulum.
11
-
12
- > Blaargh!
13
-
14
- In ullamcorper placerat justo, ut dictum lorem sollicitudin a. Pellentesque dictum volutpat nisl, non rutrum dolor pharetra ut. Curabitur a elementum mi. Duis eu tellus eu justo ultrices tincidunt. Mauris blandit dui ac eros varius quis lacinia velit semper. Vivamus eu augue elit. Quisque lacinia sapien vel purus eleifend scelerisque feugiat quam sollicitudin. Pellentesque accumsan adipiscing leo, ut porttitor felis adipiscing id. Fusce cursus, lorem quis mollis commodo, dolor ipsum mattis lacus, ut suscipit augue lorem malesuada felis."
15
- end
16
- end
17
-
18
- before :each do
19
- @bluemark = BlueMark.new(@testfile)
20
- end
21
-
22
- it "should convert data from input file to HTML (Markdown -> HTML)" do
23
-
24
- @bluemark.convert
25
-
26
- @bluemark.data_for_output.should_not be_empty
27
-
28
- @bluemark.data_for_output.join("\n").should match(/<.+>/) # <.+> is the HTML tag
29
-
30
- end
31
-
32
- after :all do
33
- # Remove testfile (input)
34
- FileUtils.rm(@bluemark.file)
35
- end
36
- end
@@ -1,88 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe ClothMark do
4
- before :each do
5
- @klass = Class.new { include ClothMark }
6
- @foo = @klass.new('nothing_special.txt')
7
- end
8
-
9
- it "should generate valid default 'output' filename" do
10
- @foo.output.should == 'nothing_special_clothmark.html'
11
- end
12
-
13
- it "should gets output filename if it is specified" do
14
- @bar = @klass.new('rails.txt', 'rubyonrails.txt')
15
- @bar.output.should == 'rubyonrails.txt'
16
- end
17
-
18
- it "should save valid data (one paragraph per line)" do
19
- @foo.data_for_output = ['Donec ultrices tortor non lorem egestas ut pharetra diam vestibulum.',
20
- 'Etiam magna urna, porta non scelerisque ut, porttitor non purus.',
21
- 'Mauris blandit dui ac eros varius quis lacinia velit semper.']
22
-
23
- @foo.save_to_file
24
-
25
- counter = 0
26
-
27
- File.open(@foo.output, 'r') do |file|
28
- # There's more than one paragraph in 'input file' (data_for_output),
29
- # so we wan't a few paragraphs also in 'output' file.
30
- file.each_line do |line|
31
- counter += 1 unless line.empty?
32
- end
33
- end
34
-
35
- # File should have at least two paragraphs
36
- counter.should > 1
37
- end
38
-
39
- it "should save data for output to the output file with additional CSS and HTML" do
40
- @foo.data_for_output = ["OH MY!"]
41
- @foo.save_to_file
42
-
43
- test_string = ''
44
-
45
- # Puts each file from output to string for test
46
- File.open(@foo.output, 'r') do |file|
47
- file.each_line do |line|
48
- test_string << "#{line} \n"
49
- end
50
- end
51
-
52
- # Additional HTML and CSS should be added
53
- test_string.should match(/<html/)
54
- test_string.should match(/<head/)
55
- test_string.should match(/<style/)
56
- test_string.should match(/<body/)
57
- end
58
-
59
- it "should save data for output to the output file without additional HTML and CSS" do
60
-
61
- @egg = @klass.new('example.txt', nil, false)
62
-
63
- @egg.data_for_output = ["OH MY!"]
64
- @egg.save_to_file
65
-
66
- test_string = ''
67
-
68
- # Puts each file from output to string for test
69
- File.open(@egg.output, 'r') do |file|
70
- file.each_line do |line|
71
- test_string << "#{line} \n"
72
- end
73
- end
74
-
75
- # Additional HTML and CSS should not be added
76
- test_string.should_not match(/<html/)
77
- test_string.should_not match(/<head/)
78
- test_string.should_not match(/<style/)
79
- test_string.should_not match(/<body/)
80
- end
81
-
82
- after :all do
83
- # Remove testfiles (outputs)
84
- [@foo.output, @egg.output].each do |file|
85
- FileUtils.rm(file)
86
- end
87
- end
88
- end
@@ -1,34 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe RedMark do
4
- before :all do
5
- @testfile = 'testfile.txt'
6
-
7
- File.open(@testfile, 'w+') do |file|
8
- file.puts "h1. O HAI!
9
-
10
- Lorem *ipsum* dolor sit amet, _consectetur_ adipiscing elit. Sed iaculis rutrum lobortis. Integer vitae magna dolor, luctus venenatis lorem. Etiam magna urna, porta non scelerisque ut, porttitor non purus. Nunc et tortor at eros venenatis molestie. Maecenas ut nulla ac leo congue porttitor. Phasellus vitae sem dolor, vitae elementum diam. Phasellus adipiscing augue nec dui fermentum bibendum. Donec ultrices tortor non lorem egestas ut pharetra diam \"vestibulum\":http://google.com in your face.
11
-
12
- In ullamcorper placerat justo, ut dictum lorem sollicitudin a. Pellentesque dictum volutpat nisl, non rutrum dolor pharetra ut. Curabitur a elementum mi. Duis eu tellus eu justo ultrices tincidunt. Mauris blandit dui ac eros varius quis lacinia velit semper. Vivamus eu augue elit. Quisque lacinia sapien vel purus eleifend scelerisque feugiat quam sollicitudin. Pellentesque accumsan adipiscing leo, ut porttitor felis adipiscing id. Fusce cursus, lorem quis mollis commodo, dolor ipsum mattis lacus, ut suscipit augue lorem malesuada felis."
13
- end
14
- end
15
-
16
- before :each do
17
- @redmark = RedMark.new(@testfile)
18
- end
19
-
20
- it "should convert data from input file to HTML (Textile -> HTML)" do
21
-
22
- @redmark.convert
23
-
24
- @redmark.data_for_output.should_not be_empty
25
-
26
- @redmark.data_for_output.join("\n").should match(/<.+>/) # <.+> is the HTML tag
27
-
28
- end
29
-
30
- after :all do
31
- # Remove testfile (input)
32
- FileUtils.rm(@redmark.file)
33
- end
34
- end