breakout_parser 0.0.8-x86-mswin32 → 0.0.11-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/spec/parser_spec.rb CHANGED
@@ -114,6 +114,12 @@ describe 'BreakoutParser' do
114
114
  parse(" @code1@ @code2@ ").should == "<code>code1</code> <code>code2</code>"
115
115
  parse(" @code1@ xxx @code2@ ").should == "<code>code1</code> xxx <code>code2</code>"
116
116
  end
117
+ %w', .'.each do |c|
118
+ it "stops on #{c.inspect}" do
119
+ parse("@some code@#{c}").should == "<code>some code</code>#{c}"
120
+ parse("@some code@#{c} @another code@").should == "<code>some code</code>#{c} <code>another code</code>"
121
+ end
122
+ end
117
123
  end
118
124
 
119
125
  ###############################################################################
@@ -138,13 +144,13 @@ describe 'BreakoutParser' do
138
144
  parse("aaa * bbb").should == 'aaa * bbb'
139
145
  end
140
146
  it "w/o closing tag" do
141
- parse("*bold").should == '<strong>bold</strong>'
147
+ parse("*bold").should == '*bold'
142
148
  end
143
149
  it "nesting1 w/o closing tags" do
144
- parse("*bold1 *bold2").should == '<strong>bold1 <strong>bold2</strong></strong>'
150
+ parse("*bold1 *bold2").gsub(/ +/,' ').should == '*bold1 *bold2'
145
151
  end
146
152
  it "nesting2 w/o closing tags" do
147
- parse("*bold1 *bold2").should == '<strong>bold1 <strong>bold2</strong></strong>'
153
+ parse("*bold1 *bold2").gsub(/ +/,' ').should == '*bold1 *bold2'
148
154
  end
149
155
 
150
156
  it "not parses '*.*'" do
@@ -183,30 +189,57 @@ describe 'BreakoutParser' do
183
189
  parse("aaa _ bbb").should == 'aaa _ bbb'
184
190
  end
185
191
  it "w/o closing tag" do
186
- parse("_italic").should == '<em>italic</em>'
192
+ parse("_italic").should == '_italic'
187
193
  end
188
194
  it "nesting1 w/o closing tags" do
189
- parse("_italic1 _italic2").should == '<em>italic1 <em>italic2</em></em>'
195
+ parse("_italic1 _italic2").gsub(/ +/,' ').should == '_italic1 _italic2'
190
196
  end
191
197
  it "nesting2 w/o closing tags" do
192
- parse("_italic1 _italic2").should == '<em>italic1 <em>italic2</em></em>'
198
+ parse("_italic1 _italic2").gsub(/ +/,' ').should == '_italic1 _italic2'
193
199
  end
194
200
  end
195
201
 
196
202
  ###############################################################################
197
203
 
198
204
  describe "combinations" do
205
+ it "both bold and italic" do
206
+ s = "_*aaa bbb ccc*_"
207
+ parse(s).should == "<em><strong>aaa bbb ccc</strong></em>"
208
+ end
209
+ it "both italic and bold" do
210
+ s = "*_aaa bbb ccc_*"
211
+ parse(s).should == "<strong><em>aaa bbb ccc</em></strong>"
212
+ end
213
+
214
+ it "start b+i, end first italic then bold" do
215
+ s = "*_aaa bbb_ ccc*"
216
+ parse(s).should == "<strong><em>aaa bbb</em> ccc</strong>"
217
+ end
218
+ it "start i+b, end first bold then italic" do
219
+ s = "_*aaa bbb* ccc_"
220
+ parse(s).should == "<em><strong>aaa bbb</strong> ccc</em>"
221
+ end
222
+
223
+ it "start first italic then bold, end both" do
224
+ s = "_aaa *bbb ccc*_"
225
+ parse(s).should == "<em>aaa <strong>bbb ccc</strong></em>"
226
+ end
227
+ it "start first bold then italic, end both" do
228
+ s = "*aaa _bbb ccc_*"
229
+ parse(s).should == "<strong>aaa <em>bbb ccc</em></strong>"
230
+ end
231
+
199
232
  it "bold in italic" do
200
233
  s = "_aaa *bbb* ccc_"
201
234
  parse(s).should == "<em>aaa <strong>bbb</strong> ccc</em>"
202
235
  end
203
236
  it "bold in italic - no closing1" do
204
237
  s = "_aaa *bbb* ccc"
205
- parse(s).should == "<em>aaa <strong>bbb</strong> ccc</em>"
238
+ parse(s).should == "_aaa <strong>bbb</strong> ccc"
206
239
  end
207
240
  it "bold in italic - no closing2" do
208
241
  s = "_aaa *bbb ccc"
209
- parse(s).should == "<em>aaa <strong>bbb ccc</strong></em>"
242
+ parse(s).gsub(/ {2,}/,' ').should == "_aaa *bbb ccc"
210
243
  end
211
244
 
212
245
  it "italic in bold" do
@@ -215,11 +248,11 @@ describe 'BreakoutParser' do
215
248
  end
216
249
  it "italic in bold - no closing1" do
217
250
  s = "*aaa _bbb_ ccc"
218
- parse(s).should == "<strong>aaa <em>bbb</em> ccc</strong>"
251
+ parse(s).should == "*aaa <em>bbb</em> ccc"
219
252
  end
220
253
  it "italic in bold - no closing2" do
221
254
  s = "*aaa _bbb ccc"
222
- parse(s).should == "<strong>aaa <em>bbb ccc</em></strong>"
255
+ parse(s).gsub(/ {2,}/,' ').should == "*aaa _bbb ccc"
223
256
  end
224
257
 
225
258
  {'ul' => '*', 'ol' => '#'}.each do |l,c|
@@ -704,11 +737,11 @@ describe 'BreakoutParser' do
704
737
 
705
738
  a["ticket:234"] = '<a href="/spaces/test_space/tickets/234">#234</a>'
706
739
  a["revision:1f4bdab77be696efd"] =
707
- '<a href="http://code.assembla.com/test_space/git/changesets/1f4bdab77be696efd">revision:1f4bdab77be696efd</a>'
740
+ '<a href="/code/test_space/git/changesets/1f4bdab77be696efd">revision:1f4bdab77be696efd</a>'
708
741
  a["revision:12345"] =
709
- '<a href="http://code.assembla.com/test_space/svn/changesets/12345">revision:12345</a>'
710
- a["r:2345"] = '<a href="http://code.assembla.com/test_space/svn/changesets/2345">revision:2345</a>'
711
- a["r:2345ef"] = '<a href="http://code.assembla.com/test_space/git/changesets/2345ef">revision:2345ef</a>'
742
+ '<a href="/code/test_space/subversion/changesets/12345">revision:12345</a>'
743
+ a["r:2345"] = '<a href="/code/test_space/subversion/changesets/2345">revision:2345</a>'
744
+ a["r:2345ef"] = '<a href="/code/test_space/git/changesets/2345ef">revision:2345ef</a>'
712
745
 
713
746
  a["url:http://www.ru"] = '<a rel="nofollow" href="http://www.ru">http://www.ru</a>'
714
747
  a["url:https://www.ru"] = '<a rel="nofollow" href="https://www.ru">https://www.ru</a>'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breakout_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.11
5
5
  platform: x86-mswin32
6
6
  authors:
7
7
  - Andrey "Zed" Zaikin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-12 00:00:00 +05:00
12
+ date: 2010-03-30 00:00:00 +06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency