History

Use String#remove

Thibaut committed 12 years ago

Commit bcd4a5b1 parent a0b795934 files · +79 −79Browse files

Showing the changes to lib/docs/filters/python (2 of 34 files). Show all

Unified · Split

2 files
  1. lib/docs/filters/python/clean_html.rb +1 −1
  2. lib/docs/filters/python/entries.rb +6 −6
lib/docs/filters/python/clean_html.rb+1−1
@@ -38,7 +38,7 @@ module Docs · 37 unmodified lines
3838 node.css('a').each do |link|
3939 link.before(link.children).remove
4040 end
41− node.child.content = node.child.content.sub @levelRegexp, ''
41+ node.child.content = node.child.content.remove @levelRegexp
4242 end
4343
4444 css('dt').each do |node|
lib/docs/filters/python/entries.rb+6−6
@@ -15,8 +15,8 @@ module Docs · 14 unmodified lines
1515
1616 def get_name
1717 name = at_css('h1').content
18− name.sub! %r{\A[\d\.]+ }, '' # remove list number
19− name.sub! %r{ [\u{2013}\u{2014}].+\z}, '' # remove text after em/en dash
18+ name.remove! %r{\A[\d\.]+ } # remove list number
19+ name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash
2020 name
2121 end
2222
@@ -33,10 +33,10 @@ module Docs · 10 unmodified lines
3333 type = 'Internet Data Handling'
3434 end
3535
36− type.sub! %r{\A\d+\.\s+}, '' # remove list number
37− type.sub! "\u{00b6}", '' # remove paragraph character
36+ type.remove! %r{\A\d+\.\s+} # remove list number
37+ type.remove! "\u{00b6}" # remove paragraph character
3838 type.sub! ' and ', ' & '
39− [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.sub! str, '' }
39+ [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.remove!(str) }
4040
4141 REPLACE_TYPES[type] || type
4242 end
@@ -74,7 +74,7 @@ module Docs · 31 unmodified lines
7474 def clean_id_attributes
7575 css('.section > .target[id]').each do |node|
7676 if dt = node.at_css('+ dl > dt')
77− dt['id'] ||= node['id'].sub(/\w+\-/, '')
77+ dt['id'] ||= node['id'].remove(/\w+\-/)
7878 end
7979 node.remove
8080 end