rouge 1.7.7 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rouge.rb +1 -0
- data/lib/rouge/cli.rb +1 -1
- data/lib/rouge/demos/liquid +11 -0
- data/lib/rouge/lexer.rb +8 -0
- data/lib/rouge/lexers/apache.rb +1 -0
- data/lib/rouge/lexers/apple_script.rb +1 -0
- data/lib/rouge/lexers/c.rb +1 -0
- data/lib/rouge/lexers/clojure.rb +1 -0
- data/lib/rouge/lexers/coffeescript.rb +1 -0
- data/lib/rouge/lexers/common_lisp.rb +1 -0
- data/lib/rouge/lexers/conf.rb +1 -0
- data/lib/rouge/lexers/cpp.rb +1 -0
- data/lib/rouge/lexers/csharp.rb +1 -0
- data/lib/rouge/lexers/css.rb +1 -0
- data/lib/rouge/lexers/dart.rb +1 -0
- data/lib/rouge/lexers/diff.rb +1 -0
- data/lib/rouge/lexers/elixir.rb +1 -0
- data/lib/rouge/lexers/erb.rb +1 -0
- data/lib/rouge/lexers/erlang.rb +1 -0
- data/lib/rouge/lexers/factor.rb +1 -0
- data/lib/rouge/lexers/gherkin.rb +1 -1
- data/lib/rouge/lexers/go.rb +1 -0
- data/lib/rouge/lexers/groovy.rb +1 -0
- data/lib/rouge/lexers/haml.rb +1 -0
- data/lib/rouge/lexers/handlebars.rb +1 -0
- data/lib/rouge/lexers/haskell.rb +1 -0
- data/lib/rouge/lexers/html.rb +1 -0
- data/lib/rouge/lexers/http.rb +1 -0
- data/lib/rouge/lexers/ini.rb +1 -0
- data/lib/rouge/lexers/io.rb +1 -0
- data/lib/rouge/lexers/java.rb +1 -0
- data/lib/rouge/lexers/javascript.rb +1 -0
- data/lib/rouge/lexers/liquid.rb +282 -0
- data/lib/rouge/lexers/literate_coffeescript.rb +1 -0
- data/lib/rouge/lexers/literate_haskell.rb +2 -2
- data/lib/rouge/lexers/llvm.rb +1 -0
- data/lib/rouge/lexers/lua.rb +1 -0
- data/lib/rouge/lexers/make.rb +1 -0
- data/lib/rouge/lexers/markdown.rb +1 -0
- data/lib/rouge/lexers/matlab.rb +1 -0
- data/lib/rouge/lexers/moonscript.rb +1 -0
- data/lib/rouge/lexers/nginx.rb +1 -0
- data/lib/rouge/lexers/nim.rb +5 -4
- data/lib/rouge/lexers/objective_c.rb +1 -1
- data/lib/rouge/lexers/ocaml.rb +1 -1
- data/lib/rouge/lexers/perl.rb +1 -0
- data/lib/rouge/lexers/php.rb +1 -0
- data/lib/rouge/lexers/plain_text.rb +1 -0
- data/lib/rouge/lexers/prolog.rb +1 -0
- data/lib/rouge/lexers/properties.rb +1 -0
- data/lib/rouge/lexers/puppet.rb +1 -0
- data/lib/rouge/lexers/python.rb +1 -0
- data/lib/rouge/lexers/qml.rb +1 -1
- data/lib/rouge/lexers/r.rb +2 -2
- data/lib/rouge/lexers/racket.rb +1 -0
- data/lib/rouge/lexers/ruby.rb +3 -2
- data/lib/rouge/lexers/rust.rb +1 -0
- data/lib/rouge/lexers/sass.rb +1 -0
- data/lib/rouge/lexers/scala.rb +1 -0
- data/lib/rouge/lexers/scheme.rb +1 -0
- data/lib/rouge/lexers/scss.rb +1 -0
- data/lib/rouge/lexers/sed.rb +1 -0
- data/lib/rouge/lexers/shell.rb +1 -0
- data/lib/rouge/lexers/slim.rb +3 -2
- data/lib/rouge/lexers/smalltalk.rb +1 -0
- data/lib/rouge/lexers/sml.rb +1 -1
- data/lib/rouge/lexers/sql.rb +1 -0
- data/lib/rouge/lexers/swift.rb +24 -7
- data/lib/rouge/lexers/tcl.rb +1 -0
- data/lib/rouge/lexers/tex.rb +1 -0
- data/lib/rouge/lexers/toml.rb +1 -0
- data/lib/rouge/lexers/vb.rb +1 -1
- data/lib/rouge/lexers/viml.rb +1 -0
- data/lib/rouge/lexers/xml.rb +1 -0
- data/lib/rouge/lexers/yaml.rb +1 -0
- data/lib/rouge/themes/molokai.rb +82 -0
- data/lib/rouge/themes/monokai.rb +4 -2
- data/lib/rouge/version.rb +1 -1
- metadata +5 -2
@@ -3,6 +3,7 @@
|
|
3
3
|
module Rouge
|
4
4
|
module Lexers
|
5
5
|
class LiterateHaskell < RegexLexer
|
6
|
+
title "Literate Haskell"
|
6
7
|
desc 'Literate haskell'
|
7
8
|
tag 'literate_haskell'
|
8
9
|
aliases 'lithaskell', 'lhaskell', 'lhs'
|
@@ -16,7 +17,6 @@ module Rouge
|
|
16
17
|
start { haskell.reset! }
|
17
18
|
|
18
19
|
# TODO: support TeX versions as well.
|
19
|
-
# TODO: enforce a blank line before and after code
|
20
20
|
state :root do
|
21
21
|
rule /\s*?\n(?=>)/, Text, :code
|
22
22
|
rule /.*?\n/, Text
|
@@ -24,7 +24,7 @@ module Rouge
|
|
24
24
|
end
|
25
25
|
|
26
26
|
state :code do
|
27
|
-
rule /(>)(
|
27
|
+
rule /(>)( .*?(\n|\z))/ do |m|
|
28
28
|
token Name::Label, m[1]
|
29
29
|
delegate haskell, m[2]
|
30
30
|
end
|
data/lib/rouge/lexers/llvm.rb
CHANGED
data/lib/rouge/lexers/lua.rb
CHANGED
data/lib/rouge/lexers/make.rb
CHANGED
data/lib/rouge/lexers/matlab.rb
CHANGED
data/lib/rouge/lexers/nginx.rb
CHANGED
data/lib/rouge/lexers/nim.rb
CHANGED
@@ -4,6 +4,7 @@ module Rouge
|
|
4
4
|
module Lexers
|
5
5
|
class Nim < RegexLexer
|
6
6
|
# This is pretty much a 1-1 port of the pygments NimrodLexer class
|
7
|
+
title "Nim"
|
7
8
|
desc "The Nim programming language (http://nim-lang.org/)"
|
8
9
|
|
9
10
|
tag 'nim'
|
@@ -13,8 +14,8 @@ module Rouge
|
|
13
14
|
KEYWORDS = %w(
|
14
15
|
addr as asm atomic bind block break case cast const continue
|
15
16
|
converter defer discard distinct do elif else end enum except export
|
16
|
-
func finally for from generic if import include interface iterator let
|
17
|
-
macro method mixin nil object of out proc ptr raise ref return static
|
17
|
+
func finally for from generic if import include interface iterator let
|
18
|
+
macro method mixin nil object of out proc ptr raise ref return static
|
18
19
|
template try tuple type using var when while with without yield
|
19
20
|
)
|
20
21
|
|
@@ -29,7 +30,7 @@ module Rouge
|
|
29
30
|
TYPES = %w(
|
30
31
|
int int8 int16 int32 int64 float float32 float64 bool char range array
|
31
32
|
seq set string
|
32
|
-
)
|
33
|
+
)
|
33
34
|
|
34
35
|
NAMESPACE = %w(
|
35
36
|
from import include
|
@@ -133,7 +134,7 @@ module Rouge
|
|
133
134
|
# since we can't pass array of states like w/ Pygments.
|
134
135
|
rule(/[0-9][0-9_]*(?=([eE.]|'?[fF](32|64)))/) do |number|
|
135
136
|
push :floatsuffix
|
136
|
-
push :floatnumber
|
137
|
+
push :floatnumber
|
137
138
|
token Num::Float
|
138
139
|
end
|
139
140
|
rule(/0[xX][a-fA-F0-9][a-fA-F0-9_]*/, Num::Hex, :intsuffix)
|
data/lib/rouge/lexers/ocaml.rb
CHANGED
data/lib/rouge/lexers/perl.rb
CHANGED
data/lib/rouge/lexers/php.rb
CHANGED
data/lib/rouge/lexers/prolog.rb
CHANGED
data/lib/rouge/lexers/puppet.rb
CHANGED
data/lib/rouge/lexers/python.rb
CHANGED
data/lib/rouge/lexers/qml.rb
CHANGED
data/lib/rouge/lexers/r.rb
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
module Rouge
|
4
4
|
module Lexers
|
5
5
|
class R < RegexLexer
|
6
|
+
title "R"
|
6
7
|
desc 'The R statistics language (r-project.org)'
|
7
8
|
tag 'r'
|
8
9
|
aliases 'r', 'R', 's', 'S'
|
9
|
-
filenames '*.R', '
|
10
|
+
filenames '*.R', '.Rhistory', '.Rprofile'
|
10
11
|
mimetypes 'text/x-r-source', 'text/x-r', 'text/x-R'
|
11
12
|
|
12
13
|
mimetypes 'text/x-r', 'application/x-r'
|
@@ -19,7 +20,6 @@ module Rouge
|
|
19
20
|
|
20
21
|
def self.analyze_text(text)
|
21
22
|
return 1 if text.shebang? 'Rscript'
|
22
|
-
return 0.1 if text.include? '->'
|
23
23
|
end
|
24
24
|
|
25
25
|
state :root do
|
data/lib/rouge/lexers/racket.rb
CHANGED
data/lib/rouge/lexers/ruby.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module Rouge
|
4
4
|
module Lexers
|
5
5
|
class Ruby < RegexLexer
|
6
|
+
title "Ruby"
|
6
7
|
desc "The Ruby programming language (ruby-lang.org)"
|
7
8
|
tag 'ruby'
|
8
9
|
aliases 'rb'
|
@@ -108,8 +109,8 @@ module Rouge
|
|
108
109
|
|
109
110
|
keywords_pseudo = %w(
|
110
111
|
initialize new loop include extend raise attr_reader attr_writer
|
111
|
-
attr_accessor attr catch throw private module_function
|
112
|
-
protected true false nil __FILE__ __LINE__
|
112
|
+
attr_accessor alias_method attr catch throw private module_function
|
113
|
+
public protected true false nil __FILE__ __LINE__
|
113
114
|
)
|
114
115
|
|
115
116
|
builtins_g = %w(
|
data/lib/rouge/lexers/rust.rb
CHANGED
data/lib/rouge/lexers/sass.rb
CHANGED
data/lib/rouge/lexers/scala.rb
CHANGED
data/lib/rouge/lexers/scheme.rb
CHANGED
data/lib/rouge/lexers/scss.rb
CHANGED
data/lib/rouge/lexers/sed.rb
CHANGED
data/lib/rouge/lexers/shell.rb
CHANGED
data/lib/rouge/lexers/slim.rb
CHANGED
@@ -7,6 +7,7 @@ module Rouge
|
|
7
7
|
class Slim < RegexLexer
|
8
8
|
include Indentation
|
9
9
|
|
10
|
+
title "Slim"
|
10
11
|
desc 'The Slim template language'
|
11
12
|
|
12
13
|
tag 'slim'
|
@@ -151,8 +152,8 @@ module Rouge
|
|
151
152
|
end
|
152
153
|
|
153
154
|
state :css do
|
154
|
-
rule(
|
155
|
-
rule(
|
155
|
+
rule(/\.[\w-]*/) { token Name::Class; goto :tag }
|
156
|
+
rule(/#[a-zA-Z][\w:-]*/) { token Name::Function; goto :tag }
|
156
157
|
end
|
157
158
|
|
158
159
|
state :html_attr do
|
data/lib/rouge/lexers/sml.rb
CHANGED
data/lib/rouge/lexers/sql.rb
CHANGED
data/lib/rouge/lexers/swift.rb
CHANGED
@@ -6,12 +6,13 @@ module Rouge
|
|
6
6
|
tag 'swift'
|
7
7
|
filenames '*.swift'
|
8
8
|
|
9
|
+
title "Swift"
|
9
10
|
desc 'Multi paradigm, compiled programming language developed by Apple for iOS and OS X development. (developer.apple.com/swift)'
|
10
11
|
|
11
12
|
id_head = /_|(?!\p{Mc})\p{Alpha}|[^\u0000-\uFFFF]/
|
12
13
|
id_rest = /[\p{Alnum}_]|[^\u0000-\uFFFF]/
|
13
14
|
id = /#{id_head}#{id_rest}*/
|
14
|
-
|
15
|
+
|
15
16
|
keywords = Set.new %w(
|
16
17
|
break case continue default do else fallthrough if in for return switch where while
|
17
18
|
|
@@ -25,19 +26,35 @@ module Rouge
|
|
25
26
|
)
|
26
27
|
|
27
28
|
attributes = Set.new %w(
|
28
|
-
autoclosure IBAction IBDesignable IBInspectable IBOutlet noreturn NSCopying NSManaged objc UIApplicationMain NSApplicationMain
|
29
|
+
autoclosure IBAction IBDesignable IBInspectable IBOutlet noreturn NSCopying NSManaged objc UIApplicationMain NSApplicationMain objc_block
|
29
30
|
)
|
30
31
|
|
31
32
|
constants = Set.new %w(
|
32
33
|
true false nil
|
33
34
|
)
|
34
35
|
|
35
|
-
|
36
|
+
start { push :bol }
|
37
|
+
|
38
|
+
# beginning of line
|
39
|
+
state :bol do
|
40
|
+
rule /#.*/, Comment::Preproc
|
41
|
+
|
42
|
+
mixin :inline_whitespace
|
43
|
+
|
44
|
+
rule(//) { pop! }
|
45
|
+
end
|
46
|
+
|
47
|
+
state :inline_whitespace do
|
36
48
|
rule /\s+/m, Text
|
37
|
-
rule %r(\/\/.*?\n), Comment::Single
|
38
49
|
rule %r((?<re>\/\*(?:(?>[^\/\*\*\/]+)|\g<re>)*\*\/))m, Comment::Multiline
|
39
50
|
end
|
40
51
|
|
52
|
+
state :whitespace do
|
53
|
+
rule /\n+/m, Text, :bol
|
54
|
+
rule %r(\/\/.*?$), Comment::Single, :bol
|
55
|
+
mixin :inline_whitespace
|
56
|
+
end
|
57
|
+
|
41
58
|
state :root do
|
42
59
|
mixin :whitespace
|
43
60
|
rule /\$(([1-9]\d*)?\d)/, Name::Variable
|
@@ -52,7 +69,7 @@ module Rouge
|
|
52
69
|
rule /0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/, Num::Hex
|
53
70
|
rule /0b[01]+(?:_[01]+)*/, Num::Bin
|
54
71
|
rule %r{[\d]+(?:_\d+)*}, Num::Integer
|
55
|
-
|
72
|
+
|
56
73
|
rule /@availability[(][^)]+[)]/, Keyword::Declaration
|
57
74
|
|
58
75
|
rule /(@objc[(])([^)]+)([)])/ do
|
@@ -82,11 +99,11 @@ module Rouge
|
|
82
99
|
groups Keyword::Declaration, Error, Keyword::Declaration
|
83
100
|
end
|
84
101
|
end
|
85
|
-
|
102
|
+
|
86
103
|
rule /(let|var)\b(\s*)(#{id})/ do
|
87
104
|
groups Keyword, Text, Name::Variable
|
88
105
|
end
|
89
|
-
|
106
|
+
|
90
107
|
rule /(?!\b(if|while|for|private|internal|unowned|switch|case)\b)\b#{id}(?=(\?|!)?\s*[(])/ do |m|
|
91
108
|
if m[0] =~ /^[[:upper:]]/
|
92
109
|
token Keyword::Type
|