mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Include list of common languages
This commit is contained in:
60
lib/linguist/common.yml
Normal file
60
lib/linguist/common.yml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# The languages which will appear on http://github.com/languages
|
||||||
|
|
||||||
|
- Ada
|
||||||
|
- ActionScript
|
||||||
|
- Arc
|
||||||
|
- Assembly
|
||||||
|
- ASP
|
||||||
|
- Boo
|
||||||
|
- C
|
||||||
|
- "C#"
|
||||||
|
- C++
|
||||||
|
- Clojure
|
||||||
|
- CoffeeScript
|
||||||
|
- ColdFusion
|
||||||
|
- Common Lisp
|
||||||
|
- D
|
||||||
|
- Delphi
|
||||||
|
- Dylan
|
||||||
|
- Eiffel
|
||||||
|
- Emacs Lisp
|
||||||
|
- Erlang
|
||||||
|
- "F#"
|
||||||
|
- Factor
|
||||||
|
- FORTRAN
|
||||||
|
- Go
|
||||||
|
- Groovy
|
||||||
|
- Haskell
|
||||||
|
- HaXe
|
||||||
|
- Io
|
||||||
|
- Java
|
||||||
|
- JavaScript
|
||||||
|
- Lua
|
||||||
|
- Max/MSP
|
||||||
|
- Mirah
|
||||||
|
- Nu
|
||||||
|
- Objective-C
|
||||||
|
- Objective-J
|
||||||
|
- OCaml
|
||||||
|
- ooc
|
||||||
|
- Perl
|
||||||
|
- PHP
|
||||||
|
- Pure Data
|
||||||
|
- Python
|
||||||
|
- R
|
||||||
|
- Racket
|
||||||
|
- Ruby
|
||||||
|
- Scala
|
||||||
|
- Scheme
|
||||||
|
- sclang
|
||||||
|
- Self
|
||||||
|
- Shell
|
||||||
|
- Smalltalk
|
||||||
|
- SuperCollider
|
||||||
|
- Tcl
|
||||||
|
- Vala
|
||||||
|
- Verilog
|
||||||
|
- VHDL
|
||||||
|
- VimL
|
||||||
|
- Visual Basic
|
||||||
|
- XQuery
|
||||||
@@ -57,6 +57,7 @@ module Linguist
|
|||||||
@lexer = Lexer.find_by_alias(@lexer_name)
|
@lexer = Lexer.find_by_alias(@lexer_name)
|
||||||
@extensions = attributes[:extensions] || []
|
@extensions = attributes[:extensions] || []
|
||||||
@popular = attributes[:popular] || false
|
@popular = attributes[:popular] || false
|
||||||
|
@common = attributes[:common] || false
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :name, :lexer_name, :lexer, :extensions
|
attr_reader :name, :lexer_name, :lexer, :extensions
|
||||||
@@ -77,6 +78,10 @@ module Linguist
|
|||||||
!popular?
|
!popular?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def common?
|
||||||
|
@common
|
||||||
|
end
|
||||||
|
|
||||||
def colorize(text)
|
def colorize(text)
|
||||||
lexer.colorize(text)
|
lexer.colorize(text)
|
||||||
end
|
end
|
||||||
@@ -95,6 +100,7 @@ module Linguist
|
|||||||
end
|
end
|
||||||
|
|
||||||
popular = YAML.load_file(File.expand_path("../popular.yml", __FILE__))
|
popular = YAML.load_file(File.expand_path("../popular.yml", __FILE__))
|
||||||
|
common = YAML.load_file(File.expand_path("../common.yml", __FILE__))
|
||||||
|
|
||||||
YAML.load_file(File.expand_path("../extensions.yml", __FILE__)).each do |name, options|
|
YAML.load_file(File.expand_path("../extensions.yml", __FILE__)).each do |name, options|
|
||||||
Language.create(
|
Language.create(
|
||||||
@@ -102,7 +108,8 @@ module Linguist
|
|||||||
:lexer_name => options[:lexer],
|
:lexer_name => options[:lexer],
|
||||||
:default_lexer => options[:default_lexer],
|
:default_lexer => options[:default_lexer],
|
||||||
:extensions => options[:ext],
|
:extensions => options[:ext],
|
||||||
:popular => popular.include?(name)
|
:popular => popular.include?(name),
|
||||||
|
:common => common.include?(name)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -96,6 +96,14 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert Language['Brainfuck'].unpopular?
|
assert Language['Brainfuck'].unpopular?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_common
|
||||||
|
assert Language['Perl'].common?
|
||||||
|
assert Language['Python'].common?
|
||||||
|
assert Language['Ruby'].common?
|
||||||
|
assert !Language['Brainfuck'].common?
|
||||||
|
assert !Language['Makefile'].common?
|
||||||
|
end
|
||||||
|
|
||||||
def test_colorize
|
def test_colorize
|
||||||
assert_equal <<-HTML, Language['Text'].colorize("Hello")
|
assert_equal <<-HTML, Language['Text'].colorize("Hello")
|
||||||
<div class="highlight"><pre>Hello
|
<div class="highlight"><pre>Hello
|
||||||
|
|||||||
Reference in New Issue
Block a user