Skip to content

Commit

Permalink
Improve .asc heuristic for Public Key.
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbrinkhoff committed Apr 21, 2015
1 parent 415c7d3 commit e018b43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/linguist/heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ def call(data)
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

Expand Down
2 changes: 1 addition & 1 deletion test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_asc_by_heuristics
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

Expand Down

0 comments on commit e018b43

Please sign in to comment.