RedCloth 4.3.2 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +6 -0
- data/README.rdoc +7 -0
- data/Rakefile +1 -2
- data/ext/redcloth_scan/redcloth_inline.c +4 -4
- data/ext/redcloth_scan/redcloth_scan.c +77 -77
- data/lib/redcloth/formatters/base.rb +1 -1
- data/lib/redcloth/formatters/html.rb +1 -1
- data/lib/redcloth/formatters/latex.rb +1 -1
- data/lib/redcloth/version.rb +1 -1
- data/redcloth.gemspec +3 -3
- data/spec/custom_tags_spec.rb +4 -4
- data/spec/fixtures/threshold.yml +1 -1
- data/spec/parser_spec.rb +3 -2
- data/spec/security/CVE-2023-31606_spec.rb +49 -0
- data/spec/spec_helper.rb +2 -2
- data/tasks/release.rake +7 -8
- metadata +34 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3e774a70b77a51fd99310d8ac12418de23dc1028372024f09ff80db0e92dfce3
|
4
|
+
data.tar.gz: f3aa2ff8b6650b883947c9496e6b1ece61b1abdf4a6d85a9b8411c94c125c4f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fceea8abce902bbbc98f0c5e969e3acdbeebd2614f409b3befa216d3cf7012158c8175edbaa2f3f84f9ac7474b40dc40302e010914eda205b5b8a3a45bbfcb4
|
7
|
+
data.tar.gz: 7db2b9647d05ee81462c2ffb7fd006a9174c971f80e35a527dfe5878d243e8617f502a6d9801ed9fbe652297648975f2dd5eea3db3991ec86339d892b5c6c8d4
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 4.3.3 / Nov 2nd, 2023
|
2
|
+
|
3
|
+
* Add tests for CVE-2023-31606 [Helio Cola]
|
4
|
+
* Fix rake compile [Helio Cola and Faria Education Group]
|
5
|
+
* Fix CVE-2023-31606 (ReDOS possible in the sanitize_html function) [Kornelius Kalnbach and Merbin Russel]
|
6
|
+
|
1
7
|
== 4.3.2 / May 23rd, 2016
|
2
8
|
|
3
9
|
* Fix additional case for CVE-2012-6684 [Joshua Siler]
|
data/README.rdoc
CHANGED
@@ -171,6 +171,13 @@ Example:
|
|
171
171
|
Will become:
|
172
172
|
|
173
173
|
<acronym title="American Civil Liberties Union">ACLU</acronym>
|
174
|
+
|
175
|
+
== Filtering HTML
|
176
|
+
|
177
|
+
RedCloth doesn't filter unsafe html tags by default, do to this use the following syntax:
|
178
|
+
RedCloth.new("<script>alert(1)</script>", [:filter_html]).to_html
|
179
|
+
which will filter the script tags from the HTML resulting in:
|
180
|
+
"<script>alert(1)</script>"
|
174
181
|
|
175
182
|
== Adding Tables
|
176
183
|
|
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
|
@@ -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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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
|
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|
|
data/lib/redcloth/version.rb
CHANGED
data/redcloth.gemspec
CHANGED
@@ -33,9 +33,9 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.extensions = Dir['ext/**/extconf.rb']
|
34
34
|
|
35
35
|
s.add_development_dependency('bundler', '> 1.3.4')
|
36
|
-
s.add_development_dependency('rake', '~>
|
37
|
-
s.add_development_dependency('rspec', '~>
|
38
|
-
s.add_development_dependency('diff-lcs', '~> 1.
|
36
|
+
s.add_development_dependency('rake', '~> 13')
|
37
|
+
s.add_development_dependency('rspec', '~> 3.12')
|
38
|
+
s.add_development_dependency('diff-lcs', '~> 1.5')
|
39
39
|
|
40
40
|
s.license = "MIT"
|
41
41
|
end
|
data/spec/custom_tags_spec.rb
CHANGED
@@ -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}
|
@@ -47,4 +47,4 @@ describe "custom tags" do
|
|
47
47
|
|
48
48
|
r.to_html.should == html
|
49
49
|
end
|
50
|
-
end
|
50
|
+
end
|
data/spec/fixtures/threshold.yml
CHANGED
@@ -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
|
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
|
---
|
data/spec/parser_spec.rb
CHANGED
@@ -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
@@ -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::
|
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/release.rake
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
namespace :release do
|
2
2
|
desc 'Push all gems to rubygems.org'
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# branch into stable vx.x branch
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
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.
|
4
|
+
version: 4.3.3
|
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:
|
13
|
+
date: 2023-11-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -32,42 +32,42 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
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:
|
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: '
|
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: '
|
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.
|
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.
|
70
|
+
version: '1.5'
|
71
71
|
description: Textile parser for Ruby.
|
72
72
|
email: redcloth-upwards@rubyforge.org
|
73
73
|
executables:
|
@@ -136,6 +136,7 @@ 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
|
@@ -146,7 +147,7 @@ homepage: http://redcloth.org
|
|
146
147
|
licenses:
|
147
148
|
- MIT
|
148
149
|
metadata: {}
|
149
|
-
post_install_message:
|
150
|
+
post_install_message:
|
150
151
|
rdoc_options:
|
151
152
|
- "--charset=UTF-8"
|
152
153
|
- "--line-numbers"
|
@@ -170,42 +171,42 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
171
|
- !ruby/object:Gem::Version
|
171
172
|
version: '0'
|
172
173
|
requirements: []
|
173
|
-
|
174
|
-
|
175
|
-
signing_key:
|
174
|
+
rubygems_version: 3.4.19
|
175
|
+
signing_key:
|
176
176
|
specification_version: 4
|
177
|
-
summary: RedCloth-4.3.
|
177
|
+
summary: RedCloth-4.3.3
|
178
178
|
test_files:
|
179
179
|
- spec/benchmark_spec.rb
|
180
|
-
- spec/parser_spec.rb
|
181
|
-
- spec/extension_spec.rb
|
182
180
|
- spec/custom_tags_spec.rb
|
183
|
-
- spec/spec_helper.rb
|
184
181
|
- spec/erb_spec.rb
|
185
|
-
- spec/
|
186
|
-
- spec/fixtures/links.yml
|
187
|
-
- spec/fixtures/code.yml
|
188
|
-
- spec/fixtures/textism.yml
|
182
|
+
- spec/extension_spec.rb
|
189
183
|
- spec/fixtures/basic.yml
|
184
|
+
- spec/fixtures/code.yml
|
185
|
+
- spec/fixtures/definitions.yml
|
186
|
+
- spec/fixtures/extra_whitespace.yml
|
190
187
|
- spec/fixtures/filter_html.yml
|
191
|
-
- spec/fixtures/table.yml
|
192
|
-
- spec/fixtures/instiki.yml
|
193
188
|
- spec/fixtures/filter_pba.yml
|
194
|
-
- spec/fixtures/
|
189
|
+
- spec/fixtures/html.yml
|
195
190
|
- spec/fixtures/images.yml
|
196
|
-
- spec/fixtures/
|
197
|
-
- spec/fixtures/
|
191
|
+
- spec/fixtures/instiki.yml
|
192
|
+
- spec/fixtures/links.yml
|
193
|
+
- spec/fixtures/lists.yml
|
198
194
|
- spec/fixtures/poignant.yml
|
199
|
-
- spec/fixtures/
|
200
|
-
- spec/fixtures/
|
201
|
-
- spec/
|
195
|
+
- spec/fixtures/sanitize_html.yml
|
196
|
+
- spec/fixtures/table.yml
|
197
|
+
- spec/fixtures/textism.yml
|
198
|
+
- spec/fixtures/threshold.yml
|
199
|
+
- spec/formatters/class_filtered_html_spec.rb
|
200
|
+
- spec/formatters/filtered_html_spec.rb
|
202
201
|
- spec/formatters/html_no_breaks_spec.rb
|
203
202
|
- spec/formatters/html_spec.rb
|
203
|
+
- spec/formatters/id_filtered_html_spec.rb
|
204
204
|
- 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
205
|
- spec/formatters/lite_mode_html_spec.rb
|
206
|
+
- spec/formatters/no_span_caps_html_spec.rb
|
210
207
|
- spec/formatters/sanitized_html_spec.rb
|
208
|
+
- spec/formatters/style_filtered_html_spec.rb
|
209
|
+
- spec/parser_spec.rb
|
211
210
|
- spec/security/CVE-2012-6684_spec.rb
|
211
|
+
- spec/security/CVE-2023-31606_spec.rb
|
212
|
+
- spec/spec_helper.rb
|