Merge pull request #598 from github/let-css-soar

css detection
This commit is contained in:
Ted Nyman
2013-07-30 16:23:06 -07:00
8 changed files with 128 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = 'github-linguist' s.name = 'github-linguist'
s.version = '2.8.12' s.version = '2.9.1'
s.summary = "GitHub Language detection" s.summary = "GitHub Language detection"
s.authors = "GitHub" s.authors = "GitHub"

View File

@@ -21,6 +21,13 @@ module Linguist
# Valid Languages types # Valid Languages types
TYPES = [:data, :markup, :programming] TYPES = [:data, :markup, :programming]
# Names of non-programming languages that we will still detect
#
# Returns an array
def self.detectable_markup
["CSS", "Less", "Sass"]
end
# Internal: Create a new Language object # Internal: Create a new Language object
# #
# attributes - A hash of attributes # attributes - A hash of attributes

View File

@@ -214,6 +214,7 @@ CMake:
CSS: CSS:
ace_mode: css ace_mode: css
color: "#1f085e"
primary_extension: .css primary_extension: .css
Ceylon: Ceylon:

View File

@@ -73,8 +73,8 @@ module Linguist
# Skip vendored or generated blobs # Skip vendored or generated blobs
next if blob.vendored? || blob.generated? || blob.language.nil? next if blob.vendored? || blob.generated? || blob.language.nil?
# Only include programming languages # Only include programming languages and acceptable markup languages
if blob.language.type == :programming if blob.language.type == :programming || Language.detectable_markup.include?(blob.language.name)
@sizes[blob.language.group] += blob.size @sizes[blob.language.group] += blob.size
end end
end end

View File

@@ -252,7 +252,8 @@
".rs" ".rs"
], ],
"Sass": [ "Sass": [
".sass" ".sass",
".scss"
], ],
"Scala": [ "Scala": [
".sbt", ".sbt",
@@ -366,6 +367,7 @@
".zprofile", ".zprofile",
".zshenv", ".zshenv",
".zshrc", ".zshrc",
"Dockerfile",
"PKGBUILD", "PKGBUILD",
"bash_logout", "bash_logout",
"bash_profile", "bash_profile",
@@ -387,8 +389,8 @@
".gemrc" ".gemrc"
] ]
}, },
"tokens_total": 363334, "tokens_total": 363564,
"languages_total": 432, "languages_total": 434,
"tokens": { "tokens": {
"ABAP": { "ABAP": {
"*/**": 1, "*/**": 1,
@@ -35403,22 +35405,27 @@
"port2.recv": 1 "port2.recv": 1
}, },
"Sass": { "Sass": {
"blue": 4, "blue": 7,
"#3bbfce": 1, "#3bbfce": 2,
"margin": 4, ";": 6,
"px": 1, "margin": 8,
"px": 3,
".content_navigation": 1,
"{": 2,
"color": 4,
"}": 2,
".border": 2,
"padding": 2,
"/": 4,
"border": 3,
"solid": 1,
".content": 1, ".content": 1,
"-": 3, "-": 3,
"navigation": 1, "navigation": 1,
"border": 2,
"color": 3,
"darken": 1, "darken": 1,
"(": 1, "(": 1,
"%": 1, "%": 1,
")": 1, ")": 1
".border": 1,
"padding": 1,
"/": 2
}, },
"Scala": { "Scala": {
"SHEBANG#!sh": 2, "SHEBANG#!sh": 2,
@@ -35824,24 +35831,24 @@
"Shell": { "Shell": {
"SHEBANG#!bash": 8, "SHEBANG#!bash": 8,
"typeset": 5, "typeset": 5,
"-": 364, "-": 391,
"i": 1, "i": 2,
"n": 22, "n": 22,
"bottles": 6, "bottles": 6,
"no": 16, "no": 16,
"while": 3, "while": 3,
"[": 84, "[": 85,
"]": 84, "]": 85,
"do": 8, "do": 8,
"echo": 69, "echo": 71,
"case": 9, "case": 9,
"{": 63, "{": 63,
"}": 61, "}": 61,
"in": 25, "in": 25,
")": 154, ")": 154,
"%": 5, "%": 5,
"s": 13, "s": 14,
";": 135, ";": 138,
"esac": 7, "esac": 7,
"done": 8, "done": 8,
"exit": 10, "exit": 10,
@@ -35853,12 +35860,12 @@
"export": 25, "export": 25,
"SCREENDIR": 2, "SCREENDIR": 2,
"fi": 34, "fi": 34,
"PATH": 12, "PATH": 14,
"/usr/local/bin": 4, "/usr/local/bin": 6,
"/usr/local/sbin": 4, "/usr/local/sbin": 6,
"/usr/xpg4/bin": 4, "/usr/xpg4/bin": 4,
"/usr/sbin": 4, "/usr/sbin": 6,
"/usr/bin": 6, "/usr/bin": 8,
"/usr/sfw/bin": 4, "/usr/sfw/bin": 4,
"/usr/ccs/bin": 4, "/usr/ccs/bin": 4,
"/usr/openwin/bin": 4, "/usr/openwin/bin": 4,
@@ -35880,8 +35887,8 @@
"actually": 2, "actually": 2,
"DISPLAY": 2, "DISPLAY": 2,
"r": 17, "r": 17,
"&&": 56, "&&": 65,
".": 4, ".": 5,
"function": 6, "function": 6,
"ls": 6, "ls": 6,
"command": 5, "command": 5,
@@ -35891,7 +35898,7 @@
"long": 2, "long": 2,
"format...": 2, "format...": 2,
"ll": 2, "ll": 2,
"|": 16, "|": 17,
"less": 2, "less": 2,
"XF": 2, "XF": 2,
"pipe": 2, "pipe": 2,
@@ -35905,7 +35912,7 @@
"extglob": 2, "extglob": 2,
"progcomp": 2, "progcomp": 2,
"complete": 82, "complete": 82,
"f": 65, "f": 68,
"X": 54, "X": 54,
"bunzip2": 2, "bunzip2": 2,
"bzcat": 2, "bzcat": 2,
@@ -35981,7 +35988,7 @@
"opera": 2, "opera": 2,
"w3m": 2, "w3m": 2,
"galeon": 2, "galeon": 2,
"curl": 6, "curl": 8,
"dillo": 2, "dillo": 2,
"elinks": 2, "elinks": 2,
"links": 2, "links": 2,
@@ -36006,7 +36013,7 @@
"disown": 2, "disown": 2,
"other": 2, "other": 2,
"job": 3, "job": 3,
"v": 9, "v": 11,
"readonly": 4, "readonly": 4,
"unset": 10, "unset": 10,
"and": 5, "and": 5,
@@ -36017,7 +36024,7 @@
"helptopic": 2, "helptopic": 2,
"help": 5, "help": 5,
"helptopics": 2, "helptopics": 2,
"a": 11, "a": 12,
"unalias": 4, "unalias": 4,
"aliases": 2, "aliases": 2,
"binding": 2, "binding": 2,
@@ -36037,7 +36044,7 @@
"on": 4, "on": 4,
"d": 9, "d": 9,
"pushd": 2, "pushd": 2,
"cd": 6, "cd": 11,
"rmdir": 2, "rmdir": 2,
"Make": 2, "Make": 2,
"directory": 5, "directory": 5,
@@ -36056,7 +36063,7 @@
"as": 2, "as": 2,
"bash...": 2, "bash...": 2,
"quit": 2, "quit": 2,
"q": 6, "q": 8,
"even": 3, "even": 3,
"shorter": 2, "shorter": 2,
"D": 2, "D": 2,
@@ -36083,7 +36090,7 @@
"path": 13, "path": 13,
"/opt/local/bin": 2, "/opt/local/bin": 2,
"/opt/local/sbin": 2, "/opt/local/sbin": 2,
"/bin": 2, "/bin": 4,
"prompt": 2, "prompt": 2,
"history": 18, "history": 18,
"endif": 2, "endif": 2,
@@ -36144,9 +36151,64 @@
"fpath": 6, "fpath": 6,
"HOME/.zsh/func": 2, "HOME/.zsh/func": 2,
"U": 2, "U": 2,
"docker": 1,
"version": 12,
"from": 1,
"ubuntu": 1,
"maintainer": 1,
"Solomon": 1,
"Hykes": 1,
"<solomon@dotcloud.com>": 1,
"run": 13,
"apt": 6,
"get": 6,
"install": 8,
"y": 5,
"git": 16,
"https": 2,
"//go.googlecode.com/files/go1.1.1.linux": 1,
"amd64.tar.gz": 1,
"tar": 1,
"C": 1,
"/usr/local": 1,
"xz": 1,
"env": 4,
"/usr/local/go/bin": 2,
"/sbin": 2,
"GOPATH": 1,
"/go": 1,
"CGO_ENABLED": 1,
"/tmp": 1,
"t.go": 1,
"go": 2,
"test": 1,
"PKG": 12,
"github.com/kr/pty": 1,
"REV": 6,
"c699": 1,
"clone": 5,
"http": 3,
"//": 3,
"/go/src/": 6,
"checkout": 3,
"github.com/gorilla/context/": 1,
"d61e5": 1,
"github.com/gorilla/mux/": 1,
"b36453141c": 1,
"iptables": 1,
"/etc/apt/sources.list": 1,
"update": 2,
"lxc": 1,
"aufs": 1,
"tools": 1,
"add": 1,
"/go/src/github.com/dotcloud/docker": 1,
"/go/src/github.com/dotcloud/docker/docker": 1,
"ldflags": 1,
"/go/bin": 1,
"cmd": 1,
"pkgname": 1, "pkgname": 1,
"stud": 4, "stud": 4,
"git": 9,
"pkgver": 1, "pkgver": 1,
"pkgrel": 1, "pkgrel": 1,
"pkgdesc": 1, "pkgdesc": 1,
@@ -36162,7 +36224,6 @@
"provides": 1, "provides": 1,
"conflicts": 1, "conflicts": 1,
"_gitroot": 1, "_gitroot": 1,
"https": 1,
"//github.com/bumptech/stud.git": 1, "//github.com/bumptech/stud.git": 1,
"_gitname": 1, "_gitname": 1,
"build": 2, "build": 2,
@@ -36170,14 +36231,12 @@
"pull": 3, "pull": 3,
"origin": 1, "origin": 1,
"else": 10, "else": 10,
"clone": 2,
"rm": 2, "rm": 2,
"rf": 1, "rf": 1,
"package": 1, "package": 1,
"PREFIX": 1, "PREFIX": 1,
"/usr": 1, "/usr": 1,
"DESTDIR": 1, "DESTDIR": 1,
"install": 2,
"Dm755": 1, "Dm755": 1,
"init.stud": 1, "init.stud": 1,
"mkdir": 2, "mkdir": 2,
@@ -36246,7 +36305,6 @@
"rbenv": 2, "rbenv": 2,
"versions": 1, "versions": 1,
"bare": 1, "bare": 1,
"version": 11,
"&": 5, "&": 5,
"prefix": 1, "prefix": 1,
"/dev/null": 6, "/dev/null": 6,
@@ -36428,7 +36486,6 @@
"build.properties": 1, "build.properties": 1,
"an": 1, "an": 1,
"property": 1, "property": 1,
"update": 1,
"disk.": 1, "disk.": 1,
"That": 1, "That": 1,
"scalacOptions": 3, "scalacOptions": 3,
@@ -39426,12 +39483,12 @@
"Rebol": 11, "Rebol": 11,
"Ruby": 3854, "Ruby": 3854,
"Rust": 3566, "Rust": 3566,
"Sass": 28, "Sass": 56,
"Scala": 420, "Scala": 420,
"Scheme": 3478, "Scheme": 3478,
"Scilab": 69, "Scilab": 69,
"SCSS": 39, "SCSS": 39,
"Shell": 3542, "Shell": 3744,
"Slash": 187, "Slash": 187,
"Standard ML": 243, "Standard ML": 243,
"SuperCollider": 268, "SuperCollider": 268,
@@ -39528,12 +39585,12 @@
"Rebol": 1, "Rebol": 1,
"Ruby": 16, "Ruby": 16,
"Rust": 1, "Rust": 1,
"Sass": 1, "Sass": 2,
"Scala": 3, "Scala": 3,
"Scheme": 1, "Scheme": 1,
"Scilab": 3, "Scilab": 3,
"SCSS": 1, "SCSS": 1,
"Shell": 36, "Shell": 37,
"Slash": 1, "Slash": 1,
"Standard ML": 2, "Standard ML": 2,
"SuperCollider": 2, "SuperCollider": 2,
@@ -39555,5 +39612,5 @@
"Xtend": 2, "Xtend": 2,
"YAML": 1 "YAML": 1
}, },
"md5": "23dbdcbc5407d2cd14bbb5926d29774c" "md5": "094112556d8fb14809a3fcbc1a481c7c"
} }

View File

@@ -62,10 +62,6 @@
- (^|/)yahoo-([^.]*)\.js$ - (^|/)yahoo-([^.]*)\.js$
- (^|/)yui([^.]*)\.js$ - (^|/)yui([^.]*)\.js$
# LESS css
- (^|/)less([^.]*)(\.min)?\.js$
- (^|/)less\-\d+\.\d+\.\d+(\.min)?\.js$
# WYS editors # WYS editors
- (^|/)ckeditor\.js$ - (^|/)ckeditor\.js$
- (^|/)tiny_mce([^.]*)\.js$ - (^|/)tiny_mce([^.]*)\.js$

12
samples/Sass/demo.scss Normal file
View File

@@ -0,0 +1,12 @@
$blue: #3bbfce;
$margin: 16px;
.content_navigation {
color: $blue;
}
.border {
padding: $margin / 2;
margin: $margin / 2;
border: 2px $blue solid;
}

View File

@@ -266,10 +266,6 @@ class TestBlob < Test::Unit::TestCase
assert blob("public/javascripts/yahoo-min.js").vendored? assert blob("public/javascripts/yahoo-min.js").vendored?
assert blob("public/javascripts/yuiloader-dom-event.js").vendored? assert blob("public/javascripts/yuiloader-dom-event.js").vendored?
# LESS
assert blob("public/javascripts/less-1.1.0.js").vendored?
assert blob("public/javascripts/less-1.1.0.min.js").vendored?
# WYS editors # WYS editors
assert blob("public/javascripts/ckeditor.js").vendored? assert blob("public/javascripts/ckeditor.js").vendored?
assert blob("public/javascripts/tiny_mce.js").vendored? assert blob("public/javascripts/tiny_mce.js").vendored?