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|
s.name = 'github-linguist'
s.version = '2.8.12'
s.version = '2.9.1'
s.summary = "GitHub Language detection"
s.authors = "GitHub"

View File

@@ -21,6 +21,13 @@ module Linguist
# Valid Languages types
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
#
# attributes - A hash of attributes

View File

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

View File

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

View File

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

View File

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

@@ -233,7 +233,7 @@ class TestBlob < Test::Unit::TestCase
assert blob("public/javascripts/jquery-1.6.1.js").vendored?
assert blob("public/javascripts/jquery-1.6.1.min.js").vendored?
assert !blob("public/javascripts/jquery.github.menu.js").vendored?
# jQuery UI
assert blob("themes/ui-lightness/jquery-ui.css").vendored?
assert blob("themes/ui-lightness/jquery-ui-1.8.22.custom.css").vendored?
@@ -249,7 +249,7 @@ class TestBlob < Test::Unit::TestCase
assert blob("ui/jquery.ui.accordion.js").vendored?
assert blob("ui/minified/jquery.effects.blind.min.js").vendored?
assert blob("ui/minified/jquery.ui.accordion.min.js").vendored?
# MooTools
assert blob("public/javascripts/mootools-core-1.3.2-full-compat.js").vendored?
@@ -266,10 +266,6 @@ class TestBlob < Test::Unit::TestCase
assert blob("public/javascripts/yahoo-min.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
assert blob("public/javascripts/ckeditor.js").vendored?
assert blob("public/javascripts/tiny_mce.js").vendored?