rubocop: Avoid shadowing variables
This commit is contained in:
parent
37d489f067
commit
bbbc8bacf1
@ -6,15 +6,6 @@
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 7
|
||||
Lint/ShadowingOuterLocalVariable:
|
||||
Exclude:
|
||||
- '_contrib/updatetx.rb'
|
||||
- '_plugins/contributors.rb'
|
||||
- '_plugins/glossary.rb'
|
||||
- '_plugins/sitemap.rb'
|
||||
- '_plugins/translate.rb'
|
||||
|
||||
# Offense count: 10
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
||||
|
||||
@ -41,8 +41,8 @@ dirs.each do |dir|
|
||||
# Drop language in statements applied to many languages ( e.g. {% when 'ar' or 'fr' .. %} )
|
||||
contents.gsub!(Regexp.new("{% when '" + lang + "' or (.*?) %}"), '{% when \1 %}')
|
||||
contents.gsub!(Regexp.new("{% when (.*?) or '" + lang + "' (.*?)%}"), '{% when \1 \2%}')
|
||||
File.open(dir + '/' + file, 'w') do |file|
|
||||
file.write(contents)
|
||||
File.open(dir + '/' + file, 'w') do |f|
|
||||
f.write(contents)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,7 +73,7 @@ module Jekyll
|
||||
result.each do |key, value|
|
||||
contributors.push(value)
|
||||
end
|
||||
contributors.sort_by { |c| - c['contributions'] }
|
||||
contributors.sort_by { |commits| - commits['contributions'] }
|
||||
end
|
||||
|
||||
def generate(site)
|
||||
|
||||
@ -134,14 +134,14 @@ module Jekyll
|
||||
devsearches_data_item = {}
|
||||
|
||||
if cat == "Glossary"
|
||||
items.each { |lang, list|
|
||||
items.each { |language, list|
|
||||
list.each { |el|
|
||||
flat = el.flatten
|
||||
devsearches_json.push({
|
||||
"label" => flat[0],
|
||||
"uri" => flat[1],
|
||||
"category" => cat,
|
||||
"lang" => lang
|
||||
"language" => language
|
||||
})
|
||||
}
|
||||
# puts list
|
||||
|
||||
@ -47,13 +47,13 @@ module Jekyll
|
||||
sitemap.puts ' xmlns:xhtml="http://www.w3.org/1999/xhtml">'
|
||||
# Add translated pages with their alternative in each languages
|
||||
locs['en']['url'].each do |id, value|
|
||||
locs.each do |lang, value|
|
||||
locs.each do |lang, var|
|
||||
# Don't add a page if their url is not translated
|
||||
next if locs[lang]['url'][id].nil? or locs[lang]['url'][id] == ''
|
||||
|
||||
sitemap.puts '<url>'
|
||||
sitemap.puts ' <loc>https://bitcoin.org/' + lang + '/' + CGI::escape(locs[lang]['url'][id]) + '</loc>'
|
||||
locs.each do |altlang, value|
|
||||
locs.each do |altlang, altvar|
|
||||
next if locs[altlang]['url'][id].nil? or locs[altlang]['url'][id] == '' or altlang == lang
|
||||
|
||||
sitemap.puts ' <xhtml:link'
|
||||
|
||||
@ -86,9 +86,9 @@ module Jekyll
|
||||
|
||||
# replace urls and anchors in string
|
||||
url = site['loc'][lang]['url']
|
||||
url.each do |key, value|
|
||||
url.each do |k, v|
|
||||
if !value.nil?
|
||||
text.gsub!("#" + key + "#", '/' + lang + '/' + CGI::escape(value))
|
||||
text.gsub!("#" + k + "#", '/' + lang + '/' + CGI::escape(v))
|
||||
end
|
||||
end
|
||||
|
||||
@ -99,9 +99,9 @@ module Jekyll
|
||||
|
||||
anc = site['loc'][lang]['anchor']
|
||||
anc.each do |page, anch|
|
||||
anch.each do |key, value|
|
||||
anch.each do |k, v|
|
||||
if !value.nil?
|
||||
text.gsub!("[" + page + '.' + key + "]", CGI::escape(value))
|
||||
text.gsub!("[" + page + '.' + k + "]", CGI::escape(v))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user