breakout_parser 0.0.6-x86-mingw32 → 0.0.7-x86-mingw32

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/spec/parser_spec.rb CHANGED
@@ -429,11 +429,18 @@ describe 'BreakoutParser' do
429
429
 
430
430
  [
431
431
  %w'<pre><code> </code></pre>',
432
- %w'<pre> </pre>'
432
+ %w'<pre> </pre>',
433
+ %w'<notextile> </notextile>'
433
434
  ].each do |ot,ct|
434
435
  # ot - opening tag
435
436
  # ct - closing tag
436
437
 
438
+ if ot == '<notextile>'
439
+ ote,cte = '',''
440
+ else
441
+ ote,cte = ot,ct
442
+ end
443
+
437
444
  describe "#{ot}..#{ct}" do
438
445
  it "works" do
439
446
  s = <<-EOF
@@ -443,8 +450,7 @@ describe 'BreakoutParser' do
443
450
 
444
451
  EOF
445
452
 
446
- parse("#{ot}#{s.strip}#{ct}").should ==
447
- "#{ot}#{h(s.strip)}#{ct}"
453
+ parse("#{ot}#{s.strip}#{ct}").should == "#{ote}#{h(s.strip)}#{cte}"
448
454
 
449
455
  s = <<-EOF
450
456
  while ( 1 < 2 ) do
@@ -458,71 +464,70 @@ describe 'BreakoutParser' do
458
464
  * ccc
459
465
 
460
466
  EOF
461
- parse("#{ot}#{s.strip}#{ct}").should ==
462
- "#{ot}#{h(s.strip)}#{ct}"
467
+ parse("#{ot}#{s.strip}#{ct}").should == "#{ote}#{h(s.strip)}#{cte}"
463
468
  end
464
469
  it "not parses *bold*" do
465
470
  s = "#{ot} *bold*#{ct}"
466
- parse(s).should == s
471
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte).strip
467
472
  end
468
473
  it "not parses _italic_" do
469
474
  s = "#{ot} _italic_#{ct}"
470
- parse(s).should == s
475
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte).strip
471
476
  end
472
477
  it "not parses UL lists" do
473
478
  s = "#{ot}\n * l1\n * l2\n * l3#{ct}"
474
- parse(s).should == s.sub(">\n",">")
479
+ parse(s).should == s.sub(">\n",">").gsub(ot,ote).gsub(ct,cte).strip
475
480
  end
476
481
  it "not parses OL lists" do
477
482
  s = "#{ot}\n # l1\n # l2\n # l3#{ct}"
478
- parse(s).should == s.sub(">\n",">")
483
+ parse(s).should == s.sub(">\n",">").gsub(ot,ote).gsub(ct,cte).strip
479
484
  end
480
485
  it "not parses H1..H5" do
481
486
  1.upto(5) do |i|
482
487
  s = "#{ot}\nh#{i}. zzzzzzz\n#{ct}"
483
- parse(s).should == "#{ot}h#{i}. zzzzzzz#{ct}"
488
+ parse(s).should == "#{ote}h#{i}. zzzzzzz#{cte}"
484
489
  end
485
490
  end
486
491
  it "not parses raw text links" do
487
492
  s = "#{ot}xxx http://www.ru yyy#{ct}"
488
- parse(s).should == s
493
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
489
494
  s = "#{ot}http://www.ru#{ct}"
490
- parse(s).should == s
495
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
491
496
  end
492
497
  it "keeps newlines" do
493
498
  s = "#{ot}aaa\nbbb#{ct}"
494
- parse(s).should == s
499
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
495
500
  s = "#{ot}aaa\n\nbbb\nccc#{ct}"
496
- parse(s).should == s
501
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
497
502
  end
498
503
 
499
504
  it "w/o closing tags" do
500
505
  s = "#{ot}aaa"
501
- parse(s).should match(%r"#{ot}aaa\n?#{ct}")
506
+ parse(s).should match(%r"#{ote}aaa\n?#{cte}")
502
507
  end
503
508
 
504
509
  it "in middle of text" do
505
510
  s = "xxx #{ot}yyyy#{ct} jjj"
506
- parse(s).should == s
511
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
507
512
  end
508
513
 
509
514
  it "with 2 instances" do
510
515
  s = "xxx #{ot}yyyy#{ct} <jjj> #{ot}asdkjaslkd#{ct} END"
511
- parse(s).should == s.sub('<jjj>','&lt;jjj&gt;')
516
+ parse(s).should == s.sub('<jjj>','&lt;jjj&gt;').gsub(ot,ote).gsub(ct,cte)
512
517
  end
513
518
 
514
519
  it "works with unicode" do
515
520
  s = "привет #{ot} жжж #{ct} пока!"
516
- parse(s).should match(%r|привет ?#{ot} жжж#{ct} ?пока!|)
521
+ parse(s).should match(%r|привет ?#{ote} жжж#{cte} ?пока!|)
517
522
 
518
- s = 'абвгдеёжзийклмнопрстуфхцчшщьыъэюя'
519
- parse(s).should == s
523
+ s = "#{ot}абвгдеёжзийклмнопрстуфхцчшщьыъэюя#{ct}"
524
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
520
525
 
521
- s = 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ'
522
- parse(s).should == s
526
+ s = "#{ot}АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ#{ct}"
527
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
523
528
 
524
- s = '☸☹☺☻☼☽☾☿'
525
- parse(s).should == s
529
+ s = "#{ot}☸☹☺☻☼☽☾☿#{ct}"
530
+ parse(s).should == s.gsub(ot,ote).gsub(ct,cte)
526
531
  end
527
532
 
528
533
  it "should escape lone closing tags" do
@@ -532,12 +537,12 @@ describe 'BreakoutParser' do
532
537
 
533
538
  it "should skip newlines and spaces at end" do
534
539
  s = "#{ot} aaa bbb ccc \n\n\n \t\n\n\n\r\n\r\n \t #{ct}"
535
- parse(s).should == "#{ot} aaa bbb ccc#{ct}"
540
+ parse(s).should == "#{ote} aaa bbb ccc#{cte}".strip
536
541
  end
537
542
 
538
543
  it "escapes html chars" do
539
544
  HTML_ESCAPE.each do |k,v|
540
- parse("#{ot}#{k}#{ct}").should == "#{ot}#{v}#{ct}"
545
+ parse("#{ot}#{k}#{ct}").should == "#{ote}#{v}#{cte}"
541
546
  end
542
547
  end
543
548
  end
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.6
4
+ version: 0.0.7
5
5
  platform: x86-mingw32
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-02-25 00:00:00 +05:00
12
+ date: 2010-03-09 00:00:00 +05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency