mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-07 20:08:48 +00:00
Merge branch 'master' of github.com:github/linguist
Conflicts: lib/linguist/languages.yml
This commit is contained in:
@@ -58,6 +58,15 @@ module Linguist
|
||||
_mime_type ? _mime_type.binary? : false
|
||||
end
|
||||
|
||||
# Internal: Is the blob binary according to its mime type,
|
||||
# overriding it if we have better data from the languages.yml
|
||||
# database.
|
||||
#
|
||||
# Return true or false
|
||||
def likely_binary?
|
||||
binary_mime_type? and not Language.find_by_filename(name)
|
||||
end
|
||||
|
||||
# Public: Get the Content-Type header value
|
||||
#
|
||||
# This value is used when serving raw blobs.
|
||||
@@ -139,7 +148,14 @@ module Linguist
|
||||
#
|
||||
# Return true or false
|
||||
def image?
|
||||
['.png', '.jpg', '.jpeg', '.gif'].include?(extname)
|
||||
['.png', '.jpg', '.jpeg', '.gif'].include?(extname.downcase)
|
||||
end
|
||||
|
||||
# Public: Is the blob a supported 3D model format?
|
||||
#
|
||||
# Return true or false
|
||||
def solid?
|
||||
extname.downcase == '.stl'
|
||||
end
|
||||
|
||||
MEGABYTE = 1024 * 1024
|
||||
@@ -251,7 +267,7 @@ module Linguist
|
||||
|
||||
# Public: Is the blob a generated file?
|
||||
#
|
||||
# Generated source code is supressed in diffs and is ignored by
|
||||
# Generated source code is suppressed in diffs and is ignored by
|
||||
# language statistics.
|
||||
#
|
||||
# May load Blob#data
|
||||
@@ -266,7 +282,7 @@ module Linguist
|
||||
# Excluded:
|
||||
# - Files over 0.1MB
|
||||
# - Non-text files
|
||||
# - Langauges marked as not searchable
|
||||
# - Languages marked as not searchable
|
||||
# - Generated source files
|
||||
#
|
||||
# Please add additional test coverage to
|
||||
|
||||
@@ -40,7 +40,7 @@ module Linguist
|
||||
|
||||
# Public: Guess language of data.
|
||||
#
|
||||
# db - Hash of classifer tokens database.
|
||||
# db - Hash of classifier tokens database.
|
||||
# data - Array of tokens or String data to analyze.
|
||||
# languages - Array of language name Strings to restrict to.
|
||||
#
|
||||
@@ -85,7 +85,7 @@ module Linguist
|
||||
scores.sort { |a, b| b[1] <=> a[1] }.map { |score| [score[0], score[1]] }
|
||||
end
|
||||
|
||||
# Internal: Probably of set of tokens in a language occuring - P(D | C)
|
||||
# Internal: Probably of set of tokens in a language occurring - P(D | C)
|
||||
#
|
||||
# tokens - Array of String tokens.
|
||||
# language - Language to check.
|
||||
@@ -97,7 +97,7 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
# Internal: Probably of token in language occuring - P(F | C)
|
||||
# Internal: Probably of token in language occurring - P(F | C)
|
||||
#
|
||||
# token - String token.
|
||||
# language - Language to check.
|
||||
@@ -111,7 +111,7 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
# Internal: Probably of a language occuring - P(C)
|
||||
# Internal: Probably of a language occurring - P(C)
|
||||
#
|
||||
# language - Language to check.
|
||||
#
|
||||
|
||||
@@ -43,7 +43,7 @@ module Linguist
|
||||
|
||||
# Internal: Is the blob a generated file?
|
||||
#
|
||||
# Generated source code is supressed in diffs and is ignored by
|
||||
# Generated source code is suppressed in diffs and is ignored by
|
||||
# language statistics.
|
||||
#
|
||||
# Please add additional test coverage to
|
||||
@@ -86,7 +86,7 @@ module Linguist
|
||||
|
||||
# Internal: Is the blob of JS generated by CoffeeScript?
|
||||
#
|
||||
# CoffeScript is meant to output JS that would be difficult to
|
||||
# CoffeeScript is meant to output JS that would be difficult to
|
||||
# tell if it was generated or not. Look for a number of patterns
|
||||
# output by the CS compiler.
|
||||
#
|
||||
|
||||
@@ -73,7 +73,7 @@ module Linguist
|
||||
#
|
||||
# Returns Language or nil.
|
||||
def self.detect(name, data, mode = nil)
|
||||
# A bit of an elegant hack. If the file is exectable but extensionless,
|
||||
# A bit of an elegant hack. If the file is executable but extensionless,
|
||||
# append a "magic" extension so it can be classified with other
|
||||
# languages that have shebang scripts.
|
||||
if File.extname(name).empty? && mode && (mode.to_i(8) & 05) == 05
|
||||
@@ -329,7 +329,7 @@ module Linguist
|
||||
|
||||
# Deprecated: Get primary extension
|
||||
#
|
||||
# Defaults to the first extension but can be overriden
|
||||
# Defaults to the first extension but can be overridden
|
||||
# in the languages.yml.
|
||||
#
|
||||
# The primary extension can not be nil. Tests should verify this.
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# Defines all Languages known to GitHub.
|
||||
#
|
||||
# All languages have an associated lexer for syntax highlighting. It
|
||||
# defaults to name.downcase, which covers most cases. Make sure the
|
||||
# lexer exists in lexers.yml. This is a list of available in our
|
||||
# version of pygments.
|
||||
# defaults to name.downcase, which covers most cases.
|
||||
#
|
||||
# type - Either data, programming, markup, or nil
|
||||
# lexer - An explicit lexer String (defaults to name.downcase)
|
||||
# lexer - An explicit lexer String (defaults to name)
|
||||
# aliases - An Array of additional aliases (implicitly
|
||||
# includes name.downcase)
|
||||
# ace_mode - A String name of Ace Mode (if available)
|
||||
@@ -26,6 +24,11 @@
|
||||
#
|
||||
# Please keep this list alphabetized.
|
||||
|
||||
ABAP:
|
||||
type: programming
|
||||
lexer: ABAP
|
||||
primary_extension: .abap
|
||||
|
||||
ASP:
|
||||
type: programming
|
||||
color: "#6a40fd"
|
||||
@@ -109,6 +112,15 @@ AutoHotkey:
|
||||
- ahk
|
||||
primary_extension: .ahk
|
||||
|
||||
Awk:
|
||||
type: programming
|
||||
lexer: Awk
|
||||
primary_extension: .awk
|
||||
extensions:
|
||||
- .gawk
|
||||
- .mawk
|
||||
- .nawk
|
||||
|
||||
Batchfile:
|
||||
type: programming
|
||||
group: Shell
|
||||
@@ -186,6 +198,11 @@ C2hs Haskell:
|
||||
- c2hs
|
||||
primary_extension: .chs
|
||||
|
||||
CLIPS:
|
||||
type: programming
|
||||
lexer: Text only
|
||||
primary_extension: .clp
|
||||
|
||||
CMake:
|
||||
primary_extension: .cmake
|
||||
extensions:
|
||||
@@ -224,6 +241,8 @@ CoffeeScript:
|
||||
primary_extension: .coffee
|
||||
extensions:
|
||||
- ._coffee
|
||||
- .cson
|
||||
- .iced
|
||||
filenames:
|
||||
- Cakefile
|
||||
|
||||
@@ -246,6 +265,7 @@ Common Lisp:
|
||||
- lisp
|
||||
primary_extension: .lisp
|
||||
extensions:
|
||||
- .asd
|
||||
- .lsp
|
||||
- .ny
|
||||
|
||||
@@ -285,6 +305,13 @@ D-ObjDump:
|
||||
lexer: d-objdump
|
||||
primary_extension: .d-objdump
|
||||
|
||||
DOT:
|
||||
type: programming
|
||||
lexer: Text only
|
||||
primary_extension: .dot
|
||||
extensions:
|
||||
- .gv
|
||||
|
||||
Darcs Patch:
|
||||
search_term: dpatch
|
||||
aliases:
|
||||
@@ -302,6 +329,7 @@ Delphi:
|
||||
color: "#b0ce4e"
|
||||
primary_extension: .pas
|
||||
extensions:
|
||||
- .dfm
|
||||
- .lpr
|
||||
|
||||
DCPU-16 ASM:
|
||||
@@ -429,8 +457,7 @@ Forth:
|
||||
color: "#341708"
|
||||
lexer: Text only
|
||||
extensions:
|
||||
- .forth
|
||||
- .fth
|
||||
- .4th
|
||||
|
||||
GAS:
|
||||
type: programming
|
||||
@@ -521,7 +548,9 @@ HTML+ERB:
|
||||
- erb
|
||||
primary_extension: .erb
|
||||
extensions:
|
||||
- .erb.deface
|
||||
- .html.erb
|
||||
- .html.erb.deface
|
||||
|
||||
HTML+PHP:
|
||||
type: markup
|
||||
@@ -536,6 +565,9 @@ Haml:
|
||||
group: HTML
|
||||
type: markup
|
||||
primary_extension: .haml
|
||||
extensions:
|
||||
- .haml.deface
|
||||
- .html.haml.deface
|
||||
|
||||
Handlebars:
|
||||
type: markup
|
||||
@@ -598,8 +630,6 @@ Java:
|
||||
ace_mode: java
|
||||
color: "#b07219"
|
||||
primary_extension: .java
|
||||
extensions:
|
||||
- .pde
|
||||
|
||||
Java Server Pages:
|
||||
group: Java
|
||||
@@ -651,11 +681,6 @@ Lasso:
|
||||
ace_mode: lasso
|
||||
color: "#2584c3"
|
||||
primary_extension: .lasso
|
||||
extensions:
|
||||
- .inc
|
||||
- .las
|
||||
- .lasso9
|
||||
- .ldml
|
||||
|
||||
Less:
|
||||
type: markup
|
||||
@@ -670,6 +695,17 @@ LilyPond:
|
||||
extensions:
|
||||
- .ily
|
||||
|
||||
Literate CoffeeScript:
|
||||
type: programming
|
||||
group: CoffeeScript
|
||||
lexer: Text only
|
||||
ace_mode: markdown
|
||||
wrap: true
|
||||
search_term: litcoffee
|
||||
aliases:
|
||||
- litcoffee
|
||||
primary_extension: .litcoffee
|
||||
|
||||
Literate Haskell:
|
||||
type: programming
|
||||
group: Haskell
|
||||
@@ -690,6 +726,14 @@ LiveScript:
|
||||
filenames:
|
||||
- Slakefile
|
||||
|
||||
Logos:
|
||||
type: programming
|
||||
primary_extension: .xm
|
||||
extensions:
|
||||
- .x
|
||||
- .xi
|
||||
- .xmi
|
||||
|
||||
Logtalk:
|
||||
type: programming
|
||||
primary_extension: .lgt
|
||||
@@ -701,7 +745,6 @@ Lua:
|
||||
primary_extension: .lua
|
||||
extensions:
|
||||
- .nse
|
||||
- .pd_lua
|
||||
|
||||
Makefile:
|
||||
aliases:
|
||||
@@ -746,6 +789,9 @@ Max:
|
||||
- maxmsp
|
||||
search_term: max/msp
|
||||
primary_extension: .mxt
|
||||
extensions:
|
||||
- .maxhelp
|
||||
- .maxpat
|
||||
|
||||
MiniD: # Legacy
|
||||
searchable: false
|
||||
@@ -762,6 +808,11 @@ Mirah:
|
||||
- .mir
|
||||
- .mirah
|
||||
|
||||
Monkey:
|
||||
type: programming
|
||||
lexer: Monkey
|
||||
primary_extension: .monkey
|
||||
|
||||
Moocode:
|
||||
lexer: MOOCode
|
||||
primary_extension: .moo
|
||||
@@ -773,6 +824,9 @@ MoonScript:
|
||||
Myghty:
|
||||
primary_extension: .myt
|
||||
|
||||
NSIS:
|
||||
primary_extension: .nsi
|
||||
|
||||
Nemerle:
|
||||
type: programming
|
||||
color: "#0d3c6e"
|
||||
@@ -813,6 +867,7 @@ OCaml:
|
||||
color: "#3be133"
|
||||
primary_extension: .ml
|
||||
extensions:
|
||||
- .eliomi
|
||||
- .mli
|
||||
- .mll
|
||||
- .mly
|
||||
@@ -846,8 +901,6 @@ Omgrofl:
|
||||
primary_extension: .omgrofl
|
||||
color: "#cabbff"
|
||||
lexer: Text only
|
||||
extensions:
|
||||
- .omgrofl
|
||||
|
||||
Opa:
|
||||
type: programming
|
||||
@@ -858,6 +911,8 @@ OpenCL:
|
||||
group: C
|
||||
lexer: C
|
||||
primary_extension: .cl
|
||||
extensions:
|
||||
- .opencl
|
||||
|
||||
OpenEdge ABL:
|
||||
type: programming
|
||||
@@ -918,6 +973,20 @@ Perl:
|
||||
- .pod
|
||||
- .psgi
|
||||
|
||||
Pike:
|
||||
type: programming
|
||||
color: "#066ab2"
|
||||
lexer: C
|
||||
primary_extension: .pike
|
||||
extensions:
|
||||
- .pmod
|
||||
|
||||
PogoScript:
|
||||
type: programming
|
||||
color: "#d80074"
|
||||
lexer: Text only
|
||||
primary_extension: .pogo
|
||||
|
||||
PowerShell:
|
||||
type: programming
|
||||
ace_mode: powershell
|
||||
@@ -925,6 +994,12 @@ PowerShell:
|
||||
- posh
|
||||
primary_extension: .ps1
|
||||
|
||||
Processing:
|
||||
type: programming
|
||||
lexer: Java
|
||||
color: "#2779ab"
|
||||
primary_extension: .pde
|
||||
|
||||
Prolog:
|
||||
type: programming
|
||||
color: "#74283c"
|
||||
@@ -953,6 +1028,7 @@ Python:
|
||||
color: "#3581ba"
|
||||
primary_extension: .py
|
||||
extensions:
|
||||
- .gyp
|
||||
- .pyw
|
||||
- .wsgi
|
||||
- .xpy
|
||||
@@ -986,6 +1062,12 @@ Racket:
|
||||
- .rktd
|
||||
- .rktl
|
||||
|
||||
Ragel in Ruby Host:
|
||||
type: programming
|
||||
lexer: Ragel in Ruby Host
|
||||
color: "#ff9c2e"
|
||||
primary_extension: .rl
|
||||
|
||||
Raw token data:
|
||||
search_term: raw
|
||||
aliases:
|
||||
@@ -1004,6 +1086,13 @@ Rebol:
|
||||
Redcode:
|
||||
primary_extension: .cw
|
||||
|
||||
Rouge:
|
||||
type: programming
|
||||
lexer: Clojure
|
||||
ace_mode: clojure
|
||||
color: "#cc0088"
|
||||
primary_extension: .rg
|
||||
|
||||
Ruby:
|
||||
type: programming
|
||||
ace_mode: ruby
|
||||
@@ -1037,7 +1126,6 @@ Ruby:
|
||||
Rust:
|
||||
type: programming
|
||||
color: "#dea584"
|
||||
lexer: Text only
|
||||
primary_extension: .rs
|
||||
|
||||
SCSS:
|
||||
@@ -1097,6 +1185,8 @@ Shell:
|
||||
- bash
|
||||
- zsh
|
||||
primary_extension: .sh
|
||||
extensions:
|
||||
- .tmux
|
||||
|
||||
Smalltalk:
|
||||
type: programming
|
||||
@@ -1119,6 +1209,15 @@ SuperCollider:
|
||||
lexer: Text only
|
||||
primary_extension: .sc
|
||||
|
||||
TOML:
|
||||
type: data
|
||||
primary_extension: .toml
|
||||
|
||||
TXL:
|
||||
type: programming
|
||||
lexer: Text only
|
||||
primary_extension: .txl
|
||||
|
||||
Tcl:
|
||||
type: programming
|
||||
color: "#e4cc98"
|
||||
@@ -1170,6 +1269,14 @@ Twig:
|
||||
lexer: HTML+Django/Jinja
|
||||
primary_extension: .twig
|
||||
|
||||
TypeScript:
|
||||
type: programming
|
||||
color: "#31859c"
|
||||
lexer: Text only
|
||||
aliases:
|
||||
- ts
|
||||
primary_extension: .ts
|
||||
|
||||
VHDL:
|
||||
type: programming
|
||||
lexer: vhdl
|
||||
@@ -1188,6 +1295,10 @@ Verilog:
|
||||
lexer: verilog
|
||||
color: "#848bf3"
|
||||
primary_extension: .v
|
||||
extensions:
|
||||
- .sv
|
||||
- .svh
|
||||
- .vh
|
||||
|
||||
VimL:
|
||||
type: programming
|
||||
@@ -1217,21 +1328,29 @@ XML:
|
||||
aliases:
|
||||
- rss
|
||||
- xsd
|
||||
- xsl
|
||||
- wsdl
|
||||
primary_extension: .xml
|
||||
extensions:
|
||||
- .ccxml
|
||||
- .dita
|
||||
- .ditamap
|
||||
- .ditaval
|
||||
- .glade
|
||||
- .grxml
|
||||
- .kml
|
||||
- .mxml
|
||||
- .plist
|
||||
- .pt
|
||||
- .rdf
|
||||
- .rss
|
||||
- .scxml
|
||||
- .svg
|
||||
- .ui
|
||||
- .tmCommand
|
||||
- .tmLanguage
|
||||
- .tmPreferences
|
||||
- .tmSnippet
|
||||
- .tml
|
||||
- .vxml
|
||||
- .wsdl
|
||||
- .wxi
|
||||
@@ -1241,12 +1360,19 @@ XML:
|
||||
- .xlf
|
||||
- .xliff
|
||||
- .xsd
|
||||
- .xsl
|
||||
- .xul
|
||||
- .zcml
|
||||
filenames:
|
||||
- .classpath
|
||||
- .project
|
||||
|
||||
XProc:
|
||||
type: programming
|
||||
lexer: XML
|
||||
primary_extension: .xpl
|
||||
extensions:
|
||||
- .xproc
|
||||
|
||||
XQuery:
|
||||
type: programming
|
||||
color: "#2700e2"
|
||||
@@ -1260,9 +1386,16 @@ XS:
|
||||
primary_extension: .xs
|
||||
|
||||
XSLT:
|
||||
type: markup
|
||||
group: XML
|
||||
type: programming
|
||||
aliases:
|
||||
- xsl
|
||||
primary_extension: .xslt
|
||||
extensions:
|
||||
- .xsl
|
||||
|
||||
Xtend:
|
||||
type: programming
|
||||
primary_extension: .xtend
|
||||
|
||||
YAML:
|
||||
type: markup
|
||||
@@ -1279,6 +1412,19 @@ eC:
|
||||
extensions:
|
||||
- .eh
|
||||
|
||||
edn:
|
||||
type: data
|
||||
lexer: Clojure
|
||||
ace_mode: clojure
|
||||
color: "#db5855"
|
||||
primary_extension: .edn
|
||||
|
||||
fish:
|
||||
type: programming
|
||||
group: Shell
|
||||
lexer: Text only
|
||||
primary_extension: .fish
|
||||
|
||||
mupad:
|
||||
lexer: MuPAD
|
||||
primary_extension: .mu
|
||||
|
||||
@@ -4,7 +4,7 @@ module Linguist
|
||||
module MD5
|
||||
# Public: Create deep nested digest of value object.
|
||||
#
|
||||
# Useful for object comparsion.
|
||||
# Useful for object comparison.
|
||||
#
|
||||
# obj - Object to digest.
|
||||
#
|
||||
|
||||
@@ -67,8 +67,8 @@ module Linguist
|
||||
return if @computed_stats
|
||||
|
||||
@enum.each do |blob|
|
||||
# Skip binary file extensions
|
||||
next if blob.binary_mime_type?
|
||||
# Skip files that are likely binary
|
||||
next if blob.likely_binary?
|
||||
|
||||
# Skip vendored or generated blobs
|
||||
next if blob.vendored? || blob.generated? || blob.language.nil?
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,11 +16,15 @@
|
||||
# https://github.com/joyent/node
|
||||
- ^deps/
|
||||
- ^tools/
|
||||
- (^|/)configure$
|
||||
- (^|/)configure.ac$
|
||||
- (^|/)config.guess$
|
||||
- (^|/)config.sub$
|
||||
|
||||
# Node depedencies
|
||||
# Node dependencies
|
||||
- node_modules/
|
||||
|
||||
# Vendored depedencies
|
||||
# Vendored dependencies
|
||||
- vendor/
|
||||
|
||||
# Debian packaging
|
||||
@@ -63,8 +67,16 @@
|
||||
# MathJax
|
||||
- (^|/)MathJax/
|
||||
|
||||
# SyntaxHighlighter - http://alexgorbatchev.com/
|
||||
- (^|/)shBrush([^.]*)\.js$
|
||||
- (^|/)shCore\.js$
|
||||
- (^|/)shLegacy\.js$
|
||||
|
||||
## Python ##
|
||||
|
||||
# django
|
||||
- (^|/)admin_media/
|
||||
|
||||
# Fabric
|
||||
- ^fabfile\.py$
|
||||
|
||||
@@ -96,3 +108,6 @@
|
||||
|
||||
# Samples folders
|
||||
- ^[Ss]amples/
|
||||
|
||||
# Test fixtures
|
||||
- ^[Tt]est/fixtures/
|
||||
|
||||
Reference in New Issue
Block a user