mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Improve .asc heuristic for Public Key.
This commit is contained in:
@@ -155,12 +155,12 @@ module Linguist
|
||||
end
|
||||
|
||||
disambiguate "AsciiDoc", "AGS Script", "Public Key" do |data|
|
||||
if /^[=-]+(\s|\n)|{{[A-Za-z]/.match(data)
|
||||
if /^(----[- ]BEGIN|ssh-(rsa|dss)) /.match(data)
|
||||
Language["Public Key"]
|
||||
elsif /^[=-]+(\s|\n)|{{[A-Za-z]/.match(data)
|
||||
Language["AsciiDoc"]
|
||||
elsif /^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])/.match(data)
|
||||
Language["AGS Script"]
|
||||
elsif /^-----BEGIN/.match(data)
|
||||
Language["Public Key"]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class TestHeuristcs < Minitest::Test
|
||||
assert_heuristics({
|
||||
"AsciiDoc" => "AsciiDoc/list.asc",
|
||||
"AGS Script" => "AGS Script/GlobalScript.asc",
|
||||
"Public Key" => "Public Key/sunCert.asc"
|
||||
"Public Key" => all_fixtures("Public Key", "*.asc")
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user