RedCloth 4.3.2 → 4.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cb8013b7856c3d48cf999269f6e5ace370d013e0
4
- data.tar.gz: 7de8b1d1218414598ebf7a0c89421a14679fa034
2
+ SHA256:
3
+ metadata.gz: 3bf6223596d141287ffe67bb0321d0cb329110cf056730a6a88072123e61eb23
4
+ data.tar.gz: 66e55aa28a5fd6d69e9140fc822e9b299bd8fd8b68747cbb61b1322e1686774d
5
5
  SHA512:
6
- metadata.gz: 7e2a5a2be89e930fd388c0432413b41981d8862f27edf32bc32529db441e8b7380185d3dd221439ab3cb9cf2a89ff3cd1eb3f93d1577646ed07d7a264cbad4f7
7
- data.tar.gz: 0a28c28367cc94dbb0a256bfae245fe75257cf5e821813b4f802ee79158771b0627e60ea70796b02118b31eb9b6d712473c70a0d4dd58d80d08dbb9921c53289
6
+ metadata.gz: 330980e516cd9966d6860e92ca917d102c9957635bdf76869774a8b8893d372da7aeca4f5d69da3a8db6d98b3c2d8f97f5628f9c96309e34ea424503fbcdb40a
7
+ data.tar.gz: c1614dce1f131bed42fed09cef9e4679ef0d7f49868548d355ce1ee5d2753dd64f9c7e172e70d90a838464f70653c78f9e91e149f22909a6eadd63305969593e
data/CHANGELOG CHANGED
@@ -1,3 +1,17 @@
1
+ == 4.3.4 / Mar 13th, 2024
2
+
3
+ * A round of cleanups [Helio Cola]
4
+ * Stop checking for main function in libc [Jean byroot Boussier]
5
+ * Update maintainer, scrub redcloth.org [Jason Garber]
6
+ * Add GitHub action [Anton Maminov]
7
+
8
+ == 4.3.3 / Nov 2nd, 2023
9
+
10
+ * Add tests for CVE-2023-31606 [Helio Cola]
11
+ * Fix rake compile [Helio Cola and Faria Education Group]
12
+ * Fix CVE-2023-31606 (ReDOS possible in the sanitize_html function) [Kornelius Kalnbach and Merbin Russel]
13
+ * Immutable strings [Matijs van Zuijlen]
14
+
1
15
  == 4.3.2 / May 23rd, 2016
2
16
 
3
17
  * Fix additional case for CVE-2012-6684 [Joshua Siler]
data/README.rdoc CHANGED
@@ -1,14 +1,12 @@
1
1
  = RedCloth - Textile parser for Ruby
2
2
 
3
- Homepage:: http://redcloth.org
4
- Maintainer:: Joshua Siler https://github.com/joshuasiler
3
+ Homepage:: https://github.com/jgarber/redcloth
4
+ Maintainer:: Helio Cola https://github.com/heliocola
5
5
  Author:: Jason Garber
6
6
  Copyright:: (c) 2011 Jason Garber
7
7
  License:: MIT
8
8
 
9
- {<img src="https://travis-ci.org/jgarber/redcloth.svg" />}[https://travis-ci.org/jgarber/redcloth] {<img src="https://codeclimate.com/github/jgarber/redcloth/badges/gpa.svg" />}[https://codeclimate.com/github/jgarber/redcloth]
10
-
11
- (See http://redcloth.org/textile/ for a Textile reference.)
9
+ {rdoc-image:https://codeclimate.com/github/jgarber/redcloth/badges/gpa.svg}[https://codeclimate.com/github/jgarber/redcloth]
12
10
 
13
11
  = RedCloth
14
12
 
@@ -171,6 +169,13 @@ Example:
171
169
  Will become:
172
170
 
173
171
  <acronym title="American Civil Liberties Union">ACLU</acronym>
172
+
173
+ == Filtering HTML
174
+
175
+ RedCloth doesn't filter unsafe html tags by default, do to this use the following syntax:
176
+ RedCloth.new("<script>alert(1)</script>", [:filter_html]).to_html
177
+ which will filter the script tags from the HTML resulting in:
178
+ "&lt;script&gt;alert(1)&lt;/script&gt;"
174
179
 
175
180
  == Adding Tables
176
181
 
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'rubygems'
3
3
  require 'bundler'
4
- ENV['RUBYOPT'] = nil # Necessary to prevent Bundler from *&^%$#ing up rake-compiler.
5
4
 
6
5
  require 'rake/clean'
7
6
 
@@ -15,4 +14,4 @@ else
15
14
  Bundler.settings.without = [:compilation]
16
15
  Bundler.setup(:default, :development)
17
16
  load 'tasks/rspec.rake'
18
- end
17
+ end
@@ -2,5 +2,4 @@ require 'mkmf'
2
2
  CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
3
3
  $CFLAGS << ' -O0 -Wall ' if CONFIG['CC'] =~ /gcc/
4
4
  dir_config("redcloth_scan")
5
- have_library("c", "main")
6
5
  create_makefile("redcloth_scan")
@@ -7491,7 +7491,7 @@ _eof_trans:
7491
7491
  break;
7492
7492
  case 24:
7493
7493
  #line 103 "ragel/redcloth_inline.rl"
7494
- {te = p+1;{ CAT(block); {cs = 1270; goto _again;} }}
7494
+ {te = p+1;{ CAT(block); {cs = 1270;goto _again;} }}
7495
7495
  break;
7496
7496
  case 25:
7497
7497
  #line 6 "ragel/redcloth_common.c.rl"
@@ -7591,7 +7591,7 @@ _eof_trans:
7591
7591
  break;
7592
7592
  case 49:
7593
7593
  #line 116 "ragel/redcloth_inline.rl"
7594
- {te = p+1;{ CAT(block); {cs = 1516; goto _again;} }}
7594
+ {te = p+1;{ CAT(block); {cs = 1516;goto _again;} }}
7595
7595
  break;
7596
7596
  case 50:
7597
7597
  #line 117 "ragel/redcloth_inline.rl"
@@ -7735,7 +7735,7 @@ _eof_trans:
7735
7735
  break;
7736
7736
  case 85:
7737
7737
  #line 116 "ragel/redcloth_inline.rl"
7738
- {te = p;p--;{ CAT(block); {cs = 1516; goto _again;} }}
7738
+ {te = p;p--;{ CAT(block); {cs = 1516;goto _again;} }}
7739
7739
  break;
7740
7740
  case 86:
7741
7741
  #line 118 "ragel/redcloth_inline.rl"
@@ -7866,7 +7866,7 @@ _eof_trans:
7866
7866
  {{p = ((te))-1;} PASS_CODE(block, "text", "code"); }
7867
7867
  break;
7868
7868
  case 8:
7869
- {{p = ((te))-1;} CAT(block); {cs = 1516; goto _again;} }
7869
+ {{p = ((te))-1;} CAT(block); {cs = 1516;goto _again;} }
7870
7870
  break;
7871
7871
  case 10:
7872
7872
  {{p = ((te))-1;} PARSE_ATTR("text"); PASS(block, "text", "strong"); }
@@ -23459,7 +23459,7 @@ _eof_trans:
23459
23459
  break;
23460
23460
  case 58:
23461
23461
  #line 150 "ragel/redcloth_scan.rl"
23462
- { SET_ATTRIBUTES(); {cs = 2479; goto _again;} }
23462
+ { SET_ATTRIBUTES(); {cs = 2479;goto _again;} }
23463
23463
  break;
23464
23464
  case 61:
23465
23465
  #line 1 "NONE"
@@ -23467,7 +23467,7 @@ _eof_trans:
23467
23467
  break;
23468
23468
  case 62:
23469
23469
  #line 72 "ragel/redcloth_scan.rl"
23470
- {te = p+1;{ CAT(block); DONE(block); {cs = 2250; goto _again;} }}
23470
+ {te = p+1;{ CAT(block); DONE(block); {cs = 2250;goto _again;} }}
23471
23471
  break;
23472
23472
  case 63:
23473
23473
  #line 6 "ragel/redcloth_common.c.rl"
@@ -23475,7 +23475,7 @@ _eof_trans:
23475
23475
  break;
23476
23476
  case 64:
23477
23477
  #line 72 "ragel/redcloth_scan.rl"
23478
- {te = p;p--;{ CAT(block); DONE(block); {cs = 2250; goto _again;} }}
23478
+ {te = p;p--;{ CAT(block); DONE(block); {cs = 2250;goto _again;} }}
23479
23479
  break;
23480
23480
  case 65:
23481
23481
  #line 6 "ragel/redcloth_common.c.rl"
@@ -23499,15 +23499,15 @@ _eof_trans:
23499
23499
  break;
23500
23500
  case 70:
23501
23501
  #line 77 "ragel/redcloth_scan.rl"
23502
- {te = p+1;{ ADD_BLOCKCODE(); {cs = 2250; goto _again;} }}
23502
+ {te = p+1;{ ADD_BLOCKCODE(); {cs = 2250;goto _again;} }}
23503
23503
  break;
23504
23504
  case 71:
23505
23505
  #line 80 "ragel/redcloth_scan.rl"
23506
- {te = p+1;{ ADD_EXTENDED_BLOCKCODE(); END_EXTENDED(); {cs = 2250; goto _again;} }}
23506
+ {te = p+1;{ ADD_EXTENDED_BLOCKCODE(); END_EXTENDED(); {cs = 2250;goto _again;} }}
23507
23507
  break;
23508
23508
  case 72:
23509
23509
  #line 81 "ragel/redcloth_scan.rl"
23510
- {te = p+1;{ ADD_BLOCKCODE(); {cs = 2250; goto _again;} }}
23510
+ {te = p+1;{ ADD_BLOCKCODE(); {cs = 2250;goto _again;} }}
23511
23511
  break;
23512
23512
  case 73:
23513
23513
  #line 6 "ragel/redcloth_common.c.rl"
@@ -23519,7 +23519,7 @@ _eof_trans:
23519
23519
  break;
23520
23520
  case 75:
23521
23521
  #line 79 "ragel/redcloth_scan.rl"
23522
- {te = p;p--;{ ADD_BLOCKCODE(); {cs = 2250; goto _again;} }}
23522
+ {te = p;p--;{ ADD_BLOCKCODE(); {cs = 2250;goto _again;} }}
23523
23523
  break;
23524
23524
  case 76:
23525
23525
  #line 6 "ragel/redcloth_common.c.rl"
@@ -23536,7 +23536,7 @@ _eof_trans:
23536
23536
  {{p = ((te))-1;} ADD_EXTENDED_BLOCKCODE(); }
23537
23537
  break;
23538
23538
  case 5:
23539
- {{p = ((te))-1;} ADD_BLOCKCODE(); {cs = 2250; goto _again;} }
23539
+ {{p = ((te))-1;} ADD_BLOCKCODE(); {cs = 2250;goto _again;} }
23540
23540
  break;
23541
23541
  case 8:
23542
23542
  {{p = ((te))-1;} rb_str_cat_escaped_for_preformatted(self, block, ts, te); }
@@ -23546,11 +23546,11 @@ _eof_trans:
23546
23546
  break;
23547
23547
  case 79:
23548
23548
  #line 86 "ragel/redcloth_scan.rl"
23549
- {te = p+1;{ CAT(block); ASET("type", "ignore"); ADD_BLOCK(); {cs = 2250; goto _again;} }}
23549
+ {te = p+1;{ CAT(block); ASET("type", "ignore"); ADD_BLOCK(); {cs = 2250;goto _again;} }}
23550
23550
  break;
23551
23551
  case 80:
23552
23552
  #line 87 "ragel/redcloth_scan.rl"
23553
- {te = p+1;{ ASET("type", "ignore"); ADD_BLOCK(); {cs = 2250; goto _again;} }}
23553
+ {te = p+1;{ ASET("type", "ignore"); ADD_BLOCK(); {cs = 2250;goto _again;} }}
23554
23554
  break;
23555
23555
  case 81:
23556
23556
  #line 11 "ragel/redcloth_common.rl"
@@ -23558,7 +23558,7 @@ _eof_trans:
23558
23558
  break;
23559
23559
  case 82:
23560
23560
  #line 86 "ragel/redcloth_scan.rl"
23561
- {te = p;p--;{ CAT(block); ASET("type", "ignore"); ADD_BLOCK(); {cs = 2250; goto _again;} }}
23561
+ {te = p;p--;{ CAT(block); ASET("type", "ignore"); ADD_BLOCK(); {cs = 2250;goto _again;} }}
23562
23562
  break;
23563
23563
  case 83:
23564
23564
  #line 11 "ragel/redcloth_common.rl"
@@ -23570,7 +23570,7 @@ _eof_trans:
23570
23570
  break;
23571
23571
  case 85:
23572
23572
  #line 92 "ragel/redcloth_scan.rl"
23573
- {te = p+1;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23573
+ {te = p+1;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23574
23574
  break;
23575
23575
  case 86:
23576
23576
  #line 11 "ragel/redcloth_common.rl"
@@ -23590,15 +23590,15 @@ _eof_trans:
23590
23590
  break;
23591
23591
  case 90:
23592
23592
  #line 97 "ragel/redcloth_scan.rl"
23593
- {te = p+1;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23593
+ {te = p+1;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23594
23594
  break;
23595
23595
  case 91:
23596
23596
  #line 100 "ragel/redcloth_scan.rl"
23597
- {te = p+1;{ CAT(block); ADD_EXTENDED_BLOCK(); END_EXTENDED(); {cs = 2250; goto _again;} }}
23597
+ {te = p+1;{ CAT(block); ADD_EXTENDED_BLOCK(); END_EXTENDED(); {cs = 2250;goto _again;} }}
23598
23598
  break;
23599
23599
  case 92:
23600
23600
  #line 101 "ragel/redcloth_scan.rl"
23601
- {te = p+1;{ ADD_BLOCK(); CAT(html); {cs = 2250; goto _again;} }}
23601
+ {te = p+1;{ ADD_BLOCK(); CAT(html); {cs = 2250;goto _again;} }}
23602
23602
  break;
23603
23603
  case 93:
23604
23604
  #line 11 "ragel/redcloth_common.rl"
@@ -23610,7 +23610,7 @@ _eof_trans:
23610
23610
  break;
23611
23611
  case 95:
23612
23612
  #line 99 "ragel/redcloth_scan.rl"
23613
- {te = p;p--;{ ADD_BLOCK(); CAT(html); {cs = 2250; goto _again;} }}
23613
+ {te = p;p--;{ ADD_BLOCK(); CAT(html); {cs = 2250;goto _again;} }}
23614
23614
  break;
23615
23615
  case 96:
23616
23616
  #line 11 "ragel/redcloth_common.rl"
@@ -23627,7 +23627,7 @@ _eof_trans:
23627
23627
  {{p = ((te))-1;} CAT(block); ADD_EXTENDED_BLOCK(); CAT(html); }
23628
23628
  break;
23629
23629
  case 16:
23630
- {{p = ((te))-1;} ADD_BLOCK(); CAT(html); {cs = 2250; goto _again;} }
23630
+ {{p = ((te))-1;} ADD_BLOCK(); CAT(html); {cs = 2250;goto _again;} }
23631
23631
  break;
23632
23632
  case 19:
23633
23633
  {{p = ((te))-1;} CAT(block); }
@@ -23641,7 +23641,7 @@ _eof_trans:
23641
23641
  break;
23642
23642
  case 100:
23643
23643
  #line 106 "ragel/redcloth_scan.rl"
23644
- {te = p;p--;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23644
+ {te = p;p--;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23645
23645
  break;
23646
23646
  case 101:
23647
23647
  #line 11 "ragel/redcloth_common.rl"
@@ -23665,15 +23665,15 @@ _eof_trans:
23665
23665
  break;
23666
23666
  case 106:
23667
23667
  #line 111 "ragel/redcloth_scan.rl"
23668
- {te = p+1;{ ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250; goto _again;} }}
23668
+ {te = p+1;{ ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250;goto _again;} }}
23669
23669
  break;
23670
23670
  case 107:
23671
23671
  #line 114 "ragel/redcloth_scan.rl"
23672
- {te = p+1;{ ADD_EXTENDED_BLOCKCODE(); CAT(html); RSTRIP_BANG(html); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); END_EXTENDED(); {cs = 2250; goto _again;} }}
23672
+ {te = p+1;{ ADD_EXTENDED_BLOCKCODE(); CAT(html); RSTRIP_BANG(html); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); END_EXTENDED(); {cs = 2250;goto _again;} }}
23673
23673
  break;
23674
23674
  case 108:
23675
23675
  #line 115 "ragel/redcloth_scan.rl"
23676
- {te = p+1;{ ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250; goto _again;} }}
23676
+ {te = p+1;{ ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250;goto _again;} }}
23677
23677
  break;
23678
23678
  case 109:
23679
23679
  #line 6 "ragel/redcloth_common.c.rl"
@@ -23685,7 +23685,7 @@ _eof_trans:
23685
23685
  break;
23686
23686
  case 111:
23687
23687
  #line 113 "ragel/redcloth_scan.rl"
23688
- {te = p;p--;{ ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250; goto _again;} }}
23688
+ {te = p;p--;{ ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250;goto _again;} }}
23689
23689
  break;
23690
23690
  case 112:
23691
23691
  #line 6 "ragel/redcloth_common.c.rl"
@@ -23702,7 +23702,7 @@ _eof_trans:
23702
23702
  {{p = ((te))-1;} ADD_EXTENDED_BLOCKCODE(); CAT(html); }
23703
23703
  break;
23704
23704
  case 24:
23705
- {{p = ((te))-1;} ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250; goto _again;} }
23705
+ {{p = ((te))-1;} ADD_BLOCKCODE(); INLINE(html, "bc_close"); SET_PLAIN_BLOCK("p"); {cs = 2250;goto _again;} }
23706
23706
  break;
23707
23707
  case 27:
23708
23708
  {{p = ((te))-1;} rb_str_cat_escaped_for_preformatted(self, block, ts, te); }
@@ -23724,23 +23724,23 @@ _eof_trans:
23724
23724
  break;
23725
23725
  case 118:
23726
23726
  #line 120 "ragel/redcloth_scan.rl"
23727
- {te = p+1;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250; goto _again;} }}
23727
+ {te = p+1;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250;goto _again;} }}
23728
23728
  break;
23729
23729
  case 119:
23730
23730
  #line 123 "ragel/redcloth_scan.rl"
23731
- {te = p+1;{ ADD_EXTENDED_BLOCK(); INLINE(html, "bq_close"); END_EXTENDED(); {cs = 2250; goto _again;} }}
23731
+ {te = p+1;{ ADD_EXTENDED_BLOCK(); INLINE(html, "bq_close"); END_EXTENDED(); {cs = 2250;goto _again;} }}
23732
23732
  break;
23733
23733
  case 120:
23734
23734
  #line 124 "ragel/redcloth_scan.rl"
23735
- {te = p+1;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250; goto _again;} }}
23735
+ {te = p+1;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250;goto _again;} }}
23736
23736
  break;
23737
23737
  case 121:
23738
23738
  #line 125 "ragel/redcloth_scan.rl"
23739
- {te = p+1;{ ADD_EXTENDED_BLOCK(); INLINE(html, "bq_close"); END_EXTENDED(); {cs = 2250; goto _again;} }}
23739
+ {te = p+1;{ ADD_EXTENDED_BLOCK(); INLINE(html, "bq_close"); END_EXTENDED(); {cs = 2250;goto _again;} }}
23740
23740
  break;
23741
23741
  case 122:
23742
23742
  #line 126 "ragel/redcloth_scan.rl"
23743
- {te = p+1;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250; goto _again;} }}
23743
+ {te = p+1;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250;goto _again;} }}
23744
23744
  break;
23745
23745
  case 123:
23746
23746
  #line 11 "ragel/redcloth_common.rl"
@@ -23752,7 +23752,7 @@ _eof_trans:
23752
23752
  break;
23753
23753
  case 125:
23754
23754
  #line 122 "ragel/redcloth_scan.rl"
23755
- {te = p;p--;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250; goto _again;} }}
23755
+ {te = p;p--;{ ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250;goto _again;} }}
23756
23756
  break;
23757
23757
  case 126:
23758
23758
  #line 11 "ragel/redcloth_common.rl"
@@ -23769,7 +23769,7 @@ _eof_trans:
23769
23769
  {{p = ((te))-1;} ADD_EXTENDED_BLOCK(); }
23770
23770
  break;
23771
23771
  case 30:
23772
- {{p = ((te))-1;} ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250; goto _again;} }
23772
+ {{p = ((te))-1;} ADD_BLOCK(); INLINE(html, "bq_close"); {cs = 2250;goto _again;} }
23773
23773
  break;
23774
23774
  case 35:
23775
23775
  {{p = ((te))-1;} CAT(block); }
@@ -23795,23 +23795,23 @@ _eof_trans:
23795
23795
  break;
23796
23796
  case 133:
23797
23797
  #line 131 "ragel/redcloth_scan.rl"
23798
- {te = p+1;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23798
+ {te = p+1;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23799
23799
  break;
23800
23800
  case 134:
23801
23801
  #line 134 "ragel/redcloth_scan.rl"
23802
- {te = p+1;{ ADD_EXTENDED_BLOCK(); END_EXTENDED(); {cs = 2250; goto _again;} }}
23802
+ {te = p+1;{ ADD_EXTENDED_BLOCK(); END_EXTENDED(); {cs = 2250;goto _again;} }}
23803
23803
  break;
23804
23804
  case 135:
23805
23805
  #line 135 "ragel/redcloth_scan.rl"
23806
- {te = p+1;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23806
+ {te = p+1;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23807
23807
  break;
23808
23808
  case 136:
23809
23809
  #line 136 "ragel/redcloth_scan.rl"
23810
- {te = p+1;{ ADD_EXTENDED_BLOCK(); END_EXTENDED(); {cs = 2250; goto _again;} }}
23810
+ {te = p+1;{ ADD_EXTENDED_BLOCK(); END_EXTENDED(); {cs = 2250;goto _again;} }}
23811
23811
  break;
23812
23812
  case 137:
23813
23813
  #line 137 "ragel/redcloth_scan.rl"
23814
- {te = p+1;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23814
+ {te = p+1;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23815
23815
  break;
23816
23816
  case 138:
23817
23817
  #line 11 "ragel/redcloth_common.rl"
@@ -23823,11 +23823,11 @@ _eof_trans:
23823
23823
  break;
23824
23824
  case 140:
23825
23825
  #line 133 "ragel/redcloth_scan.rl"
23826
- {te = p;p--;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23826
+ {te = p;p--;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23827
23827
  break;
23828
23828
  case 141:
23829
23829
  #line 138 "ragel/redcloth_scan.rl"
23830
- {te = p;p--;{ ADD_BLOCK(); CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159; goto _again;} }}
23830
+ {te = p;p--;{ ADD_BLOCK(); CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159;goto _again;} }}
23831
23831
  break;
23832
23832
  case 142:
23833
23833
  #line 11 "ragel/redcloth_common.rl"
@@ -23844,10 +23844,10 @@ _eof_trans:
23844
23844
  {{p = ((te))-1;} ADD_EXTENDED_BLOCK(); }
23845
23845
  break;
23846
23846
  case 38:
23847
- {{p = ((te))-1;} ADD_BLOCK(); {cs = 2250; goto _again;} }
23847
+ {{p = ((te))-1;} ADD_BLOCK(); {cs = 2250;goto _again;} }
23848
23848
  break;
23849
23849
  case 43:
23850
- {{p = ((te))-1;} ADD_BLOCK(); CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159; goto _again;} }
23850
+ {{p = ((te))-1;} ADD_BLOCK(); CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159;goto _again;} }
23851
23851
  break;
23852
23852
  case 44:
23853
23853
  {{p = ((te))-1;} CAT(block); }
@@ -23857,7 +23857,7 @@ _eof_trans:
23857
23857
  break;
23858
23858
  case 145:
23859
23859
  #line 144 "ragel/redcloth_scan.rl"
23860
- {te = p+1;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23860
+ {te = p+1;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23861
23861
  break;
23862
23862
  case 146:
23863
23863
  #line 11 "ragel/redcloth_common.rl"
@@ -23865,7 +23865,7 @@ _eof_trans:
23865
23865
  break;
23866
23866
  case 147:
23867
23867
  #line 144 "ragel/redcloth_scan.rl"
23868
- {te = p;p--;{ ADD_BLOCK(); {cs = 2250; goto _again;} }}
23868
+ {te = p;p--;{ ADD_BLOCK(); {cs = 2250;goto _again;} }}
23869
23869
  break;
23870
23870
  case 148:
23871
23871
  #line 11 "ragel/redcloth_common.rl"
@@ -23885,7 +23885,7 @@ _eof_trans:
23885
23885
  break;
23886
23886
  case 152:
23887
23887
  #line 154 "ragel/redcloth_scan.rl"
23888
- {te = p+1;{ ADD_BLOCK(); RESET_NEST(); LIST_LAYOUT(); {cs = 2250; goto _again;} }}
23888
+ {te = p+1;{ ADD_BLOCK(); RESET_NEST(); LIST_LAYOUT(); {cs = 2250;goto _again;} }}
23889
23889
  break;
23890
23890
  case 153:
23891
23891
  #line 11 "ragel/redcloth_common.rl"
@@ -23893,11 +23893,11 @@ _eof_trans:
23893
23893
  break;
23894
23894
  case 154:
23895
23895
  #line 153 "ragel/redcloth_scan.rl"
23896
- {te = p;p--;{ ADD_BLOCK(); LIST_LAYOUT(); {cs = 2159; goto _again;} }}
23896
+ {te = p;p--;{ ADD_BLOCK(); LIST_LAYOUT(); {cs = 2159;goto _again;} }}
23897
23897
  break;
23898
23898
  case 155:
23899
23899
  #line 154 "ragel/redcloth_scan.rl"
23900
- {te = p;p--;{ ADD_BLOCK(); RESET_NEST(); LIST_LAYOUT(); {cs = 2250; goto _again;} }}
23900
+ {te = p;p--;{ ADD_BLOCK(); RESET_NEST(); LIST_LAYOUT(); {cs = 2250;goto _again;} }}
23901
23901
  break;
23902
23902
  case 156:
23903
23903
  #line 11 "ragel/redcloth_common.rl"
@@ -23911,7 +23911,7 @@ _eof_trans:
23911
23911
  #line 1 "NONE"
23912
23912
  { switch( act ) {
23913
23913
  case 47:
23914
- {{p = ((te))-1;} ADD_BLOCK(); LIST_LAYOUT(); {cs = 2159; goto _again;} }
23914
+ {{p = ((te))-1;} ADD_BLOCK(); LIST_LAYOUT(); {cs = 2159;goto _again;} }
23915
23915
  break;
23916
23916
  case 49:
23917
23917
  {{p = ((te))-1;} CAT(block); }
@@ -23925,7 +23925,7 @@ _eof_trans:
23925
23925
  break;
23926
23926
  case 160:
23927
23927
  #line 162 "ragel/redcloth_scan.rl"
23928
- {te = p+1;{ ADD_BLOCK(); INLINE(html, "dl_close"); {cs = 2250; goto _again;} }}
23928
+ {te = p+1;{ ADD_BLOCK(); INLINE(html, "dl_close"); {cs = 2250;goto _again;} }}
23929
23929
  break;
23930
23930
  case 161:
23931
23931
  #line 11 "ragel/redcloth_common.rl"
@@ -23941,7 +23941,7 @@ _eof_trans:
23941
23941
  break;
23942
23942
  case 164:
23943
23943
  #line 162 "ragel/redcloth_scan.rl"
23944
- {te = p;p--;{ ADD_BLOCK(); INLINE(html, "dl_close"); {cs = 2250; goto _again;} }}
23944
+ {te = p;p--;{ ADD_BLOCK(); INLINE(html, "dl_close"); {cs = 2250;goto _again;} }}
23945
23945
  break;
23946
23946
  case 165:
23947
23947
  #line 11 "ragel/redcloth_common.rl"
@@ -24009,7 +24009,7 @@ _eof_trans:
24009
24009
  break;
24010
24010
  case 181:
24011
24011
  #line 171 "ragel/redcloth_scan.rl"
24012
- {te = p+1;{ ASET("type", "notextile"); CAT(block); {cs = 2420; goto _again;} }}
24012
+ {te = p+1;{ ASET("type", "notextile"); CAT(block); {cs = 2420;goto _again;} }}
24013
24013
  break;
24014
24014
  case 182:
24015
24015
  #line 173 "ragel/redcloth_scan.rl"
@@ -24029,7 +24029,7 @@ _eof_trans:
24029
24029
  CLEAR_REGS();
24030
24030
  RESET_TYPE();
24031
24031
  CAT(block);
24032
- {cs = 2465; goto _again;}
24032
+ {cs = 2465;goto _again;}
24033
24033
  }}
24034
24034
  break;
24035
24035
  case 186:
@@ -24038,7 +24038,7 @@ _eof_trans:
24038
24038
  break;
24039
24039
  case 187:
24040
24040
  #line 167 "ragel/redcloth_scan.rl"
24041
- {te = p;p--;{ ASET("type", "ignored_line"); {cs = 2434; goto _again;} }}
24041
+ {te = p;p--;{ ASET("type", "ignored_line"); {cs = 2434;goto _again;} }}
24042
24042
  break;
24043
24043
  case 188:
24044
24044
  #line 168 "ragel/redcloth_scan.rl"
@@ -24046,19 +24046,19 @@ _eof_trans:
24046
24046
  break;
24047
24047
  case 189:
24048
24048
  #line 169 "ragel/redcloth_scan.rl"
24049
- {te = p;p--;{ ASET("type", "notextile"); {cs = 2435; goto _again;} }}
24049
+ {te = p;p--;{ ASET("type", "notextile"); {cs = 2435;goto _again;} }}
24050
24050
  break;
24051
24051
  case 190:
24052
24052
  #line 170 "ragel/redcloth_scan.rl"
24053
- {te = p;p--;{ CAT(block); {cs = 2431; goto _again;} }}
24053
+ {te = p;p--;{ CAT(block); {cs = 2431;goto _again;} }}
24054
24054
  break;
24055
24055
  case 191:
24056
24056
  #line 171 "ragel/redcloth_scan.rl"
24057
- {te = p;p--;{ ASET("type", "notextile"); CAT(block); {cs = 2420; goto _again;} }}
24057
+ {te = p;p--;{ ASET("type", "notextile"); CAT(block); {cs = 2420;goto _again;} }}
24058
24058
  break;
24059
24059
  case 192:
24060
24060
  #line 172 "ragel/redcloth_scan.rl"
24061
- {te = p;p--;{ {cs = 2423; goto _again;} }}
24061
+ {te = p;p--;{ {cs = 2423;goto _again;} }}
24062
24062
  break;
24063
24063
  case 193:
24064
24064
  #line 173 "ragel/redcloth_scan.rl"
@@ -24066,23 +24066,23 @@ _eof_trans:
24066
24066
  break;
24067
24067
  case 194:
24068
24068
  #line 174 "ragel/redcloth_scan.rl"
24069
- {te = p;p--;{ ASET("type", "html_block"); {cs = 2443; goto _again;} }}
24069
+ {te = p;p--;{ ASET("type", "html_block"); {cs = 2443;goto _again;} }}
24070
24070
  break;
24071
24071
  case 195:
24072
24072
  #line 175 "ragel/redcloth_scan.rl"
24073
- {te = p;p--;{ INLINE(html, "bc_open"); ASET("type", "code"); SET_PLAIN_BLOCK("code"); {cs = 2449; goto _again;} }}
24073
+ {te = p;p--;{ INLINE(html, "bc_open"); ASET("type", "code"); SET_PLAIN_BLOCK("code"); {cs = 2449;goto _again;} }}
24074
24074
  break;
24075
24075
  case 196:
24076
24076
  #line 176 "ragel/redcloth_scan.rl"
24077
- {te = p;p--;{ INLINE(html, "bq_open"); ASET("type", "p"); {cs = 2457; goto _again;} }}
24077
+ {te = p;p--;{ INLINE(html, "bq_open"); ASET("type", "p"); {cs = 2457;goto _again;} }}
24078
24078
  break;
24079
24079
  case 197:
24080
24080
  #line 177 "ragel/redcloth_scan.rl"
24081
- {te = p;p--;{ {cs = 2465; goto _again;} }}
24081
+ {te = p;p--;{ {cs = 2465;goto _again;} }}
24082
24082
  break;
24083
24083
  case 198:
24084
24084
  #line 178 "ragel/redcloth_scan.rl"
24085
- {te = p;p--;{ {cs = 2475; goto _again;} }}
24085
+ {te = p;p--;{ {cs = 2475;goto _again;} }}
24086
24086
  break;
24087
24087
  case 199:
24088
24088
  #line 179 "ragel/redcloth_scan.rl"
@@ -24090,15 +24090,15 @@ _eof_trans:
24090
24090
  break;
24091
24091
  case 200:
24092
24092
  #line 180 "ragel/redcloth_scan.rl"
24093
- {te = p;p--;{ CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159; goto _again;} }}
24093
+ {te = p;p--;{ CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159;goto _again;} }}
24094
24094
  break;
24095
24095
  case 201:
24096
24096
  #line 181 "ragel/redcloth_scan.rl"
24097
- {te = p;p--;{ {p = (((ts + 1)))-1;} INLINE(html, "dl_open"); ASET("type", "dt"); {cs = 2484; goto _again;} }}
24097
+ {te = p;p--;{ {p = (((ts + 1)))-1;} INLINE(html, "dl_open"); ASET("type", "dt"); {cs = 2484;goto _again;} }}
24098
24098
  break;
24099
24099
  case 202:
24100
24100
  #line 182 "ragel/redcloth_scan.rl"
24101
- {te = p;p--;{ INLINE(table, "table_close"); DONE(table); {cs = 2465; goto _again;} }}
24101
+ {te = p;p--;{ INLINE(table, "table_close"); DONE(table); {cs = 2465;goto _again;} }}
24102
24102
  break;
24103
24103
  case 203:
24104
24104
  #line 183 "ragel/redcloth_scan.rl"
@@ -24106,7 +24106,7 @@ _eof_trans:
24106
24106
  break;
24107
24107
  case 204:
24108
24108
  #line 184 "ragel/redcloth_scan.rl"
24109
- {te = p;p--;{ RESET_TYPE(); {cs = 2465; goto _again;} }}
24109
+ {te = p;p--;{ RESET_TYPE(); {cs = 2465;goto _again;} }}
24110
24110
  break;
24111
24111
  case 205:
24112
24112
  #line 185 "ragel/redcloth_scan.rl"
@@ -24118,20 +24118,20 @@ _eof_trans:
24118
24118
  CLEAR_REGS();
24119
24119
  RESET_TYPE();
24120
24120
  CAT(block);
24121
- {cs = 2465; goto _again;}
24121
+ {cs = 2465;goto _again;}
24122
24122
  }}
24123
24123
  break;
24124
24124
  case 207:
24125
24125
  #line 167 "ragel/redcloth_scan.rl"
24126
- {{p = ((te))-1;}{ ASET("type", "ignored_line"); {cs = 2434; goto _again;} }}
24126
+ {{p = ((te))-1;}{ ASET("type", "ignored_line"); {cs = 2434;goto _again;} }}
24127
24127
  break;
24128
24128
  case 208:
24129
24129
  #line 171 "ragel/redcloth_scan.rl"
24130
- {{p = ((te))-1;}{ ASET("type", "notextile"); CAT(block); {cs = 2420; goto _again;} }}
24130
+ {{p = ((te))-1;}{ ASET("type", "notextile"); CAT(block); {cs = 2420;goto _again;} }}
24131
24131
  break;
24132
24132
  case 209:
24133
24133
  #line 182 "ragel/redcloth_scan.rl"
24134
- {{p = ((te))-1;}{ INLINE(table, "table_close"); DONE(table); {cs = 2465; goto _again;} }}
24134
+ {{p = ((te))-1;}{ INLINE(table, "table_close"); DONE(table); {cs = 2465;goto _again;} }}
24135
24135
  break;
24136
24136
  case 210:
24137
24137
  #line 183 "ragel/redcloth_scan.rl"
@@ -24143,51 +24143,51 @@ _eof_trans:
24143
24143
  CLEAR_REGS();
24144
24144
  RESET_TYPE();
24145
24145
  CAT(block);
24146
- {cs = 2465; goto _again;}
24146
+ {cs = 2465;goto _again;}
24147
24147
  }}
24148
24148
  break;
24149
24149
  case 212:
24150
24150
  #line 1 "NONE"
24151
24151
  { switch( act ) {
24152
24152
  case 55:
24153
- {{p = ((te))-1;} ASET("type", "ignored_line"); {cs = 2434; goto _again;} }
24153
+ {{p = ((te))-1;} ASET("type", "ignored_line"); {cs = 2434;goto _again;} }
24154
24154
  break;
24155
24155
  case 58:
24156
- {{p = ((te))-1;} CAT(block); {cs = 2431; goto _again;} }
24156
+ {{p = ((te))-1;} CAT(block); {cs = 2431;goto _again;} }
24157
24157
  break;
24158
24158
  case 59:
24159
- {{p = ((te))-1;} ASET("type", "notextile"); CAT(block); {cs = 2420; goto _again;} }
24159
+ {{p = ((te))-1;} ASET("type", "notextile"); CAT(block); {cs = 2420;goto _again;} }
24160
24160
  break;
24161
24161
  case 61:
24162
24162
  {{p = ((te))-1;} ASET("type", "html"); CAT(block); ADD_BLOCK(); }
24163
24163
  break;
24164
24164
  case 62:
24165
- {{p = ((te))-1;} ASET("type", "html_block"); {cs = 2443; goto _again;} }
24165
+ {{p = ((te))-1;} ASET("type", "html_block"); {cs = 2443;goto _again;} }
24166
24166
  break;
24167
24167
  case 67:
24168
24168
  {{p = ((te))-1;} INLINE(html, "hr"); }
24169
24169
  break;
24170
24170
  case 68:
24171
- {{p = ((te))-1;} CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159; goto _again;} }
24171
+ {{p = ((te))-1;} CLEAR_LIST(); LIST_LAYOUT(); {cs = 2159;goto _again;} }
24172
24172
  break;
24173
24173
  case 69:
24174
- {{p = ((te))-1;} {p = (((ts + 1)))-1;} INLINE(html, "dl_open"); ASET("type", "dt"); {cs = 2484; goto _again;} }
24174
+ {{p = ((te))-1;} {p = (((ts + 1)))-1;} INLINE(html, "dl_open"); ASET("type", "dt"); {cs = 2484;goto _again;} }
24175
24175
  break;
24176
24176
  case 70:
24177
- {{p = ((te))-1;} INLINE(table, "table_close"); DONE(table); {cs = 2465; goto _again;} }
24177
+ {{p = ((te))-1;} INLINE(table, "table_close"); DONE(table); {cs = 2465;goto _again;} }
24178
24178
  break;
24179
24179
  case 71:
24180
24180
  {{p = ((te))-1;} STORE_LINK_ALIAS(); DONE(block); }
24181
24181
  break;
24182
24182
  case 72:
24183
- {{p = ((te))-1;} RESET_TYPE(); {cs = 2465; goto _again;} }
24183
+ {{p = ((te))-1;} RESET_TYPE(); {cs = 2465;goto _again;} }
24184
24184
  break;
24185
24185
  case 75:
24186
24186
  {{p = ((te))-1;}
24187
24187
  CLEAR_REGS();
24188
24188
  RESET_TYPE();
24189
24189
  CAT(block);
24190
- {cs = 2465; goto _again;}
24190
+ {cs = 2465;goto _again;}
24191
24191
  }
24192
24192
  break;
24193
24193
  }
@@ -28,7 +28,7 @@ module RedCloth::Formatters
28
28
  opts.delete(:class) if filter_classes
29
29
  opts.delete(:id) if filter_ids
30
30
 
31
- atts = ''
31
+ atts = ''.dup
32
32
  opts[:"text-align"] = opts.delete(:align)
33
33
  opts[:style] += ';' if opts[:style] && (opts[:style][-1..-1] != ';')
34
34
  [:float, :"text-align", :"vertical-align"].each do |a|
@@ -324,7 +324,7 @@ private
324
324
  # Clean unauthorized tags.
325
325
  def clean_html( text, allowed_tags = BASIC_TAGS )
326
326
  text.gsub!( /<!\[CDATA\[/, '' )
327
- text.gsub!( /<(\/*)([A-Za-z]\w*)([^>]*?)(\s?\/?)>/ ) do |m|
327
+ text.gsub!( /<(\/*)([A-Za-z]\w*+)([^>]*?)(\s?\/?)>/ ) do |m|
328
328
  raw = $~
329
329
  tag = raw[2].downcase
330
330
  if allowed_tags.has_key? tag
@@ -165,7 +165,7 @@ module RedCloth::Formatters::LATEX
165
165
 
166
166
  # FIXME: need caption and label elements similar to image -> figure
167
167
  def table_close(opts)
168
- output = "\\begin{table}\n"
168
+ output = "\\begin{table}\n".dup
169
169
  output << " \\centering\n"
170
170
  output << " \\begin{tabular}{ #{"l " * @table[0].size }}\n"
171
171
  @table.each do |row|
@@ -2,7 +2,7 @@ module RedCloth
2
2
  module VERSION
3
3
  MAJOR = 4
4
4
  MINOR = 3
5
- TINY = 2
5
+ TINY = 4
6
6
  # RELEASE_CANDIDATE = 0
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
@@ -22,7 +22,7 @@ module RedCloth
22
22
 
23
23
  NAME = "RedCloth"
24
24
  GEM_NAME = NAME
25
- URL = "http://redcloth.org/"
25
+ URL = "https://github.com/jgarber/redcloth"
26
26
  description = "Textile parser for Ruby."
27
27
 
28
28
  if RedCloth.const_defined?(:EXTENSION_LANGUAGE)
data/lib/redcloth.rb CHANGED
@@ -10,6 +10,11 @@ begin
10
10
  conf = Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG
11
11
  prefix = conf['arch'] =~ /mswin|mingw/ ? "#{conf['MAJOR']}.#{conf['MINOR']}/" : ''
12
12
  lib = "#{prefix}redcloth_scan"
13
+ begin
14
+ require lib
15
+ rescue LoadError => e
16
+ lib = "redcloth_scan"
17
+ end
13
18
  require lib
14
19
  rescue LoadError => e
15
20
  e.message << %{\nCouldn't load #{lib}\nThe $LOAD_PATH was:\n#{$LOAD_PATH.join("\n")}}
data/redcloth.gemspec CHANGED
@@ -9,12 +9,20 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Jason Garber", "Joshua Siler", "Ola Bini"]
10
10
  s.description = "Textile parser for Ruby."
11
11
  s.summary = RedCloth::SUMMARY
12
- s.email = "redcloth-upwards@rubyforge.org"
13
- s.homepage = "http://redcloth.org"
14
- s.rubyforge_project = "redcloth"
12
+ s.homepage = "https://github.com/jgarber/redcloth"
13
+ s.license = "MIT"
15
14
 
15
+ s.platform = 'ruby'
16
+ s.required_ruby_version = Gem::Requirement.new(">= 2.4")
16
17
  s.rubygems_version = "1.3.7"
17
- s.default_executable = "redcloth"
18
+
19
+ if s.respond_to?(:metadata=)
20
+ s.metadata = {
21
+ "bug_tracker_uri" => "https://github.com/jgarber/redcloth/issues",
22
+ "changelog_uri" => "https://github.com/jgarber/redcloth/blob/master/CHANGELOG",
23
+ "source_code_uri" => "https://github.com/jgarber/redcloth"
24
+ }
25
+ end
18
26
 
19
27
  s.files = Dir['.gemtest', '.rspec', 'CHANGELOG', 'COPYING', 'Gemfile', 'README.rdoc', 'Rakefile', 'doc/**/*', 'bin/**/*', 'lib/**/*', 'redcloth.gemspec', 'spec/**/*', 'tasks/**/*']
20
28
  s.test_files = Dir['spec/**/*']
@@ -26,16 +34,13 @@ Gem::Specification.new do |s|
26
34
  s.files -= Dir['lib/**/*.bundle']
27
35
  s.files -= Dir['lib/**/*.so']
28
36
 
29
- s.platform = 'ruby'
30
-
31
37
  s.files += %w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"}
32
38
  s.files += ["ext/redcloth_scan/redcloth.h"]
33
39
  s.extensions = Dir['ext/**/extconf.rb']
34
40
 
35
41
  s.add_development_dependency('bundler', '> 1.3.4')
36
- s.add_development_dependency('rake', '~> 10.0.3')
37
- s.add_development_dependency('rspec', '~> 2.4')
38
- s.add_development_dependency('diff-lcs', '~> 1.1.2')
42
+ s.add_development_dependency('rake', '~> 13')
43
+ s.add_development_dependency('rspec', '~> 3.12')
44
+ s.add_development_dependency('diff-lcs', '~> 1.5')
39
45
 
40
- s.license = "MIT"
41
- end
46
+ end
@@ -4,7 +4,7 @@ module FigureTag
4
4
  def fig( opts )
5
5
  label, img = opts[:text].split('|').map! {|str| str.strip}
6
6
 
7
- html = %Q{<div class="img" id="figure-#{label.tr('.', '-')}">\n}
7
+ html = %Q{<div class="img" id="figure-#{label.tr('.', '-')}">\n}.dup
8
8
  html << %Q{ <a class="fig" href="/images/#{img}">\n}
9
9
  html << %Q{ <img src="/images/thumbs/#{img}" alt="Figure #{label}" />\n}
10
10
  html << %Q{ </a>\n}
@@ -15,13 +15,13 @@ end
15
15
 
16
16
  describe "custom tags" do
17
17
  it "should recognize the custom tag" do
18
- input = %Q{The first line of text.\n\n}
18
+ input = %Q{The first line of text.\n\n}.dup
19
19
  input << %Q{fig. 1.1 | img.jpg\n\n}
20
20
  input << %Q{The last line of text.\n}
21
21
  r = RedCloth.new input
22
22
  r.extend FigureTag
23
23
 
24
- html = %Q{<p>The first line of text.</p>\n}
24
+ html = %Q{<p>The first line of text.</p>\n}.dup
25
25
  html << %Q{<div class="img" id="figure-1-1">\n}
26
26
  html << %Q{ <a class="fig" href="/images/img.jpg">\n}
27
27
  html << %Q{ <img src="/images/thumbs/img.jpg" alt="Figure 1.1" />\n}
@@ -30,13 +30,13 @@ describe "custom tags" do
30
30
  html << %Q{<div>\n}
31
31
  html << %Q{<p>The last line of text.</p>}
32
32
 
33
- r.to_html.should == html
33
+ expect(r.to_html).to eq(html)
34
34
  end
35
35
 
36
36
  it "should fall back if custom tag isn't defined" do
37
37
  r = RedCloth.new %Q/fig()>[no]{color:red}. 1.1 | img.jpg/
38
38
 
39
- r.to_html.should == "<p>fig()>[no]{color:red}. 1.1 | img.jpg</p>"
39
+ expect(r.to_html).to eq("<p>fig()>[no]{color:red}. 1.1 | img.jpg</p>")
40
40
  end
41
41
 
42
42
  it "should not call just regular string methods" do
@@ -45,6 +45,6 @@ describe "custom tags" do
45
45
 
46
46
  html = "<p>next. </p>"
47
47
 
48
- r.to_html.should == html
48
+ expect(r.to_html).to eq(html)
49
49
  end
50
- end
50
+ end
data/spec/erb_spec.rb CHANGED
@@ -5,6 +5,6 @@ describe "ERB helper" do
5
5
  template = %{<%=t "This new ERB tag makes is so _easy_ to use *RedCloth*" %>}
6
6
  expected = %{<p>This new <span class="caps">ERB</span> tag makes is so <em>easy</em> to use <strong>RedCloth</strong></p>}
7
7
 
8
- ERB.new(template).result.should == expected
8
+ expect(ERB.new(template).result).to eq(expected)
9
9
  end
10
10
  end
@@ -20,7 +20,7 @@ describe RedClothSmileyExtension do
20
20
 
21
21
  html = %Q{<p>You&#8217;re so silly! <img src='/images/emoticons/58_80.png' title=':P' class='smiley' /></p>}
22
22
 
23
- RedCloth.new(input).to_html(:textile, :refs_smiley).should == html
23
+ expect(RedCloth.new(input).to_html(:textile, :refs_smiley)).to eq(html)
24
24
  end
25
25
 
26
26
  end
@@ -159,7 +159,7 @@ in: '"link text":http://example.com/'
159
159
  html: <p><a href="http://example.com/">link text</a></p>
160
160
  ---
161
161
  name: local links
162
- desc: The host name may be ommitted for local links.
162
+ desc: The host name may be omitted for local links.
163
163
  in: '"link text":/example'
164
164
  html: <p><a href="/example">link text</a></p>
165
165
  ---
@@ -6,8 +6,8 @@ describe "HTML" do
6
6
  end
7
7
 
8
8
  it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in HTML" do
9
- lambda {
9
+ expect {
10
10
  RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_html
11
- }.should_not raise_error
11
+ }.not_to raise_error
12
12
  end
13
13
  end
@@ -6,8 +6,8 @@ describe "LaTeX" do
6
6
  end
7
7
 
8
8
  it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in LaTeX" do
9
- lambda {
9
+ expect {
10
10
  RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_latex
11
- }.should_not raise_error
11
+ }.not_to raise_error
12
12
  end
13
13
  end
data/spec/parser_spec.rb CHANGED
@@ -4,15 +4,15 @@ describe RedCloth do
4
4
 
5
5
  describe "#new" do
6
6
  it "should accept options" do
7
- lambda {
7
+ expect {
8
8
  RedCloth.new("test", [:hard_breaks])
9
- }.should_not raise_error
9
+ }.not_to raise_error
10
10
  end
11
11
  end
12
12
 
13
13
  it "should have a VERSION" do
14
- RedCloth.const_defined?("VERSION").should be_truthy
15
- RedCloth::VERSION.const_defined?("STRING").should be_truthy
14
+ expect(RedCloth.const_defined?("VERSION")).to be_truthy
15
+ expect(RedCloth::VERSION.const_defined?("STRING")).to be_truthy
16
16
  end
17
17
 
18
18
  it "should show the version as a string" do
@@ -85,8 +85,9 @@ describe RedCloth do
85
85
 
86
86
  if RUBY_VERSION > "1.9.0"
87
87
  it "should preserve character encoding" do
88
- input = "This is an ISO-8859-1 string"
88
+ input = "This is an ISO-8859-1 string".dup
89
89
  input.force_encoding 'iso-8859-1'
90
+
90
91
  output = RedCloth.new(input).to_html
91
92
 
92
93
  output.should == "<p>This is an <span class=\"caps\">ISO</span>-8859-1 string</p>"
@@ -94,7 +95,7 @@ describe RedCloth do
94
95
  end
95
96
 
96
97
  it "should not raise ArgumentError: invalid byte sequence" do
97
- s = "\xa3"
98
+ s = "\xa3".dup
98
99
  s.force_encoding 'iso-8859-1'
99
100
  lambda { RedCloth.new(s).to_html }.should_not raise_error
100
101
  end
@@ -0,0 +1,49 @@
1
+ # https://github.com/advisories/GHSA-qcm3-vfq5-wfr2
2
+ # https://github.com/e23e/CVE-2023-31606#readme
3
+ # https://github.com/jgarber/redcloth/issues/73
4
+ # https://github.com/jgarber/redcloth/pull/75
5
+
6
+ require 'redcloth'
7
+
8
+ describe 'CVE-2023-31606' do
9
+
10
+ it 'process malicious html without delay' do
11
+ # INFO (Helio): inside RedCloth repo, running `$ bundle exec rspec .`, with the test below, I can't replicate,
12
+ # on my development machine, the time spent on this sample text.
13
+ # However, on the same development machine, when I run this test this code, in a test-redcloth-regexp.rb script, in a rails app
14
+ # with `gem 'RedCloth'` in it, I was able to get the results indicated in the issue (https://github.com/jgarber/redcloth/issues/73),
15
+ # by https://github.com/e23e
16
+ # Here are the outputs:
17
+ # hac@MBP tcard % time ruby test-redcloth-regexp.rb
18
+ # 0.158047
19
+ # ruby test-redcloth-regexp.rb 0.12s user 0.11s system 82% cpu 0.279 total
20
+ # hac@MBP tcard % time ruby test-redcloth-regexp.rb
21
+ # 18.457945
22
+ # ruby test-redcloth-regexp.rb 18.32s user 0.22s system 99% cpu 18.556 total
23
+ # hac@MBP tcard % cat !$
24
+ # cat test-redcloth-regexp.rb
25
+ # require 'RedCloth'
26
+ # text = '<A' + 'A' * (54773)
27
+ # t1 = Time.now
28
+ # text = RedCloth.new(text, [:sanitize_html]).to_html
29
+ # t2 = Time.now
30
+ # puts (t2-t1)
31
+ # hac@MBP tcard %
32
+
33
+ text = '<A' + 'A' * (54773)
34
+
35
+ t1 = Time.now
36
+ res = RedCloth.new(text, [:sanitize_html]).to_html
37
+ t2 = Time.now
38
+
39
+ expect(t2-t1).to be <= 3
40
+ end
41
+
42
+ it 'should keep the generated HTML the same' do
43
+ text = "<a href=https://example.com> Example </a>"
44
+ result = RedCloth.new(text, [:sanitize_html]).to_html
45
+
46
+ expect(result).to eq("<p><a href=\"https://example.com\"> Example </a></p>")
47
+ end
48
+
49
+ end
data/spec/spec_helper.rb CHANGED
@@ -10,11 +10,11 @@ def examples_from_yaml(&block)
10
10
  if doc[formatter]
11
11
  example("should output #{formatter} for #{name}") do
12
12
  output = method("format_as_#{formatter}").call(doc)
13
- output.should == doc[formatter]
13
+ expect(output).to eq(doc[formatter])
14
14
  end
15
15
  else
16
16
  example("should not raise errors when rendering #{formatter} for #{name}") do
17
- lambda { method("format_as_#{formatter}").call(doc) }.should_not raise_error
17
+ expect { method("format_as_#{formatter}").call(doc) }.not_to raise_error
18
18
  end
19
19
  end
20
20
  end
@@ -26,11 +26,11 @@ def fixtures
26
26
  Dir[File.join(File.dirname(__FILE__), *%w[fixtures *.yml])].each do |testfile|
27
27
  testgroup = File.basename(testfile, '.yml')
28
28
  num = 0
29
- YAML::load_documents(File.open(testfile)) do |doc|
29
+ YAML::load_stream(File.open(testfile)) do |doc|
30
30
  name = doc['name'] || num
31
31
  @fixtures["#{testgroup} #{name}"] = doc
32
32
  num += 1
33
33
  end
34
34
  end
35
35
  @fixtures
36
- end
36
+ end
data/tasks/compile.rake CHANGED
@@ -29,7 +29,6 @@ require 'mkmf'
29
29
  CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
30
30
  $CFLAGS << ' -O0 -Wall ' if CONFIG['CC'] =~ /gcc/
31
31
  dir_config("redcloth_scan")
32
- have_library("c", "main")
33
32
  create_makefile("redcloth_scan")
34
33
  EOF
35
34
  end
data/tasks/release.rake CHANGED
@@ -1,16 +1,15 @@
1
1
  namespace :release do
2
2
  desc 'Push all gems to rubygems.org'
3
- # git tag and push tag
4
- # git tag vx.x.x
5
- # git push --follow-tags
6
- # branch into stable vx.x branch
7
- # change version in version.rb
8
- # update changelog
9
- # run rake test
3
+ # 1. run rake test
4
+ # 2. update changelog
5
+ # 3. change version in version.rb
6
+ # 4. branch into stable vx.x branch
7
+ # 5. git tag and push tag
8
+ # 5.1. git tag vx.x.x
9
+ # 5.2. git push --follow-tags
10
10
 
11
11
  task :gem do
12
12
  sh("gem build redcloth.gemspec")
13
13
  sh("gem push RedCloth-*.gem")
14
14
  end
15
15
  end
16
-
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RedCloth
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.2
4
+ version: 4.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Garber
8
8
  - Joshua Siler
9
9
  - Ola Bini
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-24 00:00:00.000000000 Z
13
+ date: 2024-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -32,44 +32,44 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 10.0.3
35
+ version: '13'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 10.0.3
42
+ version: '13'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '2.4'
49
+ version: '3.12'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '2.4'
56
+ version: '3.12'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: diff-lcs
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 1.1.2
63
+ version: '1.5'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 1.1.2
70
+ version: '1.5'
71
71
  description: Textile parser for Ruby.
72
- email: redcloth-upwards@rubyforge.org
72
+ email:
73
73
  executables:
74
74
  - redcloth
75
75
  extensions:
@@ -136,17 +136,21 @@ files:
136
136
  - spec/formatters/style_filtered_html_spec.rb
137
137
  - spec/parser_spec.rb
138
138
  - spec/security/CVE-2012-6684_spec.rb
139
+ - spec/security/CVE-2023-31606_spec.rb
139
140
  - spec/spec_helper.rb
140
141
  - tasks/compile.rake
141
142
  - tasks/ragel_extension_task.rb
142
143
  - tasks/release.rake
143
144
  - tasks/rspec.rake
144
145
  - tasks/rvm.rake
145
- homepage: http://redcloth.org
146
+ homepage: https://github.com/jgarber/redcloth
146
147
  licenses:
147
148
  - MIT
148
- metadata: {}
149
- post_install_message:
149
+ metadata:
150
+ bug_tracker_uri: https://github.com/jgarber/redcloth/issues
151
+ changelog_uri: https://github.com/jgarber/redcloth/blob/master/CHANGELOG
152
+ source_code_uri: https://github.com/jgarber/redcloth
153
+ post_install_message:
150
154
  rdoc_options:
151
155
  - "--charset=UTF-8"
152
156
  - "--line-numbers"
@@ -163,49 +167,49 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
167
  requirements:
164
168
  - - ">="
165
169
  - !ruby/object:Gem::Version
166
- version: '0'
170
+ version: '2.4'
167
171
  required_rubygems_version: !ruby/object:Gem::Requirement
168
172
  requirements:
169
173
  - - ">="
170
174
  - !ruby/object:Gem::Version
171
175
  version: '0'
172
176
  requirements: []
173
- rubyforge_project: redcloth
174
- rubygems_version: 2.4.8
175
- signing_key:
177
+ rubygems_version: 3.5.6
178
+ signing_key:
176
179
  specification_version: 4
177
- summary: RedCloth-4.3.2
180
+ summary: RedCloth-4.3.4
178
181
  test_files:
179
182
  - spec/benchmark_spec.rb
180
- - spec/parser_spec.rb
181
- - spec/extension_spec.rb
182
183
  - spec/custom_tags_spec.rb
183
- - spec/spec_helper.rb
184
184
  - spec/erb_spec.rb
185
- - spec/fixtures/lists.yml
186
- - spec/fixtures/links.yml
187
- - spec/fixtures/code.yml
188
- - spec/fixtures/textism.yml
185
+ - spec/extension_spec.rb
189
186
  - spec/fixtures/basic.yml
187
+ - spec/fixtures/code.yml
188
+ - spec/fixtures/definitions.yml
189
+ - spec/fixtures/extra_whitespace.yml
190
190
  - spec/fixtures/filter_html.yml
191
- - spec/fixtures/table.yml
192
- - spec/fixtures/instiki.yml
193
191
  - spec/fixtures/filter_pba.yml
194
- - spec/fixtures/threshold.yml
192
+ - spec/fixtures/html.yml
195
193
  - spec/fixtures/images.yml
196
- - spec/fixtures/definitions.yml
197
- - spec/fixtures/sanitize_html.yml
194
+ - spec/fixtures/instiki.yml
195
+ - spec/fixtures/links.yml
196
+ - spec/fixtures/lists.yml
198
197
  - spec/fixtures/poignant.yml
199
- - spec/fixtures/extra_whitespace.yml
200
- - spec/fixtures/html.yml
201
- - spec/formatters/id_filtered_html_spec.rb
198
+ - spec/fixtures/sanitize_html.yml
199
+ - spec/fixtures/table.yml
200
+ - spec/fixtures/textism.yml
201
+ - spec/fixtures/threshold.yml
202
+ - spec/formatters/class_filtered_html_spec.rb
203
+ - spec/formatters/filtered_html_spec.rb
202
204
  - spec/formatters/html_no_breaks_spec.rb
203
205
  - spec/formatters/html_spec.rb
206
+ - spec/formatters/id_filtered_html_spec.rb
204
207
  - spec/formatters/latex_spec.rb
205
- - spec/formatters/style_filtered_html_spec.rb
206
- - spec/formatters/class_filtered_html_spec.rb
207
- - spec/formatters/no_span_caps_html_spec.rb
208
- - spec/formatters/filtered_html_spec.rb
209
208
  - spec/formatters/lite_mode_html_spec.rb
209
+ - spec/formatters/no_span_caps_html_spec.rb
210
210
  - spec/formatters/sanitized_html_spec.rb
211
+ - spec/formatters/style_filtered_html_spec.rb
212
+ - spec/parser_spec.rb
211
213
  - spec/security/CVE-2012-6684_spec.rb
214
+ - spec/security/CVE-2023-31606_spec.rb
215
+ - spec/spec_helper.rb