mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-18 22:23:07 -03:00
Merge pull request #46 from look/look/add-language-id
Add GetLanguageID function
This commit is contained in:
10
common.go
10
common.go
@ -500,6 +500,16 @@ func GetLanguageExtensions(language string) []string {
|
||||
return data.ExtensionsByLanguage[language]
|
||||
}
|
||||
|
||||
// GetLanguageID returns the ID for the language. IDs are assigned by GitHub.
|
||||
// The input must be the canonical language name. Aliases are not supported.
|
||||
//
|
||||
// NOTE: The zero value (0) is a valid language ID, so this API mimics the Go
|
||||
// map API. Use the second return value to check if the language was found.
|
||||
func GetLanguageID(language string) (int, bool) {
|
||||
id, ok := data.IDByLanguage[language]
|
||||
return id, ok
|
||||
}
|
||||
|
||||
// Type represent language's type. Either data, programming, markup, prose, or unknown.
|
||||
type Type int
|
||||
|
||||
|
Reference in New Issue
Block a user