mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Improved Heuristics for .asc files.
This commit is contained in:
@@ -151,12 +151,15 @@ module Linguist
|
|||||||
end
|
end
|
||||||
|
|
||||||
disambiguate "AsciiDoc", "AGS Script", "Public Key" do |data|
|
disambiguate "AsciiDoc", "AGS Script", "Public Key" do |data|
|
||||||
if /^=+(\s|\n)/.match(data)
|
if /^[=-]+(\s|\n)|{{[A-Za-z]/.match(data)
|
||||||
Language["AsciiDoc"]
|
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)
|
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"]
|
Language["AGS Script"]
|
||||||
else /^-----BEGIN/.match(data)
|
elsif /^-----BEGIN/.match(data)
|
||||||
Language["Public Key"]
|
Language["Public Key"]
|
||||||
|
else
|
||||||
|
# Plain text can also be AsciiDoc.
|
||||||
|
Language["AsciiDoc"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user