Unified · Split
| @@ -41,7 +41,7 @@ module Docs · 40 unmodified lines | |||
| 41 | end | 41 | end |
| 42 | 42 | ||
| 43 | def slug | 43 | def slug |
| 44 | @slug ||= subpath.sub(/\A\//, '').sub(/\.html\z/, '') | 44 | @slug ||= subpath.sub(/\A\//, '').remove(/\.html\z/) |
| 45 | end | 45 | end |
| 46 | 46 | ||
| 47 | def root_page? | 47 | def root_page? |
| @@ -34,7 +34,7 @@ module Docs · 33 unmodified lines | |||
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | def file_path_for(url) | 36 | def file_path_for(url) |
| 37 | File.join self.class.dir, url.sub(base_url.to_s, '') | 37 | File.join self.class.dir, url.remove(base_url.to_s) |
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | def read_file(path) | 40 | def read_file(path) |
| @@ -17,11 +17,11 @@ module Docs · 16 unmodified lines | |||
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | def format_url(url) | 19 | def format_url(url) |
| 20 | url.to_s.sub %r{\Ahttps?://}, '' | 20 | url.to_s.remove %r{\Ahttps?://} |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | def format_path(path) | 23 | def format_path(path) |
| 24 | path.to_s.sub File.join(File.expand_path('.'), ''), '' | 24 | path.to_s.remove File.join(File.expand_path('.'), '') |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | def justify(str) | 27 | def justify(str) |
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | |||
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | def get_name | 4 | def get_name |
| 5 | name = slug.split(':').last | 5 | name = slug.split(':').last |
| 6 | name.sub! %r{\Ang\.}, '' | 6 | name.remove! %r{\Ang\.} |
| 7 | name << " (#{subtype})" if subtype == 'directive' || subtype == 'filter' | 7 | name << " (#{subtype})" if subtype == 'directive' || subtype == 'filter' |
| 8 | name | 8 | name |
| 9 | end | 9 | end |
| @@ -8,7 +8,7 @@ module Docs · 7 unmodified lines | |||
| 8 | css('[id]').each do |node| | 8 | css('[id]').each do |node| |
| 9 | # Module | 9 | # Module |
| 10 | if node.name == 'h2' | 10 | if node.name == 'h2' |
| 11 | type = node.content.sub 'Backbone.', '' | 11 | type = node.content.remove 'Backbone.' |
| 12 | if type.capitalize! # sync, history | 12 | if type.capitalize! # sync, history |
| 13 | entries << [node.content, node['id'], type] | 13 | entries << [node.content, node['id'], type] |
| 14 | end | 14 | end |
| @@ -35,7 +35,7 @@ module Docs · 34 unmodified lines | |||
| 35 | end | 35 | end |
| 36 | 36 | ||
| 37 | css('area[href]').each do |node| | 37 | css('area[href]').each do |node| |
| 38 | node['href'] = node['href'].sub('.html', '') | 38 | node['href'] = node['href'].remove('.html') |
| 39 | end | 39 | end |
| 40 | 40 | ||
| 41 | doc | 41 | doc |
| @@ -15,8 +15,8 @@ module Docs · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | def get_name | 16 | def get_name |
| 17 | name = at_css('#firstHeading').content.strip | 17 | name = at_css('#firstHeading').content.strip |
| 18 | name.sub! 'C keywords: ', '' | 18 | name.remove! 'C keywords: ' |
| 19 | name.sub! %r{\s\(.+\)}, '' | 19 | name.remove! %r{\s\(.+\)} |
| 20 | name = name.split(',').first | 20 | name = name.split(',').first |
| 21 | REPLACE_NAMES[name] || name | 21 | REPLACE_NAMES[name] || name |
| 22 | end | 22 | end |
| @@ -24,8 +24,8 @@ module Docs · 1 unmodified line | |||
| 24 | def get_type | 24 | def get_type |
| 25 | if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) | 25 | if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) |
| 26 | type.strip! | 26 | type.strip! |
| 27 | type.sub! ' library', '' | 27 | type.remove! ' library' |
| 28 | type.sub! ' utilities', '' | 28 | type.remove! ' utilities' |
| 29 | type | 29 | type |
| 30 | end | 30 | end |
| 31 | end | 31 | end |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | def call | 5 | def call |
| 6 | html.strip! | 6 | html.strip! |
| 7 | while html.gsub!(EMPTY_NODES_RGX, ''); end | 7 | while html.remove!(EMPTY_NODES_RGX); end |
| 8 | html | 8 | html |
| 9 | end | 9 | end |
| 10 | end | 10 | end |
| @@ -21,7 +21,7 @@ module Docs · 20 unmodified lines | |||
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | def normalized_subpath | 23 | def normalized_subpath |
| 24 | normalize_path subpath.sub(/\A\//, '') | 24 | normalize_path subpath.remove(/\A\//) |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | def normalize_href(href) | 27 | def normalize_href(href) |
| @@ -10,10 +10,10 @@ module Docs · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | def get_name | 11 | def get_name |
| 12 | name = at_css('#firstHeading').content.strip | 12 | name = at_css('#firstHeading').content.strip |
| 13 | name.sub! 'C++ concepts: ', '' | 13 | name.remove! 'C++ concepts: ' |
| 14 | name.sub! 'C++ keywords: ', '' | 14 | name.remove! 'C++ keywords: ' |
| 15 | name.sub! 'C++ ', '' | 15 | name.remove! 'C++ ' |
| 16 | name.sub! %r{\s\(.+\)}, '' | 16 | name.remove! %r{\s\(.+\)} |
| 17 | name.sub! %r{\AStandard library header <(.+)>\z}, '\1' | 17 | name.sub! %r{\AStandard library header <(.+)>\z}, '\1' |
| 18 | name = name.split(',').first | 18 | name = name.split(',').first |
| 19 | REPLACE_NAMES[name] || name | 19 | REPLACE_NAMES[name] || name |
| @@ -24,9 +24,9 @@ module Docs · 4 unmodified lines | |||
| 24 | 'Keywords' | 24 | 'Keywords' |
| 25 | elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) | 25 | elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) |
| 26 | type.strip! | 26 | type.strip! |
| 27 | type.sub! ' library', '' | 27 | type.remove! ' library' |
| 28 | type.sub! ' utilities', '' | 28 | type.remove! ' utilities' |
| 29 | type.sub! 'C++ ', '' | 29 | type.remove! 'C++ ' |
| 30 | type.capitalize! | 30 | type.capitalize! |
| 31 | type | 31 | type |
| 32 | end | 32 | end |
| @@ -34,7 +34,7 @@ module Docs · 1 unmodified line | |||
| 34 | 34 | ||
| 35 | def additional_entries | 35 | def additional_entries |
| 36 | return [] unless include_default_entry? | 36 | return [] unless include_default_entry? |
| 37 | names = at_css('#firstHeading').content.gsub(%r{\(.+?\)}, '').split(',')[1..-1] | 37 | names = at_css('#firstHeading').content.remove(%r{\(.+?\)}).split(',')[1..-1] |
| 38 | names.each(&:strip!).reject! do |name| | 38 | names.each(&:strip!).reject! do |name| |
| 39 | name.size <= 2 || name == '...' || name =~ /\A[<>]/ || name.start_with?('operator') | 39 | name.size <= 2 || name == '...' || name =~ /\A[<>]/ || name.start_with?('operator') |
| 40 | end | 40 | end |
| @@ -60,7 +60,7 @@ module Docs · 59 unmodified lines | |||
| 60 | 60 | ||
| 61 | def get_name | 61 | def get_name |
| 62 | case type | 62 | case type |
| 63 | when 'Data Types' then "<#{super.gsub(' value', '')}>" | 63 | when 'Data Types' then "<#{super.remove ' value'}>" |
| 64 | when 'Functions' then "#{super}()" | 64 | when 'Functions' then "#{super}()" |
| 65 | else super | 65 | else super |
| 66 | end | 66 | end |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | |||
| 4 | def call | 4 | def call |
| 5 | # Remove links inside <h2> and add "id" attributes | 5 | # Remove links inside <h2> and add "id" attributes |
| 6 | css('h2 > a').each do |node| | 6 | css('h2 > a').each do |node| |
| 7 | node.parent['id'] = node['name'].sub('wiki-', '') if node['name'] | 7 | node.parent['id'] = node['name'].remove('wiki-') if node['name'] |
| 8 | node.before(node.children).remove | 8 | node.before(node.children).remove |
| 9 | end | 9 | end |
| 10 | 10 | ||
| @@ -26,7 +26,7 @@ module Docs · 15 unmodified lines | |||
| 26 | next unless node['name'] || node.content == '#' | 26 | next unless node['name'] || node.content == '#' |
| 27 | parent = node.parent | 27 | parent = node.parent |
| 28 | parent.name = 'h6' | 28 | parent.name = 'h6' |
| 29 | parent['id'] = (node['name'] || node['href'].sub(/\A.+#/, '')).sub('wiki-', '') | 29 | parent['id'] = (node['name'] || node['href'].remove(/\A.+#/)).remove('wiki-') |
| 30 | parent.css('a[name]').remove | 30 | parent.css('a[name]').remove |
| 31 | node.remove | 31 | node.remove |
| 32 | end | 32 | end |
| @@ -12,7 +12,7 @@ module Docs · 11 unmodified lines | |||
| 12 | def additional_entries | 12 | def additional_entries |
| 13 | css('h6[id]').inject [] do |entries, node| | 13 | css('h6[id]').inject [] do |entries, node| |
| 14 | name = node.content | 14 | name = node.content |
| 15 | name.sub! %r{\(.*\z}, '' | 15 | name.remove! %r{\(.*\z} |
| 16 | entries << [name, node['id']] unless name == entries.last.try(:first) | 16 | entries << [name, node['id']] unless name == entries.last.try(:first) |
| 17 | entries | 17 | entries |
| 18 | end | 18 | end |
| @@ -18,7 +18,7 @@ module Docs · 17 unmodified lines | |||
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | css('> h1').each do |node| | 20 | css('> h1').each do |node| |
| 21 | node.content = node.content.sub(/\(\d\) Manual Page/, '') | 21 | node.content = node.content.remove(/\(\d\) Manual Page/) |
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | unless at_css('> h2') | 24 | unless at_css('> h2') |
| @@ -18,7 +18,7 @@ module Docs · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | # Remove triangle character | 19 | # Remove triangle character |
| 20 | css('h2', '.exampleHeading').each do |node| | 20 | css('h2', '.exampleHeading').each do |node| |
| 21 | node.content = node.content.sub("\u25BE", '') | 21 | node.content = node.content.remove("\u25BE") |
| 22 | node.name = 'h2' | 22 | node.name = 'h2' |
| 23 | end | 23 | end |
| 24 | 24 | ||
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | |||
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | def get_name | 4 | def get_name |
| 5 | name = at_css('h1').content | 5 | name = at_css('h1').content |
| 6 | name.sub! 'Package ', '' | 6 | name.remove! 'Package ' |
| 7 | name | 7 | name |
| 8 | end | 8 | end |
| 9 | 9 | ||
| @@ -19,9 +19,9 @@ module Docs · 18 unmodified lines | |||
| 19 | name | 19 | name |
| 20 | else | 20 | else |
| 21 | name = super | 21 | name = super |
| 22 | name.sub! 'Functions and function scope.', '' | 22 | name.remove! 'Functions and function scope.' |
| 23 | name.sub! 'Operators.', '' | 23 | name.remove! 'Operators.' |
| 24 | name.sub! 'Statements.', '' | 24 | name.remove! 'Statements.' |
| 25 | name | 25 | name |
| 26 | end | 26 | end |
| 27 | end | 27 | end |
| @@ -34,7 +34,7 @@ module Docs · 6 unmodified lines | |||
| 34 | elsif slug.start_with? 'Functions_and_function_scope' | 34 | elsif slug.start_with? 'Functions_and_function_scope' |
| 35 | 'Function' | 35 | 'Function' |
| 36 | elsif slug.start_with? 'Global_Objects' | 36 | elsif slug.start_with? 'Global_Objects' |
| 37 | object, method = *slug.sub('Global_Objects/', '').split('/') | 37 | object, method = *slug.remove('Global_Objects/').split('/') |
| 38 | if object.end_with? 'Error' | 38 | if object.end_with? 'Error' |
| 39 | 'Errors' | 39 | 'Errors' |
| 40 | elsif INTL_OBJECTS.include?(object) | 40 | elsif INTL_OBJECTS.include?(object) |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | def get_name | 7 | def get_name |
| 8 | name = at_css('h1').content.strip | 8 | name = at_css('h1').content.strip |
| 9 | name.sub! ' Widget', '' | 9 | name.remove! ' Widget' |
| 10 | name.prepend '.' if name.start_with? 'jqm' | 10 | name.prepend '.' if name.start_with? 'jqm' |
| 11 | name << ' event' if type == 'Events' && !name.end_with?(' event') | 11 | name << ' event' if type == 'Events' && !name.end_with?(' event') |
| 12 | name | 12 | name |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | def get_name | 7 | def get_name |
| 8 | name = at_css('h1').content.strip | 8 | name = at_css('h1').content.strip |
| 9 | name.sub! ' Widget', '' | 9 | name.remove! ' Widget' |
| 10 | name.gsub!(/ [A-Z]/) { |str| str.downcase! } | 10 | name.gsub!(/ [A-Z]/) { |str| str.downcase! } |
| 11 | name | 11 | name |
| 12 | end | 12 | end |
| @@ -15,7 +15,7 @@ module Docs · 14 unmodified lines | |||
| 15 | def get_name | 15 | def get_name |
| 16 | return NAME_BY_SLUG[slug] if NAME_BY_SLUG.has_key?(slug) | 16 | return NAME_BY_SLUG[slug] if NAME_BY_SLUG.has_key?(slug) |
| 17 | name = at_css('h1').content.strip | 17 | name = at_css('h1').content.strip |
| 18 | name.sub! 'The ', '' | 18 | name.remove! 'The ' |
| 19 | name.sub! %r{"(.+?)"}, '\1' | 19 | name.sub! %r{"(.+?)"}, '\1' |
| 20 | name.gsub!(/ [A-Z]/) { |str| str.downcase! } | 20 | name.gsub!(/ [A-Z]/) { |str| str.downcase! } |
| 21 | name | 21 | name |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | css('h2').each do |node| | 7 | css('h2').each do |node| |
| 8 | type = node.content.split.first | 8 | type = node.content.split.first |
| 9 | type.gsub! %r{\W}, '' # remove quotation marks | 9 | type.remove! %r{\W} # remove quotation marks |
| 10 | 10 | ||
| 11 | node.parent.css('h3').each do |heading| | 11 | node.parent.css('h3').each do |heading| |
| 12 | name = heading.content | 12 | name = heading.content |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | |||
| 4 | def call | 4 | def call |
| 5 | # Set id attributes on headings | 5 | # Set id attributes on headings |
| 6 | css('a.target').each do |node| | 6 | css('a.target').each do |node| |
| 7 | node.next_element['id'] = node['name'].sub(/\A\//, '').sub(/\/\z/, '').gsub('/', '-') | 7 | node.next_element['id'] = node['name'].remove(/\A\//).remove(/\/\z/).gsub('/', '-') |
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | css('> article', '.prose', 'h2 > a', 'h3 > a', 'pre > code').each do |node| | 10 | css('> article', '.prose', 'h2 > a', 'h3 > a', 'pre > code').each do |node| |
| @@ -31,8 +31,8 @@ module Docs · 30 unmodified lines | |||
| 31 | name.prepend 'Language#' | 31 | name.prepend 'Language#' |
| 32 | else | 32 | else |
| 33 | name = node.content.strip | 33 | name = node.content.strip |
| 34 | name.sub! %r{\s[\d\.]+\z}, '' # remove version number | 34 | name.remove! %r{\s[\d\.]+\z} # remove version number |
| 35 | name.sub! %r{\s\(.+\)\z}, '' # remove parenthesis | 35 | name.remove! %r{\s\(.+\)\z} # remove parenthesis |
| 36 | name.prepend 'Parse: ' if type == 'Parse' | 36 | name.prepend 'Parse: ' if type == 'Parse' |
| 37 | end | 37 | end |
| 38 | 38 | ||
| @@ -54,8 +54,8 @@ module Docs · 53 unmodified lines | |||
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | # Classes | 56 | # Classes |
| 57 | if name.sub! 'Class: ', '' | 57 | if name.remove! 'Class: ' |
| 58 | name.sub! 'events.', '' # EventEmitter | 58 | name.remove! 'events.' # EventEmitter |
| 59 | klass = name | 59 | klass = name |
| 60 | entries << [name, node['id']] | 60 | entries << [name, node['id']] |
| 61 | next | 61 | next |
| @@ -70,7 +70,7 @@ module Docs · 8 unmodified lines | |||
| 70 | 70 | ||
| 71 | name.gsub! %r{\(.*?\)}, '()' | 71 | name.gsub! %r{\(.*?\)}, '()' |
| 72 | name.gsub! %r{\[.+?\]}, '[]' | 72 | name.gsub! %r{\[.+?\]}, '[]' |
| 73 | name.sub! 'assert(), ', '' # assert/assert.ok | 73 | name.remove! 'assert(), ' # assert/assert.ok |
| 74 | 74 | ||
| 75 | # Skip all that start with an uppercase letter ("Example") or include a space ("exports alias") | 75 | # Skip all that start with an uppercase letter ("Example") or include a space ("exports alias") |
| 76 | next unless (name.first.upcase! && !name.include?(' ')) || name.start_with?('Class Method') | 76 | next unless (name.first.upcase! && !name.include?(' ')) || name.start_with?('Class Method') |
| @@ -80,15 +80,15 @@ module Docs · 3 unmodified lines | |||
| 80 | # Differentiate socket classes (net, dgram, etc.) | 80 | # Differentiate socket classes (net, dgram, etc.) |
| 81 | name.sub!('socket.') { "#{klass.sub('.', '_').downcase!}." } | 81 | name.sub!('socket.') { "#{klass.sub('.', '_').downcase!}." } |
| 82 | 82 | ||
| 83 | name.sub! 'Class Method:', '' | 83 | name.remove! 'Class Method:' |
| 84 | name.sub! 'buf.', 'buffer.' | 84 | name.sub! 'buf.', 'buffer.' |
| 85 | name.sub! 'buf[', 'buffer[' | 85 | name.sub! 'buf[', 'buffer[' |
| 86 | name.sub! 'child.', 'childprocess.' | 86 | name.sub! 'child.', 'childprocess.' |
| 87 | name.sub! 'decoder.', 'stringdecoder.' | 87 | name.sub! 'decoder.', 'stringdecoder.' |
| 88 | name.sub! 'emitter.', 'eventemitter.' | 88 | name.sub! 'emitter.', 'eventemitter.' |
| 89 | name.sub! %r{\Arl\.}, 'interface.' | 89 | name.sub! %r{\Arl\.}, 'interface.' |
| 90 | name.sub! 'rs.', 'readstream.' | 90 | name.sub! 'rs.', 'readstream.' |
| 91 | name.sub! 'ws.', 'writestream.' | 91 | name.sub! 'ws.', 'writestream.' |
| 92 | 92 | ||
| 93 | # Skip duplicates (listen, connect, etc.) | 93 | # Skip duplicates (listen, connect, etc.) |
| 94 | unless name == entries[-1].try(:first) || name == entries[-2].try(:first) | 94 | unless name == entries[-1].try(:first) || name == entries[-2].try(:first) |
| @@ -82,7 +82,7 @@ module Docs · 81 unmodified lines | |||
| 82 | def get_name | 82 | def get_name |
| 83 | return 'IntlException' if slug == 'class.intlexception' | 83 | return 'IntlException' if slug == 'class.intlexception' |
| 84 | name = css('> .sect1 > .title', 'h1', 'h2').first.content | 84 | name = css('> .sect1 > .title', 'h1', 'h2').first.content |
| 85 | name.sub! 'The ', '' | 85 | name.remove! 'The ' |
| 86 | name.sub! ' class', ' (class)' | 86 | name.sub! ' class', ' (class)' |
| 87 | name.sub! ' interface', ' (interface)' | 87 | name.sub! ' interface', ' (interface)' |
| 88 | name | 88 | name |
| @@ -91,7 +91,7 @@ module Docs · 2 unmodified lines | |||
| 91 | def get_type | 91 | def get_type |
| 92 | type = at_css('.up').content.strip | 92 | type = at_css('.up').content.strip |
| 93 | type = 'SPL/Iterators' if type.end_with? 'Iterator' | 93 | type = 'SPL/Iterators' if type.end_with? 'Iterator' |
| 94 | type.sub! ' Functions', '' | 94 | type.remove! ' Functions' |
| 95 | 95 | ||
| 96 | TYPE_BY_NAME_STARTS_WITH.each_pair do |key, value| | 96 | TYPE_BY_NAME_STARTS_WITH.each_pair do |key, value| |
| 97 | break type = value if name.start_with?(key) | 97 | break type = value if name.start_with?(key) |
| @@ -18,15 +18,15 @@ module Docs · 17 unmodified lines | |||
| 18 | if %w(Overview Introduction).include?(name) | 18 | if %w(Overview Introduction).include?(name) |
| 19 | result[:pg_chapter_name] | 19 | result[:pg_chapter_name] |
| 20 | else | 20 | else |
| 21 | name.sub! ' (Common Table Expressions)', '' | 21 | name.remove! ' (Common Table Expressions)' |
| 22 | REPLACE_NAMES[name] || name | 22 | REPLACE_NAMES[name] || name |
| 23 | end | 23 | end |
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | def clean_heading_name(name) | 26 | def clean_heading_name(name) |
| 27 | name.sub! %r{\A[\d\.\s]+}, '' | 27 | name.remove! %r{\A[\d\.\s]+} |
| 28 | name.sub! 'Using ', '' | 28 | name.remove! 'Using ' |
| 29 | name.sub! %r{\AThe }, '' | 29 | name.remove! %r{\AThe } |
| 30 | name | 30 | name |
| 31 | end | 31 | end |
| 32 | 32 | ||
| @@ -41,7 +41,7 @@ module Docs · 8 unmodified lines | |||
| 41 | if type.start_with?('Func') && (match = name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/)) | 41 | if type.start_with?('Func') && (match = name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/)) |
| 42 | "Functions: #{match[1]}" | 42 | "Functions: #{match[1]}" |
| 43 | else | 43 | else |
| 44 | type.sub 'SQL ', '' | 44 | type.remove 'SQL ' |
| 45 | end | 45 | end |
| 46 | end | 46 | end |
| 47 | end | 47 | end |
| @@ -104,10 +104,10 @@ module Docs · 56 unmodified lines | |||
| 104 | def get_custom_entries(selector) | 104 | def get_custom_entries(selector) |
| 105 | css(selector).inject [] do |entries, node| | 105 | css(selector).inject [] do |entries, node| |
| 106 | name = node.content | 106 | name = node.content |
| 107 | name.gsub! %r{\(.*?\)}m, '' | 107 | name.remove! %r{\(.*?\)}m |
| 108 | name.gsub! %r{\[.*?\]}m, '' | 108 | name.remove! %r{\[.*?\]}m |
| 109 | name.squeeze! ' ' | 109 | name.squeeze! ' ' |
| 110 | name.sub! %r{\([^\)]*\z}, '' # bug fix: json_populate_record | 110 | name.remove! %r{\([^\)]*\z} # bug fix: json_populate_record |
| 111 | name = '||' if name.include? ' || ' | 111 | name = '||' if name.include? ' || ' |
| 112 | id = name.gsub(/[^a-z0-9\-_]/) { |char| char.ord } | 112 | id = name.gsub(/[^a-z0-9\-_]/) { |char| char.ord } |
| 113 | id = id.parameterize | 113 | id = id.parameterize |
| @@ -129,7 +129,7 @@ module Docs · 15 unmodified lines | |||
| 129 | end | 129 | end |
| 130 | 130 | ||
| 131 | def additional_entry_prefix | 131 | def additional_entry_prefix |
| 132 | type.dup.sub!('Functions: ', '') || self.name | 132 | type.dup.remove!('Functions: ') || self.name |
| 133 | end | 133 | end |
| 134 | 134 | ||
| 135 | def skip_additional_entries? | 135 | def skip_additional_entries? |
| @@ -38,7 +38,7 @@ module Docs · 37 unmodified lines | |||
| 38 | node.css('a').each do |link| | 38 | node.css('a').each do |link| |
| 39 | link.before(link.children).remove | 39 | link.before(link.children).remove |
| 40 | end | 40 | end |
| 41 | node.child.content = node.child.content.sub @levelRegexp, '' | 41 | node.child.content = node.child.content.remove @levelRegexp |
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | css('dt').each do |node| | 44 | css('dt').each do |node| |
| @@ -15,8 +15,8 @@ module Docs · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | def get_name | 16 | def get_name |
| 17 | name = at_css('h1').content | 17 | name = at_css('h1').content |
| 18 | name.sub! %r{\A[\d\.]+ }, '' # remove list number | 18 | name.remove! %r{\A[\d\.]+ } # remove list number |
| 19 | name.sub! %r{ [\u{2013}\u{2014}].+\z}, '' # remove text after em/en dash | 19 | name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash |
| 20 | name | 20 | name |
| 21 | end | 21 | end |
| 22 | 22 | ||
| @@ -33,10 +33,10 @@ module Docs · 10 unmodified lines | |||
| 33 | type = 'Internet Data Handling' | 33 | type = 'Internet Data Handling' |
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | type.sub! %r{\A\d+\.\s+}, '' # remove list number | 36 | type.remove! %r{\A\d+\.\s+} # remove list number |
| 37 | type.sub! "\u{00b6}", '' # remove paragraph character | 37 | type.remove! "\u{00b6}" # remove paragraph character |
| 38 | type.sub! ' and ', ' & ' | 38 | type.sub! ' and ', ' & ' |
| 39 | [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.sub! str, '' } | 39 | [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.remove!(str) } |
| 40 | 40 | ||
| 41 | REPLACE_TYPES[type] || type | 41 | REPLACE_TYPES[type] || type |
| 42 | end | 42 | end |
| @@ -74,7 +74,7 @@ module Docs · 31 unmodified lines | |||
| 74 | def clean_id_attributes | 74 | def clean_id_attributes |
| 75 | css('.section > .target[id]').each do |node| | 75 | css('.section > .target[id]').each do |node| |
| 76 | if dt = node.at_css('+ dl > dt') | 76 | if dt = node.at_css('+ dl > dt') |
| 77 | dt['id'] ||= node['id'].sub(/\w+\-/, '') | 77 | dt['id'] ||= node['id'].remove(/\w+\-/) |
| 78 | end | 78 | end |
| 79 | node.remove | 79 | node.remove |
| 80 | end | 80 | end |
| @@ -3,15 +3,15 @@ module Docs · 2 unmodified lines | |||
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | def get_name | 4 | def get_name |
| 5 | name = at_css('h1').content.strip | 5 | name = at_css('h1').content.strip |
| 6 | name.sub! 'class ', '' | 6 | name.remove! 'class ' |
| 7 | name.sub! 'module ', '' | 7 | name.remove! 'module ' |
| 8 | name | 8 | name |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | def get_type | 11 | def get_type |
| 12 | type = name.dup | 12 | type = name.dup |
| 13 | 13 | ||
| 14 | unless type.sub! %r{::.*\z}, '' | 14 | unless type.remove! %r{::.*\z} |
| 15 | parent = at_css('.meta-parent').try(:content).to_s | 15 | parent = at_css('.meta-parent').try(:content).to_s |
| 16 | return 'Errors' if type.end_with?('Error') || parent.end_with?('Error') || parent.end_with?('Exception') | 16 | return 'Errors' if type.end_with?('Error') || parent.end_with?('Error') || parent.end_with?('Exception') |
| 17 | end | 17 | end |
| @@ -29,8 +29,8 @@ module Docs · 11 unmodified lines | |||
| 29 | 29 | ||
| 30 | css('.method-detail').inject [] do |entries, node| | 30 | css('.method-detail').inject [] do |entries, node| |
| 31 | name = node['id'].dup | 31 | name = node['id'].dup |
| 32 | name.sub! %r{\A\w+?\-.}, '' | 32 | name.remove! %r{\A\w+?\-.} |
| 33 | name.sub! %r{\A-(?!\d)}, '' | 33 | name.remove! %r{\A-(?!\d)} |
| 34 | name.gsub! '-', '%' | 34 | name.gsub! '-', '%' |
| 35 | name = CGI.unescape(name) | 35 | name = CGI.unescape(name) |
| 36 | 36 | ||
| @@ -44,7 +44,7 @@ module Docs · 43 unmodified lines | |||
| 44 | 44 | ||
| 45 | # Remove links to type classes (e.g. Number) | 45 | # Remove links to type classes (e.g. Number) |
| 46 | css('.type > code').each do |node| | 46 | css('.type > code').each do |node| |
| 47 | node.before(node.content.sub('Sass::Script::Value::', '').sub('Sass::Script::', '')).remove | 47 | node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove |
| 48 | end | 48 | end |
| 49 | end | 49 | end |
| 50 | end | 50 | end |
| @@ -47,7 +47,7 @@ module Docs · 46 unmodified lines | |||
| 47 | next unless TYPES.include?(type) | 47 | next unless TYPES.include?(type) |
| 48 | 48 | ||
| 49 | name = node.content.strip | 49 | name = node.content.strip |
| 50 | name.sub! %r{\A.+?: }, '' | 50 | name.remove! %r{\A.+?: } |
| 51 | 51 | ||
| 52 | next if SKIP_NAMES.include?(name) | 52 | next if SKIP_NAMES.include?(name) |
| 53 | 53 | ||
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | |||
| 3 | self.namespace = 'html_pipeline' | 3 | self.namespace = 'html_pipeline' |
| 4 | 4 | ||
| 5 | def call_filter(event) | 5 | def call_filter(event) |
| 6 | log "Filter: #{event.payload[:filter].sub('Docs::', '').sub('Filter', '')} [#{event.duration.round}ms]" | 6 | log "Filter: #{event.payload[:filter].remove('Docs::').remove('Filter')} [#{event.duration.round}ms]" |
| 7 | end | 7 | end |
| 8 | end | 8 | end |
| 9 | end | 9 | end |
| @@ -17,7 +17,7 @@ class DocsCLI < Thor · 16 unmodified lines | |||
| 17 | Docs.all. | 17 | Docs.all. |
| 18 | map { |doc| [doc.to_s.demodulize.underscore, doc] }. | 18 | map { |doc| [doc.to_s.demodulize.underscore, doc] }. |
| 19 | each { |pair| max_length = pair.first.length if pair.first.length > max_length }. | 19 | each { |pair| max_length = pair.first.length if pair.first.length > max_length }. |
| 20 | each { |pair| puts "#{pair.first.rjust max_length + 1}: #{pair.second.base_url.sub %r{\Ahttps?://}, ''}" } | 20 | each { |pair| puts "#{pair.first.rjust max_length + 1}: #{pair.second.base_url.remove %r{\Ahttps?://}}" } |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | desc 'page <doc> [path] [--verbose] [--debug]', 'Generate a page (no indexing)' | 23 | desc 'page <doc> [path] [--verbose] [--debug]', 'Generate a page (no indexing)' |
| @@ -124,7 +124,7 @@ class DocsFileStoreTest < MiniTest::Spec · 123 unmodified lines | |||
| 124 | describe "#each" do | 124 | describe "#each" do |
| 125 | let :paths do | 125 | let :paths do |
| 126 | paths = [] | 126 | paths = [] |
| 127 | store.each { |path| paths << path.sub(tmp_path, '') } | 127 | store.each { |path| paths << path.remove(tmp_path) } |
| 128 | paths | 128 | paths |
| 129 | end | 129 | end |
| 130 | 130 | ||