mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 04:18:48 +00:00
Merge master
This commit is contained in:
@@ -15,8 +15,8 @@ module Linguist
|
||||
#
|
||||
# Returns nothing.
|
||||
#
|
||||
# Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token,
|
||||
# per-language. See also dump_all_tokens, below.
|
||||
# Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token or
|
||||
# per-language. See also #dump_all_tokens, below.
|
||||
def self.train!(db, language, data)
|
||||
tokens = Tokenizer.tokenize(data)
|
||||
|
||||
@@ -151,10 +151,10 @@ module Linguist
|
||||
printf "%#{maxlen}s", ""
|
||||
puts " #" + languages.map { |lang| sprintf("%10s", lang) }.join
|
||||
|
||||
tokmap = Hash.new(0)
|
||||
tokens.each { |tok| tokmap[tok] += 1 }
|
||||
token_map = Hash.new(0)
|
||||
tokens.each { |tok| token_map[tok] += 1 }
|
||||
|
||||
tokmap.sort.each { |tok, count|
|
||||
token_map.sort.each { |tok, count|
|
||||
arr = languages.map { |lang| [lang, token_probability(tok, lang)] }
|
||||
min = arr.map { |a,b| b }.min
|
||||
minlog = Math.log(min)
|
||||
|
||||
@@ -59,7 +59,8 @@ module Linguist
|
||||
generated_net_docfile? ||
|
||||
generated_net_designer_file? ||
|
||||
generated_protocol_buffer? ||
|
||||
generated_jni_header?
|
||||
generated_jni_header? ||
|
||||
node_modules?
|
||||
end
|
||||
|
||||
# Internal: Is the blob an XCode project file?
|
||||
@@ -74,7 +75,7 @@ module Linguist
|
||||
|
||||
# Internal: Is the blob minified files?
|
||||
#
|
||||
# Consider a file minified if it contains more than 5% spaces.
|
||||
# Consider a file minified if it contains less than 5% spaces.
|
||||
# Currently, only JS and CSS files are detected by this method.
|
||||
#
|
||||
# Returns true or false.
|
||||
@@ -193,5 +194,13 @@ module Linguist
|
||||
return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */")
|
||||
return lines[1].include?("#include <jni.h>")
|
||||
end
|
||||
|
||||
# node_modules/ can contain large amounts of files, in general not meant
|
||||
# for humans in pull requests.
|
||||
#
|
||||
# Returns true or false.
|
||||
def node_modules?
|
||||
!!name.match(/node_modules\//)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ module Linguist
|
||||
#
|
||||
# Returns an array
|
||||
def self.detectable_markup
|
||||
["CSS", "Less", "Sass"]
|
||||
["CSS", "Less", "Sass", "TeX"]
|
||||
end
|
||||
|
||||
# Internal: Create a new Language object
|
||||
|
||||
@@ -28,13 +28,13 @@ ABAP:
|
||||
type: programming
|
||||
lexer: ABAP
|
||||
primary_extension: .abap
|
||||
|
||||
|
||||
ANTLR:
|
||||
type: programming
|
||||
color: "#9DC3FF"
|
||||
lexer: ANTLR
|
||||
primary_extension: .g4
|
||||
|
||||
|
||||
ASP:
|
||||
type: programming
|
||||
color: "#6a40fd"
|
||||
@@ -122,6 +122,15 @@ AutoHotkey:
|
||||
- ahk
|
||||
primary_extension: .ahk
|
||||
|
||||
AutoIt:
|
||||
type: programming
|
||||
color: "#36699B"
|
||||
aliases:
|
||||
- au3
|
||||
- AutoIt3
|
||||
- AutoItScript
|
||||
primary_extension: .au3
|
||||
|
||||
Awk:
|
||||
type: programming
|
||||
lexer: Awk
|
||||
@@ -145,6 +154,15 @@ Batchfile:
|
||||
Befunge:
|
||||
primary_extension: .befunge
|
||||
|
||||
BlitzBasic:
|
||||
type: programming
|
||||
aliases:
|
||||
- blitzplus
|
||||
- blitz3d
|
||||
primary_extension: .bb
|
||||
extensions:
|
||||
- .decls
|
||||
|
||||
BlitzMax:
|
||||
primary_extension: .bmx
|
||||
|
||||
@@ -357,7 +375,7 @@ D-ObjDump:
|
||||
type: data
|
||||
lexer: d-objdump
|
||||
primary_extension: .d-objdump
|
||||
|
||||
|
||||
DM:
|
||||
type: programming
|
||||
color: "#075ff1"
|
||||
@@ -383,6 +401,7 @@ Darcs Patch:
|
||||
|
||||
Dart:
|
||||
type: programming
|
||||
color: "#98BAD6"
|
||||
primary_extension: .dart
|
||||
|
||||
DCPU-16 ASM:
|
||||
@@ -393,7 +412,7 @@ DCPU-16 ASM:
|
||||
- .dasm
|
||||
aliases:
|
||||
- dasm16
|
||||
|
||||
|
||||
Diff:
|
||||
primary_extension: .diff
|
||||
|
||||
@@ -408,7 +427,7 @@ Ecere Projects:
|
||||
lexer: JSON
|
||||
primary_extension: .epj
|
||||
|
||||
Ecl:
|
||||
ECL:
|
||||
type: programming
|
||||
color: "#8a1267"
|
||||
primary_extension: .ecl
|
||||
@@ -442,7 +461,7 @@ Emacs Lisp:
|
||||
- elisp
|
||||
- emacs
|
||||
primary_extension: .el
|
||||
filenames:
|
||||
filenames:
|
||||
- .emacs
|
||||
extensions:
|
||||
- .emacs
|
||||
@@ -972,6 +991,12 @@ Nemerle:
|
||||
color: "#0d3c6e"
|
||||
primary_extension: .n
|
||||
|
||||
NetLogo:
|
||||
type: programming
|
||||
lexer: Common Lisp
|
||||
color: "#ff2b2b"
|
||||
primary_extension: .nlogo
|
||||
|
||||
Nginx:
|
||||
type: markup
|
||||
lexer: Nginx configuration file
|
||||
@@ -1311,6 +1336,7 @@ Ruby:
|
||||
- .thor
|
||||
- .watchr
|
||||
filenames:
|
||||
- Appraisals
|
||||
- Berksfile
|
||||
- Gemfile
|
||||
- Guardfile
|
||||
@@ -1503,6 +1529,12 @@ Unified Parallel C:
|
||||
color: "#755223"
|
||||
primary_extension: .upc
|
||||
|
||||
UnrealScript:
|
||||
type: programming
|
||||
color: "#a54c4d"
|
||||
lexer: Java
|
||||
primary_extension: .uc
|
||||
|
||||
VHDL:
|
||||
type: programming
|
||||
lexer: vhdl
|
||||
@@ -1581,6 +1613,7 @@ XML:
|
||||
- .kml
|
||||
- .mxml
|
||||
- .plist
|
||||
- .pluginspec
|
||||
- .ps1xml
|
||||
- .psc1
|
||||
- .pt
|
||||
@@ -1611,6 +1644,7 @@ XML:
|
||||
filenames:
|
||||
- .classpath
|
||||
- .project
|
||||
- phpunit.xml.dist
|
||||
|
||||
XProc:
|
||||
type: programming
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -139,7 +139,7 @@
|
||||
|
||||
# LICENSE, README, git config files
|
||||
- ^COPYING$
|
||||
- ^LICENSE$
|
||||
- LICENSE$
|
||||
- gitattributes$
|
||||
- gitignore$
|
||||
- gitmodules$
|
||||
|
||||
Reference in New Issue
Block a user