mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 12:28:47 +00:00
Merge branch 'master' into 1206
Conflicts: lib/linguist/samples.json
This commit is contained in:
@@ -241,7 +241,25 @@ module Linguist
|
||||
def lines
|
||||
@lines ||=
|
||||
if viewable? && data
|
||||
data.split(/\r\n|\r|\n/, -1)
|
||||
# `data` is usually encoded as ASCII-8BIT even when the content has
|
||||
# been detected as a different encoding. However, we are not allowed
|
||||
# to change the encoding of `data` because we've made the implicit
|
||||
# guarantee that each entry in `lines` is encoded the same way as
|
||||
# `data`.
|
||||
#
|
||||
# Instead, we re-encode each possible newline sequence as the
|
||||
# detected encoding, then force them back to the encoding of `data`
|
||||
# (usually a binary encoding like ASCII-8BIT). This means that the
|
||||
# byte sequence will match how newlines are likely encoded in the
|
||||
# file, but we don't have to change the encoding of `data` as far as
|
||||
# Ruby is concerned. This allows us to correctly parse out each line
|
||||
# without changing the encoding of `data`, and
|
||||
# also--importantly--without having to duplicate many (potentially
|
||||
# large) strings.
|
||||
encoded_newlines = ["\r\n", "\r", "\n"].
|
||||
map { |nl| nl.encode(encoding).force_encoding(data.encoding) }
|
||||
|
||||
data.split(Regexp.union(encoded_newlines), -1)
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
@@ -293,6 +293,7 @@ C++:
|
||||
- .inl
|
||||
- .tcc
|
||||
- .tpp
|
||||
- .ipp
|
||||
|
||||
C-ObjDump:
|
||||
type: data
|
||||
@@ -819,6 +820,9 @@ Groovy:
|
||||
color: "#e69f56"
|
||||
extensions:
|
||||
- .groovy
|
||||
- .grt
|
||||
- .gtpl
|
||||
- .gvy
|
||||
interpreters:
|
||||
- groovy
|
||||
|
||||
@@ -907,7 +911,7 @@ Haskell:
|
||||
Haxe:
|
||||
type: programming
|
||||
ace_mode: haxe
|
||||
color: "#346d51"
|
||||
color: "#f7941e"
|
||||
extensions:
|
||||
- .hx
|
||||
- .hxsl
|
||||
@@ -1059,6 +1063,7 @@ JavaScript:
|
||||
- ._js
|
||||
- .bones
|
||||
- .es6
|
||||
- .frag
|
||||
- .jake
|
||||
- .jsfl
|
||||
- .jsm
|
||||
@@ -1250,6 +1255,7 @@ Markdown:
|
||||
- .md
|
||||
- .markdown
|
||||
- .mkd
|
||||
- .mkdn
|
||||
- .mkdown
|
||||
- .ron
|
||||
|
||||
@@ -1471,6 +1477,14 @@ Org:
|
||||
extensions:
|
||||
- .org
|
||||
|
||||
Ox:
|
||||
type: programming
|
||||
lexer: Text only
|
||||
extensions:
|
||||
- .ox
|
||||
- .oxh
|
||||
- .oxo
|
||||
|
||||
Oxygene:
|
||||
type: programming
|
||||
lexer: Text only
|
||||
@@ -1705,6 +1719,8 @@ R:
|
||||
extensions:
|
||||
- .r
|
||||
- .R
|
||||
- .Rd
|
||||
- .rd
|
||||
- .rsx
|
||||
filenames:
|
||||
- .Rprofile
|
||||
@@ -1786,7 +1802,7 @@ Red:
|
||||
extensions:
|
||||
- .red
|
||||
- .reds
|
||||
|
||||
|
||||
Redcode:
|
||||
extensions:
|
||||
- .cw
|
||||
@@ -1849,6 +1865,13 @@ Rust:
|
||||
extensions:
|
||||
- .rs
|
||||
|
||||
SAS:
|
||||
type: programming
|
||||
color: "#1E90FF"
|
||||
lexer: Text only
|
||||
extensions:
|
||||
- .sas
|
||||
|
||||
SCSS:
|
||||
type: markup
|
||||
group: CSS
|
||||
@@ -1857,7 +1880,7 @@ SCSS:
|
||||
- .scss
|
||||
|
||||
SQL:
|
||||
type: programming
|
||||
type: data
|
||||
ace_mode: sql
|
||||
extensions:
|
||||
- .sql
|
||||
@@ -2207,6 +2230,7 @@ XML:
|
||||
- .clixml
|
||||
- .cproject
|
||||
- .csproj
|
||||
- .ct
|
||||
- .dita
|
||||
- .ditamap
|
||||
- .ditaval
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -148,7 +148,7 @@
|
||||
- (^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$
|
||||
|
||||
# NuGet
|
||||
- ^[Pp]ackages/
|
||||
- ^[Pp]ackages\/.+\.\d+\/
|
||||
|
||||
# ExtJS
|
||||
- (^|/)extjs/.*?\.js$
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "2.10.15"
|
||||
VERSION = "2.11.1"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user