rouge 2.2.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/lib/rouge.rb +9 -7
- data/lib/rouge/cli.rb +36 -2
- data/lib/rouge/guessers/disambiguation.rb +88 -0
- data/lib/rouge/guessers/glob_mapping.rb +3 -6
- data/lib/rouge/guessers/modeline.rb +4 -3
- data/lib/rouge/guessers/source.rb +6 -16
- data/lib/rouge/guessers/util.rb +32 -0
- data/lib/rouge/lexer.rb +20 -11
- data/lib/rouge/lexers/apiblueprint.rb +0 -4
- data/lib/rouge/lexers/awk.rb +2 -2
- data/lib/rouge/lexers/biml.rb +2 -2
- data/lib/rouge/lexers/c.rb +0 -5
- data/lib/rouge/lexers/coffeescript.rb +2 -2
- data/lib/rouge/lexers/coq.rb +0 -4
- data/lib/rouge/lexers/diff.rb +4 -4
- data/lib/rouge/lexers/digdag.rb +0 -4
- data/lib/rouge/lexers/erb.rb +0 -4
- data/lib/rouge/lexers/erlang.rb +0 -4
- data/lib/rouge/lexers/factor.rb +2 -2
- data/lib/rouge/lexers/gherkin.rb +2 -2
- data/lib/rouge/lexers/go.rb +0 -4
- data/lib/rouge/lexers/groovy.rb +2 -2
- data/lib/rouge/lexers/haml.rb +0 -4
- data/lib/rouge/lexers/haskell.rb +4 -4
- data/lib/rouge/lexers/html.rb +3 -3
- data/lib/rouge/lexers/idlang.rb +0 -6
- data/lib/rouge/lexers/ini.rb +0 -4
- data/lib/rouge/lexers/io.rb +2 -2
- data/lib/rouge/lexers/javascript.rb +1 -1
- data/lib/rouge/lexers/julia.rb +2 -2
- data/lib/rouge/lexers/kotlin.rb +9 -14
- data/lib/rouge/lexers/lasso.rb +3 -6
- data/lib/rouge/lexers/llvm.rb +0 -4
- data/lib/rouge/lexers/lua.rb +2 -2
- data/lib/rouge/lexers/make.rb +0 -4
- data/lib/rouge/lexers/matlab.rb +0 -4
- data/lib/rouge/lexers/moonscript.rb +2 -2
- data/lib/rouge/lexers/mosel.rb +3 -3
- data/lib/rouge/lexers/nasm.rb +0 -5
- data/lib/rouge/lexers/objective_c.rb +0 -14
- data/lib/rouge/lexers/perl.rb +2 -3
- data/lib/rouge/lexers/php.rb +2 -4
- data/lib/rouge/lexers/plist.rb +0 -4
- data/lib/rouge/lexers/praat.rb +2 -2
- data/lib/rouge/lexers/prolog.rb +0 -5
- data/lib/rouge/lexers/properties.rb +0 -4
- data/lib/rouge/lexers/puppet.rb +3 -3
- data/lib/rouge/lexers/python.rb +2 -2
- data/lib/rouge/lexers/q.rb +0 -4
- data/lib/rouge/lexers/r.rb +2 -2
- data/lib/rouge/lexers/racket.rb +5 -4
- data/lib/rouge/lexers/ruby.rb +2 -2
- data/lib/rouge/lexers/rust.rb +2 -2
- data/lib/rouge/lexers/sed.rb +2 -2
- data/lib/rouge/lexers/shell.rb +2 -2
- data/lib/rouge/lexers/smarty.rb +0 -11
- data/lib/rouge/lexers/sml.rb +0 -4
- data/lib/rouge/lexers/tap.rb +0 -4
- data/lib/rouge/lexers/tcl.rb +4 -4
- data/lib/rouge/lexers/tex.rb +2 -2
- data/lib/rouge/lexers/toml.rb +0 -4
- data/lib/rouge/lexers/tulip.rb +2 -3
- data/lib/rouge/lexers/turtle.rb +5 -14
- data/lib/rouge/lexers/vue.rb +0 -4
- data/lib/rouge/lexers/wollok.rb +0 -4
- data/lib/rouge/lexers/xml.rb +4 -6
- data/lib/rouge/lexers/yaml.rb +2 -2
- data/lib/rouge/version.rb +1 -1
- data/rouge.gemspec +1 -0
- metadata +6 -4
data/lib/rouge/lexers/plist.rb
CHANGED
data/lib/rouge/lexers/praat.rb
CHANGED
data/lib/rouge/lexers/prolog.rb
CHANGED
@@ -10,11 +10,6 @@ module Rouge
|
|
10
10
|
filenames '*.pro', '*.P', '*.prolog', '*.pl'
|
11
11
|
mimetypes 'text/x-prolog'
|
12
12
|
|
13
|
-
def self.analyze_text(text)
|
14
|
-
return 0.1 if text =~ /\A\w+(\(\w+\,\s*\w+\))*\./
|
15
|
-
return 0.1 if text.include? ':-'
|
16
|
-
end
|
17
|
-
|
18
13
|
state :basic do
|
19
14
|
rule /\s+/, Text
|
20
15
|
rule /^#.*/, Comment::Single
|
data/lib/rouge/lexers/puppet.rb
CHANGED
@@ -9,9 +9,9 @@ module Rouge
|
|
9
9
|
aliases 'pp'
|
10
10
|
filenames '*.pp'
|
11
11
|
|
12
|
-
def self.
|
13
|
-
return
|
14
|
-
return
|
12
|
+
def self.detect?(text)
|
13
|
+
return true if text.shebang? 'puppet-apply'
|
14
|
+
return true if text.shebang? 'puppet'
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.keywords
|
data/lib/rouge/lexers/python.rb
CHANGED
@@ -10,8 +10,8 @@ module Rouge
|
|
10
10
|
filenames '*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac'
|
11
11
|
mimetypes 'text/x-python', 'application/x-python'
|
12
12
|
|
13
|
-
def self.
|
14
|
-
return
|
13
|
+
def self.detect?(text)
|
14
|
+
return true if text.shebang?(/pythonw?(3|2(\.\d)?)?/)
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.keywords
|
data/lib/rouge/lexers/q.rb
CHANGED
data/lib/rouge/lexers/r.rb
CHANGED
data/lib/rouge/lexers/racket.rb
CHANGED
@@ -9,10 +9,11 @@ module Rouge
|
|
9
9
|
filenames '*.rkt', '*.rktd', '*.rktl'
|
10
10
|
mimetypes 'text/x-racket', 'application/x-racket'
|
11
11
|
|
12
|
-
def self.
|
13
|
-
text
|
14
|
-
|
15
|
-
return
|
12
|
+
def self.detect?(text)
|
13
|
+
text =~ /\A#lang\s*(.*?)$/
|
14
|
+
lang_attr = $1
|
15
|
+
return false unless lang_attr
|
16
|
+
return true if lang_attr =~ /racket|scribble/
|
16
17
|
end
|
17
18
|
|
18
19
|
def self.keywords
|
data/lib/rouge/lexers/ruby.rb
CHANGED
data/lib/rouge/lexers/rust.rb
CHANGED
data/lib/rouge/lexers/sed.rb
CHANGED
data/lib/rouge/lexers/shell.rb
CHANGED
data/lib/rouge/lexers/smarty.rb
CHANGED
@@ -10,17 +10,6 @@ module Rouge
|
|
10
10
|
filenames '*.tpl', '*.smarty'
|
11
11
|
mimetypes 'application/x-smarty', 'text/x-smarty'
|
12
12
|
|
13
|
-
def self.analyze_text(text)
|
14
|
-
rv = 0.0
|
15
|
-
rv += 0.15 if text =~ /\{if\s+.*?\}.*?\{\/if\}/
|
16
|
-
rv += 0.15 if text =~ /\{include\s+file=.*?\}/
|
17
|
-
rv += 0.15 if text =~ /\{foreach\s+.*?\}.*?\{\/foreach\}/
|
18
|
-
rv += 0.01 if text =~ /\{\$.*?\}/
|
19
|
-
return rv
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
13
|
def self.builtins
|
25
14
|
@builtins ||= %w(
|
26
15
|
append assign block call capture config_load debug extends
|
data/lib/rouge/lexers/sml.rb
CHANGED
data/lib/rouge/lexers/tap.rb
CHANGED
data/lib/rouge/lexers/tcl.rb
CHANGED
@@ -9,10 +9,10 @@ module Rouge
|
|
9
9
|
filenames '*.tcl'
|
10
10
|
mimetypes 'text/x-tcl', 'text/x-script.tcl', 'application/x-tcl'
|
11
11
|
|
12
|
-
def self.
|
13
|
-
return
|
14
|
-
return
|
15
|
-
return
|
12
|
+
def self.detect?(text)
|
13
|
+
return true if text.shebang? 'tclsh'
|
14
|
+
return true if text.shebang? 'wish'
|
15
|
+
return true if text.shebang? 'jimsh'
|
16
16
|
end
|
17
17
|
|
18
18
|
KEYWORDS = %w(
|
data/lib/rouge/lexers/tex.rb
CHANGED
@@ -11,8 +11,8 @@ module Rouge
|
|
11
11
|
filenames '*.tex', '*.aux', '*.toc', '*.sty', '*.cls'
|
12
12
|
mimetypes 'text/x-tex', 'text/x-latex'
|
13
13
|
|
14
|
-
def self.
|
15
|
-
return
|
14
|
+
def self.detect?(text)
|
15
|
+
return true if text =~ /\A\s*\\(documentclass|input|documentstyle|relax|ProvidesPackage|ProvidesClass)/
|
16
16
|
end
|
17
17
|
|
18
18
|
command = /\\([a-z]+|\s+|.)/i
|
data/lib/rouge/lexers/toml.rb
CHANGED
data/lib/rouge/lexers/tulip.rb
CHANGED
data/lib/rouge/lexers/turtle.rb
CHANGED
@@ -12,29 +12,21 @@ module Rouge
|
|
12
12
|
application/trig
|
13
13
|
)
|
14
14
|
|
15
|
-
def self.analyze_text(text)
|
16
|
-
start = text[0..1000]
|
17
|
-
return 0.5 if start =~ %r(@prefix\b)
|
18
|
-
return 0.5 if start =~ %r(@base\b)
|
19
|
-
return 0.4 if start =~ %r(PREFIX\b)i
|
20
|
-
return 0.4 if start =~ %r(BASE\b)i
|
21
|
-
end
|
22
|
-
|
23
15
|
state :root do
|
24
16
|
rule /@base\b/, Keyword::Declaration
|
25
17
|
rule /@prefix\b/, Keyword::Declaration
|
26
18
|
rule /true\b/, Keyword::Constant
|
27
19
|
rule /false\b/, Keyword::Constant
|
28
|
-
|
20
|
+
|
29
21
|
rule /""".*?"""/m, Literal::String
|
30
22
|
rule /"([^"\\]|\\.)*"/, Literal::String
|
31
23
|
rule /'''.*?'''/m, Literal::String
|
32
24
|
rule /'([^'\\]|\\.)*'/, Literal::String
|
33
|
-
|
25
|
+
|
34
26
|
rule /#.*$/, Comment::Single
|
35
|
-
|
27
|
+
|
36
28
|
rule /@[^\s,.; ]+/, Name::Attribute
|
37
|
-
|
29
|
+
|
38
30
|
rule /[+-]?[0-9]+\.[0-9]*E[+-]?[0-9]+/, Literal::Number::Float
|
39
31
|
rule /[+-]?\.[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
|
40
32
|
rule /[+-]?[0-9]+E[+-]?[0-9]+/, Literal::Number::Float
|
@@ -53,7 +45,7 @@ module Rouge
|
|
53
45
|
rule /\[/, Punctuation
|
54
46
|
rule /\]/, Punctuation
|
55
47
|
rule /\^\^/, Punctuation
|
56
|
-
|
48
|
+
|
57
49
|
rule /<[^>]*>/, Name::Label
|
58
50
|
|
59
51
|
rule /base\b/i, Keyword::Declaration
|
@@ -65,7 +57,6 @@ module Rouge
|
|
65
57
|
|
66
58
|
rule /[^:;<>#\@"\(\).\[\]\{\} ]+:/, Name::Namespace
|
67
59
|
rule /[^:;<>#\@"\(\).\[\]\{\} ]+/, Name
|
68
|
-
|
69
60
|
end
|
70
61
|
end
|
71
62
|
end
|
data/lib/rouge/lexers/vue.rb
CHANGED
data/lib/rouge/lexers/wollok.rb
CHANGED
data/lib/rouge/lexers/xml.rb
CHANGED
@@ -15,12 +15,10 @@ module Rouge
|
|
15
15
|
application/atom+xml
|
16
16
|
)
|
17
17
|
|
18
|
-
def self.
|
19
|
-
return
|
20
|
-
return
|
21
|
-
|
22
|
-
return 0.6 if start =~ %r(<xml\b)
|
23
|
-
return 0.3 if start =~ %r(<.+?>.*?</.+?>)m
|
18
|
+
def self.detect?(text)
|
19
|
+
return false if text.doctype?(/html/)
|
20
|
+
return true if text =~ /\A<\?xml\b/
|
21
|
+
return true if text.doctype?
|
24
22
|
end
|
25
23
|
|
26
24
|
state :root do
|
data/lib/rouge/lexers/yaml.rb
CHANGED
@@ -10,9 +10,9 @@ module Rouge
|
|
10
10
|
aliases 'yml'
|
11
11
|
filenames '*.yaml', '*.yml'
|
12
12
|
|
13
|
-
def self.
|
13
|
+
def self.detect?(text)
|
14
14
|
# look for the %YAML directive
|
15
|
-
return
|
15
|
+
return true if text =~ /\A\s*%YAML/m
|
16
16
|
end
|
17
17
|
|
18
18
|
SPECIAL_VALUES = Regexp.union(%w(true false null))
|
data/lib/rouge/version.rb
CHANGED
data/rouge.gemspec
CHANGED
@@ -15,4 +15,5 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = Dir['Gemfile', 'LICENSE', 'rouge.gemspec', 'lib/**/*.rb', 'lib/**/*.yml', 'bin/rougify', 'lib/rouge/demos/*']
|
16
16
|
s.executables = %w(rougify)
|
17
17
|
s.licenses = ['MIT', 'BSD-2-Clause']
|
18
|
+
s.required_ruby_version = '>= 2.0'
|
18
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rouge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeanine Adkisson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
|
14
14
|
email:
|
@@ -163,11 +163,13 @@ files:
|
|
163
163
|
- lib/rouge/formatters/null.rb
|
164
164
|
- lib/rouge/formatters/terminal256.rb
|
165
165
|
- lib/rouge/guesser.rb
|
166
|
+
- lib/rouge/guessers/disambiguation.rb
|
166
167
|
- lib/rouge/guessers/filename.rb
|
167
168
|
- lib/rouge/guessers/glob_mapping.rb
|
168
169
|
- lib/rouge/guessers/mimetype.rb
|
169
170
|
- lib/rouge/guessers/modeline.rb
|
170
171
|
- lib/rouge/guessers/source.rb
|
172
|
+
- lib/rouge/guessers/util.rb
|
171
173
|
- lib/rouge/lexer.rb
|
172
174
|
- lib/rouge/lexers/abap.rb
|
173
175
|
- lib/rouge/lexers/actionscript.rb
|
@@ -340,7 +342,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
340
342
|
requirements:
|
341
343
|
- - ">="
|
342
344
|
- !ruby/object:Gem::Version
|
343
|
-
version: '0'
|
345
|
+
version: '2.0'
|
344
346
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
345
347
|
requirements:
|
346
348
|
- - ">="
|
@@ -348,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
350
|
version: '0'
|
349
351
|
requirements: []
|
350
352
|
rubyforge_project: rouge
|
351
|
-
rubygems_version: 2.6.
|
353
|
+
rubygems_version: 2.6.13
|
352
354
|
signing_key:
|
353
355
|
specification_version: 4
|
354
356
|
summary: A pure-ruby colorizer based on pygments
|