From fc9bc8b9e1fddf1c02340e407b354337d56d925f Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Mon, 9 Dec 2013 22:42:57 -0500 Subject: [PATCH 1/4] Add stylus support --- lib/linguist/language.rb | 2 +- lib/linguist/languages.yml | 5 +++++ lib/linguist/samples.json | 3 +++ samples/Ruby/sinatra.rb | 5 +++++ samples/Stylus/demo.styl | 14 ++++++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 samples/Stylus/demo.styl diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index 04562dc2..cb0ea174 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -32,7 +32,7 @@ module Linguist # # Returns an array def self.detectable_markup - ["CSS", "Less", "Sass", "TeX"] + ["CSS", "Less", "Sass", "Stylus", "TeX"] end # Detect languages by a specific type diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 4838d2e2..7ecea3f1 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1519,6 +1519,11 @@ Standard ML: - sml primary_extension: .sml +Stylus: + type: markup + group: CSS + primary_extension: .styl + SuperCollider: type: programming color: "#46390b" diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 83f5d00d..18c9c268 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -363,6 +363,9 @@ ".sig", ".sml" ], + "Stylus": [ + ".styl" + ], "SuperCollider": [ ".sc", ".scd" diff --git a/samples/Ruby/sinatra.rb b/samples/Ruby/sinatra.rb index 36ec2a2f..2909883c 100644 --- a/samples/Ruby/sinatra.rb +++ b/samples/Ruby/sinatra.rb @@ -598,6 +598,11 @@ module Sinatra render :less, template, options, locals end + def stylus(template, options={}, locals={}) + options.merge! :layout => false, :default_content_type => :css + render :stylus, template, options, locals + end + def builder(template=nil, options={}, locals={}, &block) options[:default_content_type] = :xml render_ruby(:builder, template, options, locals, &block) diff --git a/samples/Stylus/demo.styl b/samples/Stylus/demo.styl new file mode 100644 index 00000000..eb34f824 --- /dev/null +++ b/samples/Stylus/demo.styl @@ -0,0 +1,14 @@ +border-radius() + -webkit-border-radius arguments + -moz-border-radius arguments + border-radius arguments + +a.button + border-radius 5px + +fonts = helvetica, arial, sans-serif + +body { + padding: 50px; + font: 14px/1.4 fonts; +} \ No newline at end of file From 9a4262857746e757fa92c75e5f989db91da354e7 Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Mon, 9 Dec 2013 22:56:04 -0500 Subject: [PATCH 2/4] add more demos --- samples/Stylus/demo.styl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/samples/Stylus/demo.styl b/samples/Stylus/demo.styl index eb34f824..761d5be3 100644 --- a/samples/Stylus/demo.styl +++ b/samples/Stylus/demo.styl @@ -11,4 +11,21 @@ fonts = helvetica, arial, sans-serif body { padding: 50px; font: 14px/1.4 fonts; -} \ No newline at end of file +} + +form + input[type=text] + padding: 5px + border: 1px solid #eee + color: #ddd + +textarea + @extends form input[type=text] + padding: 10px + +$foo + color: #FFF + +.bar + background: #000 + @extends $foo From 64f77293e835f9ab8dea6a922ded232b68246cc4 Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Tue, 10 Dec 2013 09:40:06 -0500 Subject: [PATCH 3/4] set stylus lexer to be text only for now --- lib/linguist/languages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 7ecea3f1..47b364fc 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1522,6 +1522,7 @@ Standard ML: Stylus: type: markup group: CSS + lexer: Text only primary_extension: .styl SuperCollider: From 5b35f92bfe51c1738b75b301d2531c386eca6fb7 Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Wed, 11 Dec 2013 18:01:40 -0500 Subject: [PATCH 4/4] remove accidental sinatra sample. copypasta.... --- samples/Ruby/sinatra.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/samples/Ruby/sinatra.rb b/samples/Ruby/sinatra.rb index 2909883c..36ec2a2f 100644 --- a/samples/Ruby/sinatra.rb +++ b/samples/Ruby/sinatra.rb @@ -598,11 +598,6 @@ module Sinatra render :less, template, options, locals end - def stylus(template, options={}, locals={}) - options.merge! :layout => false, :default_content_type => :css - render :stylus, template, options, locals - end - def builder(template=nil, options={}, locals={}, &block) options[:default_content_type] = :xml render_ruby(:builder, template, options, locals, &block)