Skip to content

Commit ca2c478

Browse files
authored
Merge pull request #268 from charliesome/ruby-2.4
Ruby 2.4
2 parents 6d223dc + 3b209cc commit ca2c478

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ gemfile:
1515
- gemfiles/rails_3.gemfile
1616

1717
rvm:
18+
- 2.4.0
1819
- 2.3.1
1920
- 2.2.5
2021
- 2.1
@@ -30,3 +31,7 @@ matrix:
3031
rvm: 2.1
3132
- gemfile: gemfiles/rails_5.gemfile
3233
rvm: 2.0
34+
- gemfile: gemfiles/rails_4.gemfile
35+
rvm: 2.4.0
36+
- gemfile: gemfiles/rails_3.gemfile
37+
rvm: 2.4.0

gemfiles/rails_5.gemfile.lock

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ GEM
5858
erubis (2.7.0)
5959
escape_utils (1.0.1)
6060
gemoji (2.1.0)
61-
github-linguist (2.12.0)
61+
github-linguist (2.12.1)
6262
charlock_holmes (~> 0.7.3)
6363
escape_utils (~> 1.0.1)
6464
mime-types (~> 1.19)
65-
pygments.rb (~> 0.6.0)
65+
pygments.rb (> 0.6.0)
6666
github-markdown (0.6.9)
6767
globalid (0.3.6)
6868
activesupport (>= 4.1.0)
@@ -75,15 +75,14 @@ GEM
7575
mime-types (1.25.1)
7676
mini_portile2 (2.1.0)
7777
minitest (5.9.0)
78+
multi_json (1.12.1)
7879
nio4r (1.2.1)
7980
nokogiri (1.6.8)
8081
mini_portile2 (~> 2.1.0)
8182
pkg-config (~> 1.1.7)
8283
pkg-config (1.1.7)
83-
posix-spawn (0.3.11)
84-
pygments.rb (0.6.3)
85-
posix-spawn (~> 0.3.6)
86-
yajl-ruby (~> 1.2.0)
84+
pygments.rb (1.1.1)
85+
multi_json (>= 1.0.0)
8786
rack (2.0.1)
8887
rack-test (0.6.3)
8988
rack (>= 1.0)
@@ -128,7 +127,6 @@ GEM
128127
websocket-driver (0.6.4)
129128
websocket-extensions (>= 0.1.0)
130129
websocket-extensions (0.1.2)
131-
yajl-ruby (1.2.1)
132130

133131
PLATFORMS
134132
ruby
@@ -150,4 +148,4 @@ DEPENDENCIES
150148
sanitize (~> 2.0)
151149

152150
BUNDLED WITH
153-
1.12.5
151+
1.13.7

lib/html/pipeline/toc_filter.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def call
3636
headers = Hash.new(0)
3737
doc.css('h1, h2, h3, h4, h5, h6').each do |node|
3838
text = node.text
39-
id = text.downcase
39+
id = ascii_downcase(text)
4040
id.gsub!(PUNCTUATION_REGEXP, '') # remove punctuation
4141
id.gsub!(' ', '-') # replace spaces with dash
4242

@@ -50,6 +50,16 @@ def call
5050
result[:toc] = %Q{<ul class="section-nav">\n#{result[:toc]}</ul>} unless result[:toc].empty?
5151
doc
5252
end
53+
54+
if RUBY_VERSION >= "2.4"
55+
def ascii_downcase(str)
56+
str.downcase(:ascii)
57+
end
58+
else
59+
def ascii_downcase(str)
60+
str.downcase
61+
end
62+
end
5363
end
5464
end
5565
end

0 commit comments

Comments
 (0)