Add == to assignment in condition

pull/130/head
Guy Halperin 10 years ago
parent 79e876a82b
commit 18d895d635

@ -134,7 +134,7 @@ class App < Sinatra::Application
end
get %r{\A/(\w+)(\-[\w\-]+)?(/)?(.+)?\z} do |doc, type, slash, rest|
return 404 unless @doc = settings.docs[doc]
return 404 unless @doc == settings.docs[doc]
if !rest && !slash
redirect "/#{doc}#{type}/"

@ -27,7 +27,7 @@ module Docs
def justify(str)
return str unless terminal_width
max_length = if tag = str.slice!(/ \[.+\]\z/)
max_length = if tag == str.slice!(/ \[.+\]\z/)
terminal_width - tag.length
else
terminal_width

@ -22,7 +22,7 @@ module Docs
end
def get_type
if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
if type == at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
type.strip!
type.remove! ' library'
type.remove! ' utilities'

@ -10,7 +10,7 @@ module Docs
def update_links
css('a').each do |link|
next if context[:skip_link].is_a?(Proc) && context[:skip_link].call(link)
next unless url = to_internal_url(link['href'])
next unless url == to_internal_url(link['href'])
link['href'] = internal_path_to(url)
yield url if block_given?
end

@ -22,8 +22,8 @@ module Docs
entries = []
css('dl.function', 'dl.class', 'dl.method', 'dl.attribute').each do |node|
next unless id = node.at_css('dt')['id']
next unless name = id.dup.sub!('django.', '')
next unless id == node.at_css('dt')['id']
next unless name == id.dup.sub!('django.', '')
path = name.split('.')
type = "django.#{path.first}"

@ -100,7 +100,7 @@ module Docs
return value if name =~ key
end
if spec = css('.standard-table').last
if spec == css('.standard-table').last
spec = spec.content
TYPE_BY_SPEC.each_pair do |key, value|
return value if spec.include?(key)

@ -52,7 +52,7 @@ module Docs
elsif LOAD_SLUGS.include?(slug)
'Load'
else
if info = at_css('.eventinfo').try(:content)
if info == at_css('.eventinfo').try(:content)
TYPE_BY_INFO.each_pair do |key, value|
return value if info.include?(key)
end

@ -13,7 +13,7 @@ module Docs
name.sub! %r{\(.+?\)}, '()'
entries << [name, heading['id'], type]
if h4 = heading.parent.at_css('h4') and h4.content.strip == 'Aliases'
if h4 == heading.parent.at_css('h4') and h4.content.strip == 'Aliases'
h4.next_element.content.split(',').each do |n|
entries << ["#{n.strip}()", heading['id'], type]
end

@ -73,7 +73,7 @@ module Docs
def clean_id_attributes
css('.section > .target[id]').each do |node|
if dt = node.at_css('+ dl > dt')
if dt == node.at_css('+ dl > dt')
dt['id'] ||= node['id'].remove(/\w+\-/)
end
node.remove

@ -23,7 +23,7 @@ module Docs
# Move id attributes to headings
css('.method-detail').each do |node|
next unless heading = node.at_css('.method-heading')
next unless heading == node.at_css('.method-heading')
heading['id'] = node['id']
node.remove_attribute 'id'
end

@ -7,7 +7,7 @@ module Docs
end
def root
if table = at_css('.topicpage-table')
if table == at_css('.topicpage-table')
table.after(table.css('td').children).remove
end
end

@ -42,7 +42,7 @@ module Docs
next if file == path
Find.prune if File.basename(file)[0] == '.'
yield file
Find.prune unless File.exists?(file)
Find.prune unless File.exist?(file)
end
end
end

Loading…
Cancel
Save