Merge pull request #2447 from Ryman/rustup

Split on comma in language name if no match is found
This commit is contained in:
Arfon Smith
2015-08-07 10:28:21 +01:00
4 changed files with 2351 additions and 3 deletions

View File

@@ -150,7 +150,7 @@ module Linguist
#
# Returns the Language or nil if none was found.
def self.find_by_name(name)
name && @name_index[name.downcase]
name && (@name_index[name.downcase] || @name_index[name.split(',').first.downcase])
end
# Public: Look up Language by one of its aliases.
@@ -164,7 +164,7 @@ module Linguist
#
# Returns the Language or nil if none was found.
def self.find_by_alias(name)
name && @alias_index[name.downcase]
name && (@alias_index[name.downcase] || @alias_index[name.split(',').first.downcase])
end
# Public: Look up Languages by filename.
@@ -240,7 +240,7 @@ module Linguist
#
# Returns the Language or nil if none was found.
def self.[](name)
name && @index[name.downcase]
name && (@index[name.downcase] || @index[name.split(',').first.downcase])
end
# Public: A List of popular languages