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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb12f42e4a61412bfcb144f6c7a3f0bdee592a0d
|
4
|
+
data.tar.gz: 64ed9c6cd72560e3d34ec0f5476b2643eadf1076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9387f40bda37a8b68bbbb21539749bd228fb642f32a1095bed0ec764ee9ec59bb84eb7c5131f66f4240cee32406c5b62986ae98f3ef114be6dd50e04ae5bea32
|
7
|
+
data.tar.gz: 733371e70bd2af9a4ec2d989ba69c96a1117525e15375ff2d0175628759c8e64c67f5519dbb0870dc3dc1015821396b2310200f71acd7d3ea4f794f22140f105
|
data/lib/rouge.rb
CHANGED
@@ -53,4 +53,5 @@ load load_dir.join('rouge/themes/colorful.rb')
|
|
53
53
|
load load_dir.join('rouge/themes/base16.rb')
|
54
54
|
load load_dir.join('rouge/themes/github.rb')
|
55
55
|
load load_dir.join('rouge/themes/monokai.rb')
|
56
|
+
load load_dir.join('rouge/themes/molokai.rb')
|
56
57
|
load load_dir.join('rouge/themes/monokai_sublime.rb')
|
data/lib/rouge/cli.rb
CHANGED
data/lib/rouge/lexer.rb
CHANGED
@@ -65,6 +65,14 @@ module Rouge
|
|
65
65
|
lexer_class && lexer_class.new(opts)
|
66
66
|
end
|
67
67
|
|
68
|
+
# Specify or get this lexer's title. Meant to be human-readable.
|
69
|
+
def title(t=nil)
|
70
|
+
if t.nil?
|
71
|
+
t = tag.capitalize
|
72
|
+
end
|
73
|
+
@title ||= t
|
74
|
+
end
|
75
|
+
|
68
76
|
# Specify or get this lexer's description.
|
69
77
|
def desc(arg=:absent)
|
70
78
|
if arg == :absent
|
data/lib/rouge/lexers/apache.rb
CHANGED
data/lib/rouge/lexers/c.rb
CHANGED
data/lib/rouge/lexers/clojure.rb
CHANGED
data/lib/rouge/lexers/conf.rb
CHANGED
data/lib/rouge/lexers/cpp.rb
CHANGED
data/lib/rouge/lexers/csharp.rb
CHANGED
data/lib/rouge/lexers/css.rb
CHANGED
data/lib/rouge/lexers/dart.rb
CHANGED
data/lib/rouge/lexers/diff.rb
CHANGED
data/lib/rouge/lexers/elixir.rb
CHANGED
@@ -5,6 +5,7 @@ module Rouge
|
|
5
5
|
# Direct port of pygments Lexer.
|
6
6
|
# See: https://bitbucket.org/birkenfeld/pygments-main/src/7304e4759ae65343d89a51359ca538912519cc31/pygments/lexers/functional.py?at=default#cl-2362
|
7
7
|
class Elixir < RegexLexer
|
8
|
+
title "Elixir"
|
8
9
|
desc "Elixir language (elixir-lang.org)"
|
9
10
|
|
10
11
|
tag 'elixir'
|
data/lib/rouge/lexers/erb.rb
CHANGED
data/lib/rouge/lexers/erlang.rb
CHANGED
data/lib/rouge/lexers/factor.rb
CHANGED
data/lib/rouge/lexers/gherkin.rb
CHANGED
data/lib/rouge/lexers/go.rb
CHANGED
data/lib/rouge/lexers/groovy.rb
CHANGED
data/lib/rouge/lexers/haml.rb
CHANGED
data/lib/rouge/lexers/haskell.rb
CHANGED
data/lib/rouge/lexers/html.rb
CHANGED
data/lib/rouge/lexers/http.rb
CHANGED
data/lib/rouge/lexers/ini.rb
CHANGED
data/lib/rouge/lexers/io.rb
CHANGED
data/lib/rouge/lexers/java.rb
CHANGED
@@ -0,0 +1,282 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
class Liquid < RegexLexer
|
6
|
+
title "Liquid"
|
7
|
+
desc 'Liquid is a templating engine for Ruby (liquidmarkup.org)'
|
8
|
+
tag 'liquid'
|
9
|
+
filenames '*.liquid'
|
10
|
+
|
11
|
+
state :root do
|
12
|
+
rule /[^\{]+/, Text
|
13
|
+
|
14
|
+
rule /(\{%)(\s*)/ do
|
15
|
+
groups Punctuation, Text::Whitespace
|
16
|
+
push :tag_or_block
|
17
|
+
end
|
18
|
+
|
19
|
+
rule /(\{\{)(\s*)/ do
|
20
|
+
groups Punctuation, Text::Whitespace
|
21
|
+
push :output
|
22
|
+
end
|
23
|
+
|
24
|
+
rule /\{/, Text
|
25
|
+
end
|
26
|
+
|
27
|
+
state :tag_or_block do
|
28
|
+
# builtin logic blocks
|
29
|
+
rule /(if|unless|elsif|case)(?=\s+)/, Keyword::Reserved, :condition
|
30
|
+
|
31
|
+
rule /(when)(\s+)/ do
|
32
|
+
groups Keyword::Reserved, Text::Whitespace
|
33
|
+
push :when
|
34
|
+
end
|
35
|
+
|
36
|
+
rule /(else)(\s*)(%\})/ do
|
37
|
+
groups Keyword::Reserved, Text::Whitespace, Punctuation
|
38
|
+
pop!
|
39
|
+
end
|
40
|
+
|
41
|
+
# other builtin blocks
|
42
|
+
rule /(capture)(\s+)([^\s%]+)(\s*)(%\})/ do
|
43
|
+
groups Name::Tag, Text::Whitespace, Name::Attribute, Text::Whitespace, Punctuation
|
44
|
+
pop!
|
45
|
+
end
|
46
|
+
|
47
|
+
rule /(comment)(\s*)(%\})/ do
|
48
|
+
groups Name::Tag, Text::Whitespace, Punctuation
|
49
|
+
push :comment
|
50
|
+
end
|
51
|
+
|
52
|
+
rule /(raw)(\s*)(%\})/ do
|
53
|
+
groups Name::Tag, Text::Whitespace, Punctuation
|
54
|
+
push :raw
|
55
|
+
end
|
56
|
+
|
57
|
+
rule /assign/, Name::Tag, :assign
|
58
|
+
rule /include/, Name::Tag, :include
|
59
|
+
|
60
|
+
# end of block
|
61
|
+
rule /(end(case|unless|if))(\s*)(%\})/ do
|
62
|
+
groups Keyword::Reserved, nil, Text::Whitespace, Punctuation
|
63
|
+
pop!
|
64
|
+
end
|
65
|
+
|
66
|
+
rule /(end([^\s%]+))(\s*)(%\})/ do
|
67
|
+
groups Name::Tag, nil, Text::Whitespace, Punctuation
|
68
|
+
pop!
|
69
|
+
end
|
70
|
+
|
71
|
+
# builtin tags
|
72
|
+
rule /(cycle)(\s+)(([^\s:]*)(:))?(\s*)/ do |m|
|
73
|
+
token Name::Tag, m[1]
|
74
|
+
token Text::Whitespace, m[2]
|
75
|
+
|
76
|
+
if m[4] =~ /'[^']*'/
|
77
|
+
token Str::Single, m[4]
|
78
|
+
elsif m[4] =~ /"[^"]*"/
|
79
|
+
token Str::Double, m[4]
|
80
|
+
else
|
81
|
+
token Name::Attribute, m[4]
|
82
|
+
end
|
83
|
+
|
84
|
+
token Punctuation, m[5]
|
85
|
+
token Text::Whitespace, m[6]
|
86
|
+
|
87
|
+
push :variable_tag_markup
|
88
|
+
end
|
89
|
+
|
90
|
+
# other tags or blocks
|
91
|
+
rule /([^\s%]+)(\s*)/ do
|
92
|
+
groups Name::Tag, Text::Whitespace
|
93
|
+
push :tag_markup
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
state :output do
|
98
|
+
mixin :whitespace
|
99
|
+
mixin :generic
|
100
|
+
|
101
|
+
rule /\}\}/, Punctuation, :pop!
|
102
|
+
rule /\|/, Punctuation, :filters
|
103
|
+
end
|
104
|
+
|
105
|
+
state :filters do
|
106
|
+
mixin :whitespace
|
107
|
+
|
108
|
+
rule (/\}\}/) { token Punctuation; reset_stack }
|
109
|
+
|
110
|
+
rule /([^\s\|:]+)(:?)(\s*)/ do
|
111
|
+
groups Name::Function, Punctuation, Text::Whitespace
|
112
|
+
push :filter_markup
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
state :filter_markup do
|
117
|
+
rule /\|/, Punctuation, :pop!
|
118
|
+
|
119
|
+
mixin :end_of_tag
|
120
|
+
mixin :end_of_block
|
121
|
+
mixin :default_param_markup
|
122
|
+
end
|
123
|
+
|
124
|
+
state :condition do
|
125
|
+
mixin :end_of_block
|
126
|
+
mixin :whitespace
|
127
|
+
|
128
|
+
rule /([=!><]=?)/, Operator
|
129
|
+
|
130
|
+
rule /\b((!)|(not\b))/ do
|
131
|
+
groups nil, Operator, Operator::Word
|
132
|
+
end
|
133
|
+
|
134
|
+
rule /([\w\.\'"]+)(\s+)(contains)(\s+)([\w\.\'"]+)/ do
|
135
|
+
groups nil, Text::Whitespace, Operator::Word, Text::Whitespace
|
136
|
+
end
|
137
|
+
|
138
|
+
mixin :generic
|
139
|
+
mixin :whitespace
|
140
|
+
end
|
141
|
+
|
142
|
+
state :when do
|
143
|
+
mixin :end_of_block
|
144
|
+
mixin :whitespace
|
145
|
+
mixin :generic
|
146
|
+
end
|
147
|
+
|
148
|
+
state :operator do
|
149
|
+
rule /(\s*)((=|!|>|<)=?)(\s*)/ do
|
150
|
+
groups Text::Whitespace, Operator, nil, Text::Whitespace
|
151
|
+
pop!
|
152
|
+
end
|
153
|
+
|
154
|
+
rule /(\s*)(\bcontains\b)(\s*)/ do
|
155
|
+
groups Text::Whitespace, Operator::Word, Text::Whitespace
|
156
|
+
pop!
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
state :end_of_tag do
|
161
|
+
rule (/\}\}/) { token Punctuation; reset_stack }
|
162
|
+
end
|
163
|
+
|
164
|
+
state :end_of_block do
|
165
|
+
rule (/%\}/) { token Punctuation; reset_stack }
|
166
|
+
end
|
167
|
+
|
168
|
+
# states for unknown markup
|
169
|
+
state :param_markup do
|
170
|
+
mixin :whitespace
|
171
|
+
|
172
|
+
rule /([^\s=:]+)(\s*)(=|:)/ do
|
173
|
+
groups Name::Attribute, Text::Whitespace, Operator
|
174
|
+
end
|
175
|
+
|
176
|
+
rule /(\{\{)(\s*)([^\s\}])(\s*)(\}\})/ do
|
177
|
+
groups Punctuation, Text::Whitespace, nil, Text::Whitespace, Punctuation
|
178
|
+
end
|
179
|
+
|
180
|
+
mixin :string
|
181
|
+
mixin :number
|
182
|
+
mixin :keyword
|
183
|
+
|
184
|
+
rule /,/, Punctuation
|
185
|
+
end
|
186
|
+
|
187
|
+
state :default_param_markup do
|
188
|
+
mixin :param_markup
|
189
|
+
rule /./, Text
|
190
|
+
end
|
191
|
+
|
192
|
+
state :variable_param_markup do
|
193
|
+
mixin :param_markup
|
194
|
+
mixin :variable
|
195
|
+
rule /./, Text
|
196
|
+
end
|
197
|
+
|
198
|
+
state :tag_markup do
|
199
|
+
rule (/%\}/) { token Punctuation; reset_stack }
|
200
|
+
mixin :default_param_markup
|
201
|
+
end
|
202
|
+
|
203
|
+
state :variable_tag_markup do
|
204
|
+
rule (/%\}/) { token Punctuation; reset_stack }
|
205
|
+
mixin :variable_param_markup
|
206
|
+
end
|
207
|
+
|
208
|
+
# states for different values types
|
209
|
+
state :keyword do
|
210
|
+
rule /\b(false|true)\b/, Keyword::Constant
|
211
|
+
end
|
212
|
+
|
213
|
+
state :variable do
|
214
|
+
rule /\.(?=\w)/, Punctuation
|
215
|
+
rule /[a-zA-Z_]\w*/, Name::Variable
|
216
|
+
end
|
217
|
+
|
218
|
+
state :string do
|
219
|
+
rule /'[^']*'/, Str::Single
|
220
|
+
rule /"[^"]*"/, Str::Double
|
221
|
+
end
|
222
|
+
|
223
|
+
state :number do
|
224
|
+
rule /\d+\.\d+/, Num::Float
|
225
|
+
rule /\d+/, Num::Integer
|
226
|
+
end
|
227
|
+
|
228
|
+
state :generic do
|
229
|
+
mixin :keyword
|
230
|
+
mixin :string
|
231
|
+
mixin :variable
|
232
|
+
mixin :number
|
233
|
+
end
|
234
|
+
|
235
|
+
state :whitespace do
|
236
|
+
rule /[ \t]+/, Text::Whitespace
|
237
|
+
end
|
238
|
+
|
239
|
+
state :comment do
|
240
|
+
rule /(\{%)(\s*)(endcomment)(\s*)(%\})/ do
|
241
|
+
groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation
|
242
|
+
reset_stack
|
243
|
+
end
|
244
|
+
|
245
|
+
rule /./, Comment
|
246
|
+
end
|
247
|
+
|
248
|
+
state :raw do
|
249
|
+
rule /[^\{]+/, Text
|
250
|
+
|
251
|
+
rule /(\{%)(\s*)(endraw)(\s*)(%\})/ do
|
252
|
+
groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation
|
253
|
+
reset_stack
|
254
|
+
end
|
255
|
+
|
256
|
+
rule /\{/, Text
|
257
|
+
end
|
258
|
+
|
259
|
+
state :assign do
|
260
|
+
mixin :whitespace
|
261
|
+
|
262
|
+
rule /(\s*)(=)(\s*)/ do
|
263
|
+
groups Text::Whitespace, Operator, Text::Whitespace
|
264
|
+
end
|
265
|
+
|
266
|
+
rule /\|/, Punctuation, :filters
|
267
|
+
|
268
|
+
mixin :generic
|
269
|
+
end
|
270
|
+
|
271
|
+
state :include do
|
272
|
+
mixin :whitespace
|
273
|
+
|
274
|
+
rule /([^\.]+)(\.)(html|liquid)/ do
|
275
|
+
groups Name::Attribute, Punctuation, Name::Attribute
|
276
|
+
end
|
277
|
+
|
278
|
+
mixin :variable_tag_markup
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|