rouge 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rouge.rb +2 -0
- data/lib/rouge/lexer.rb +8 -0
- data/lib/rouge/lexers/css.rb +13 -5
- data/lib/rouge/lexers/python.rb +181 -0
- data/lib/rouge/theme.rb +95 -10
- data/lib/rouge/themes/base16.rb +128 -0
- data/lib/rouge/themes/colorful.rb +58 -56
- data/lib/rouge/themes/thankful_eyes.rb +33 -31
- data/lib/rouge/version.rb +1 -1
- metadata +4 -2
data/lib/rouge.rb
CHANGED
@@ -25,6 +25,7 @@ load load_dir.join('rouge/lexers/css.rb')
|
|
25
25
|
load load_dir.join('rouge/lexers/html.rb')
|
26
26
|
|
27
27
|
load load_dir.join('rouge/lexers/tcl.rb')
|
28
|
+
load load_dir.join('rouge/lexers/python.rb')
|
28
29
|
|
29
30
|
load load_dir.join('rouge/formatter.rb')
|
30
31
|
load load_dir.join('rouge/formatters/html.rb')
|
@@ -32,3 +33,4 @@ load load_dir.join('rouge/formatters/html.rb')
|
|
32
33
|
load load_dir.join('rouge/theme.rb')
|
33
34
|
load load_dir.join('rouge/themes/thankful_eyes.rb')
|
34
35
|
load load_dir.join('rouge/themes/colorful.rb')
|
36
|
+
load load_dir.join('rouge/themes/base16.rb')
|
data/lib/rouge/lexer.rb
CHANGED
@@ -255,7 +255,15 @@ module Rouge
|
|
255
255
|
stack.last
|
256
256
|
end
|
257
257
|
|
258
|
+
MAX_STEPS = 200000
|
258
259
|
def scan(re, &b)
|
260
|
+
@steps ||= 0
|
261
|
+
@steps += 1
|
262
|
+
|
263
|
+
if @steps >= MAX_STEPS
|
264
|
+
raise "too many scans near: #{scanner.peek(20)}..."
|
265
|
+
end
|
266
|
+
|
259
267
|
scanner.scan(re)
|
260
268
|
|
261
269
|
if scanner.matched?
|
data/lib/rouge/lexers/css.rb
CHANGED
@@ -64,7 +64,7 @@ module Rouge
|
|
64
64
|
upper-alpha upper-latin upper-roman uppercase url
|
65
65
|
visible w-resize wait wider x-fast x-high x-large x-loud
|
66
66
|
x-low x-small x-soft xx-large xx-small yes
|
67
|
-
)
|
67
|
+
)
|
68
68
|
|
69
69
|
builtins = %w(
|
70
70
|
indigo gold firebrick indianred yellow darkolivegreen
|
@@ -92,7 +92,7 @@ module Rouge
|
|
92
92
|
lightslategray lawngreen lightgreen tomato hotpink
|
93
93
|
lightyellow lavenderblush linen mediumaquamarine green
|
94
94
|
blueviolet peachpuff
|
95
|
-
)
|
95
|
+
)
|
96
96
|
|
97
97
|
state :root do
|
98
98
|
mixin :basics
|
@@ -148,9 +148,17 @@ module Rouge
|
|
148
148
|
state :stanza do
|
149
149
|
mixin :basics
|
150
150
|
rule /}/, 'Punctuation', :pop!
|
151
|
-
rule /(
|
152
|
-
|
153
|
-
|
151
|
+
rule /(#{identifier}\s*):/m do |m|
|
152
|
+
if keywords.include? m[1]
|
153
|
+
token 'Keyword'
|
154
|
+
elsif builtins.include? m[1]
|
155
|
+
token 'Name.Builtin'
|
156
|
+
else
|
157
|
+
token 'Name'
|
158
|
+
end
|
159
|
+
|
160
|
+
push :stanza_value
|
161
|
+
end
|
154
162
|
end
|
155
163
|
|
156
164
|
state :stanza_value do
|
@@ -0,0 +1,181 @@
|
|
1
|
+
module Rouge
|
2
|
+
module Lexers
|
3
|
+
class Python < RegexLexer
|
4
|
+
tag 'python'
|
5
|
+
aliases 'py'
|
6
|
+
extensions 'py'
|
7
|
+
|
8
|
+
keywords = %w(
|
9
|
+
assert break continue del elif else except exec
|
10
|
+
finally for global if lambda pass print raise
|
11
|
+
return try while yield as with
|
12
|
+
)
|
13
|
+
|
14
|
+
builtins = %w(
|
15
|
+
__import__ abs all any apply basestring bin bool buffer
|
16
|
+
bytearray bytes callable chr classmethod cmp coerce compile
|
17
|
+
complex delattr dict dir divmod enumerate eval execfile exit
|
18
|
+
file filter float frozenset getattr globals hasattr hash hex id
|
19
|
+
input int intern isinstance issubclass iter len list locals
|
20
|
+
long map max min next object oct open ord pow property range
|
21
|
+
raw_input reduce reload repr reversed round set setattr slice
|
22
|
+
sorted staticmethod str sum super tuple type unichr unicode
|
23
|
+
vars xrange zip
|
24
|
+
)
|
25
|
+
|
26
|
+
builtins_pseudo = %w(self None Ellipsis NotImplemented False True)
|
27
|
+
|
28
|
+
exceptions = %w(
|
29
|
+
ArithmeticError AssertionError AttributeError
|
30
|
+
BaseException DeprecationWarning EOFError EnvironmentError
|
31
|
+
Exception FloatingPointError FutureWarning GeneratorExit IOError
|
32
|
+
ImportError ImportWarning IndentationError IndexError KeyError
|
33
|
+
KeyboardInterrupt LookupError MemoryError NameError
|
34
|
+
NotImplemented NotImplementedError OSError OverflowError
|
35
|
+
OverflowWarning PendingDeprecationWarning ReferenceError
|
36
|
+
RuntimeError RuntimeWarning StandardError StopIteration
|
37
|
+
SyntaxError SyntaxWarning SystemError SystemExit TabError
|
38
|
+
TypeError UnboundLocalError UnicodeDecodeError
|
39
|
+
UnicodeEncodeError UnicodeError UnicodeTranslateError
|
40
|
+
UnicodeWarning UserWarning ValueError VMSError Warning
|
41
|
+
WindowsError ZeroDivisionError
|
42
|
+
)
|
43
|
+
|
44
|
+
identifier = /[a-z_][a-z0-9_]*/i
|
45
|
+
dotted_identifier = /[a-z_.][a-z0-9_.]*/i
|
46
|
+
state :root do
|
47
|
+
rule /\n+/m, 'Text'
|
48
|
+
rule /^(\s*)([rRuU]{,2}""".*?""")/m do
|
49
|
+
group 'Text'
|
50
|
+
group 'Literal.String.Doc'
|
51
|
+
end
|
52
|
+
|
53
|
+
rule /[^\S\n]+/, 'Text'
|
54
|
+
rule /#.*$/, 'Comment'
|
55
|
+
rule /[\[\]{}:(),;]/, 'Punctuation'
|
56
|
+
rule /\\\n/, 'Text'
|
57
|
+
rule /\\/, 'Text'
|
58
|
+
|
59
|
+
rule /(in|is|and|or|not)\b/, 'Operator.Word'
|
60
|
+
rule /!=|==|<<|>>|[-~+\/*%=<>&^|.]/, 'Operator'
|
61
|
+
|
62
|
+
rule /(?:#{keywords.join('|')})\b/, 'Keyword'
|
63
|
+
|
64
|
+
rule /(def)((?:\s|\\\s)+)/ do
|
65
|
+
group 'Keyword' # def
|
66
|
+
group 'Text' # whitespae
|
67
|
+
push :funcname
|
68
|
+
end
|
69
|
+
|
70
|
+
rule /(class)((?:\s|\\\s)+)/ do
|
71
|
+
group 'Keyword'
|
72
|
+
group 'Text'
|
73
|
+
push :classname
|
74
|
+
end
|
75
|
+
|
76
|
+
rule /(from)((?:\s|\\\s)+)/ do
|
77
|
+
group 'Keyword.Namespace'
|
78
|
+
group 'Text'
|
79
|
+
push :fromimport
|
80
|
+
end
|
81
|
+
|
82
|
+
rule /(import)((?:\s|\\\s)+)/ do
|
83
|
+
group 'Keyword.Namespace'
|
84
|
+
group 'Text'
|
85
|
+
push :import
|
86
|
+
end
|
87
|
+
|
88
|
+
# using negative lookbehind so we don't match property names
|
89
|
+
rule /(?<!\.)(?:#{builtins.join('|')})/, 'Name.Builtin'
|
90
|
+
rule /(?<!\.)(?:#{builtins_pseudo.join('|')})/, 'Name.Builtin.Pseudo'
|
91
|
+
|
92
|
+
# TODO: not in python 3
|
93
|
+
rule /`.*?`/, 'Literal.String.Backtick'
|
94
|
+
rule /(?:r|ur|ru)"""/i, 'Literal.String', :tdqs
|
95
|
+
rule /(?:r|ur|ru)'''/i, 'Literal.String', :tsqs
|
96
|
+
rule /(?:r|ur|ru)"/i, 'Literal.String', :dqs
|
97
|
+
rule /(?:r|ur|ru)'/i, 'Literal.String', :sqs
|
98
|
+
rule /u?"""/i, 'Literal.String', :escape_tdqs
|
99
|
+
rule /u?'''/i, 'Literal.String', :escape_tsqs
|
100
|
+
rule /u?"/i, 'Literal.String', :escape_dqs
|
101
|
+
rule /u?'/i, 'Literal.String', :escape_sqs
|
102
|
+
|
103
|
+
rule /@#{dotted_identifier}/i, 'Name.Decorator'
|
104
|
+
rule identifier, 'Name'
|
105
|
+
|
106
|
+
rule /(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?/i, 'Literal.Number.Float'
|
107
|
+
rule /\d+e[+-]?[0-9]+/i, 'Literal.Number.Float'
|
108
|
+
rule /0[0-7]+/, 'Literal.Number.Oct'
|
109
|
+
rule /0x[a-f0-9]+/i, 'Literal.Number.Hex'
|
110
|
+
rule /\d+L/, 'Literal.Number.Integer.Long'
|
111
|
+
rule /\d+/, 'Literal.Number.Integer'
|
112
|
+
end
|
113
|
+
|
114
|
+
state :funcname do
|
115
|
+
rule identifier, 'Name.Function', :pop!
|
116
|
+
end
|
117
|
+
|
118
|
+
state :classname do
|
119
|
+
rule identifier, 'Name.Class', :pop!
|
120
|
+
end
|
121
|
+
|
122
|
+
state :import do
|
123
|
+
# non-line-terminating whitespace
|
124
|
+
rule /(?:[ \t]|\\\n)+/, 'Text'
|
125
|
+
|
126
|
+
rule /as\b/, 'Keyword.Namespace'
|
127
|
+
rule /,/, 'Operator'
|
128
|
+
rule dotted_identifier, 'Name.Namespace'
|
129
|
+
rule(//) { pop! } # anything else -> go back
|
130
|
+
end
|
131
|
+
|
132
|
+
state :fromimport do
|
133
|
+
# non-line-terminating whitespace
|
134
|
+
rule /(?:[ \t]|\\\n)+/, 'Text'
|
135
|
+
|
136
|
+
rule /import\b/, 'Keyword.Namespace', :pop!
|
137
|
+
rule dotted_identifier, 'Name.Namespace'
|
138
|
+
end
|
139
|
+
|
140
|
+
state :strings do
|
141
|
+
rule /%(\([a-z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?/i, 'Literal.String.Interpol'
|
142
|
+
rule /[^\\'"%\n]+/, 'Literal.String'
|
143
|
+
end
|
144
|
+
|
145
|
+
state :nl do
|
146
|
+
rule /\n/, 'Literal.String'
|
147
|
+
end
|
148
|
+
|
149
|
+
state :dqs do
|
150
|
+
rule /"/, 'Literal.String', :pop!
|
151
|
+
rule /\\\\|\\"|\\\n/, 'Literal.String.Escape'
|
152
|
+
mixin :strings
|
153
|
+
end
|
154
|
+
|
155
|
+
state :sqs do
|
156
|
+
rule /'/, 'Literal.String', :pop!
|
157
|
+
rule /\\\\|\\'|\\\n/, 'Literal.String.Escape'
|
158
|
+
mixin :strings
|
159
|
+
end
|
160
|
+
|
161
|
+
state :tdqs do
|
162
|
+
rule /"""/, 'Literal.String', :pop!
|
163
|
+
mixin :strings
|
164
|
+
mixin :nl
|
165
|
+
end
|
166
|
+
|
167
|
+
state :tsqs do
|
168
|
+
rule /'''/, 'Literal.String', :pop!
|
169
|
+
mixin :strings
|
170
|
+
mixin :nl
|
171
|
+
end
|
172
|
+
|
173
|
+
%w(tdqs tsqs dqs sqs).each do |qtype|
|
174
|
+
state :"escape_#{qtype}" do
|
175
|
+
mixin :escape
|
176
|
+
mixin :"#{qtype}"
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
data/lib/rouge/theme.rb
CHANGED
@@ -1,14 +1,54 @@
|
|
1
1
|
module Rouge
|
2
2
|
class Theme
|
3
|
+
class InheritableHash < Hash
|
4
|
+
def initialize(parent=nil)
|
5
|
+
@parent = parent
|
6
|
+
end
|
7
|
+
|
8
|
+
def [](k)
|
9
|
+
_sup = super
|
10
|
+
return _sup if own_keys.include?(k)
|
11
|
+
|
12
|
+
_sup || parent[k]
|
13
|
+
end
|
14
|
+
|
15
|
+
def parent
|
16
|
+
@parent ||= {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def include?(k)
|
20
|
+
super or parent.include?(k)
|
21
|
+
end
|
22
|
+
|
23
|
+
def each(&b)
|
24
|
+
keys.each do |k|
|
25
|
+
b.call(k, self[k])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
alias own_keys keys
|
30
|
+
def keys
|
31
|
+
keys = own_keys.concat(parent.keys)
|
32
|
+
keys.uniq!
|
33
|
+
keys
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
3
37
|
class Style < Hash
|
38
|
+
def initialize(theme, hsh={})
|
39
|
+
super()
|
40
|
+
@theme = theme
|
41
|
+
merge!(hsh)
|
42
|
+
end
|
43
|
+
|
4
44
|
def render(selector, &b)
|
5
45
|
return enum_for(:render, selector).to_a.join("\n") unless b
|
6
46
|
|
7
47
|
return if empty?
|
8
48
|
|
9
49
|
yield "#{selector} {"
|
10
|
-
yield " color: #{self[:fg]};" if self[:fg]
|
11
|
-
yield " background-color: #{self[:bg]};" if self[:bg]
|
50
|
+
yield " color: #{@theme.palette(self[:fg])};" if self[:fg]
|
51
|
+
yield " background-color: #{@theme.palette(self[:bg])};" if self[:bg]
|
12
52
|
yield " font-weight: bold;" if self[:bold]
|
13
53
|
yield " font-style: italic;" if self[:italic]
|
14
54
|
yield " text-decoration: underline;" if self[:underline]
|
@@ -19,16 +59,40 @@ module Rouge
|
|
19
59
|
|
20
60
|
yield "}"
|
21
61
|
end
|
62
|
+
|
22
63
|
end
|
23
64
|
|
24
|
-
|
25
|
-
|
26
|
-
|
65
|
+
def styles
|
66
|
+
@styles ||= self.class.styles.dup
|
67
|
+
end
|
68
|
+
|
69
|
+
@palette = {}
|
70
|
+
def self.palette(arg={})
|
71
|
+
@palette ||= InheritableHash.new(superclass.palette)
|
72
|
+
|
73
|
+
if arg.is_a? Hash
|
74
|
+
@palette.merge! arg
|
75
|
+
@palette
|
76
|
+
else
|
77
|
+
case arg
|
78
|
+
when /#[0-9a-f]+/i
|
79
|
+
arg
|
80
|
+
else
|
81
|
+
@palette[arg] or raise "not in palette: #{arg.inspect}"
|
82
|
+
end
|
27
83
|
end
|
84
|
+
end
|
28
85
|
|
86
|
+
@styles = {}
|
87
|
+
def self.styles
|
88
|
+
@styles ||= InheritableHash.new(superclass.styles)
|
89
|
+
end
|
90
|
+
|
91
|
+
class << self
|
29
92
|
def style(*tokens)
|
30
|
-
style =
|
31
|
-
|
93
|
+
style = tokens.last.is_a?(Hash) ? tokens.pop : {}
|
94
|
+
|
95
|
+
style = Style.new(self, style)
|
32
96
|
|
33
97
|
tokens.each do |tok|
|
34
98
|
styles[tok.to_s] = style
|
@@ -39,7 +103,7 @@ module Rouge
|
|
39
103
|
return @name if n.nil?
|
40
104
|
|
41
105
|
@name = n.to_s
|
42
|
-
registry[@name] = self
|
106
|
+
Theme.registry[@name] = self
|
43
107
|
end
|
44
108
|
|
45
109
|
def find(n)
|
@@ -52,6 +116,27 @@ module Rouge
|
|
52
116
|
end
|
53
117
|
end
|
54
118
|
|
119
|
+
module HasModes
|
120
|
+
def mode(arg=:absent)
|
121
|
+
return @mode if arg == :absent
|
122
|
+
|
123
|
+
@modes ||= {}
|
124
|
+
@modes[arg] ||= get_mode(arg)
|
125
|
+
end
|
126
|
+
|
127
|
+
def get_mode(mode)
|
128
|
+
return self if self.mode == mode
|
129
|
+
|
130
|
+
new_name = "#{self.name}.#{mode}"
|
131
|
+
Class.new(self) { name(new_name); mode!(mode) }
|
132
|
+
end
|
133
|
+
|
134
|
+
def mode!(arg)
|
135
|
+
@mode = arg
|
136
|
+
send("make_#{arg}!")
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
55
140
|
class CSSTheme < Theme
|
56
141
|
def initialize(opts={})
|
57
142
|
@scope = opts[:scope] || '.highlight'
|
@@ -60,7 +145,7 @@ module Rouge
|
|
60
145
|
def render(&b)
|
61
146
|
return enum_for(:render).to_a.join("\n") unless b
|
62
147
|
|
63
|
-
|
148
|
+
styles.each do |tokname, style|
|
64
149
|
style.render(css_selector(Token[tokname]), &b)
|
65
150
|
end
|
66
151
|
end
|
@@ -92,7 +177,7 @@ module Rouge
|
|
92
177
|
|
93
178
|
yield tok
|
94
179
|
tok.sub_tokens.each_value do |st|
|
95
|
-
next if
|
180
|
+
next if styles[st.name]
|
96
181
|
|
97
182
|
inflate_token(st, &b)
|
98
183
|
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
module Rouge
|
2
|
+
module Themes
|
3
|
+
# default base16 theme
|
4
|
+
# by Chris Kempson (http://chriskempson.com)
|
5
|
+
class Base16 < CSSTheme
|
6
|
+
name 'base16'
|
7
|
+
|
8
|
+
palette base00: "#151515"
|
9
|
+
palette base01: "#202020"
|
10
|
+
palette base02: "#303030"
|
11
|
+
palette base03: "#505050"
|
12
|
+
palette base04: "#b0b0b0"
|
13
|
+
palette base05: "#d0d0d0"
|
14
|
+
palette base06: "#e0e0e0"
|
15
|
+
palette base07: "#f5f5f5"
|
16
|
+
palette base08: "#ac4142"
|
17
|
+
palette base09: "#d28445"
|
18
|
+
palette base0A: "#f4bf75"
|
19
|
+
palette base0B: "#90a959"
|
20
|
+
palette base0C: "#75b5aa"
|
21
|
+
palette base0D: "#6a9fb5"
|
22
|
+
palette base0E: "#aa759f"
|
23
|
+
palette base0F: "#8f5536"
|
24
|
+
|
25
|
+
extend HasModes
|
26
|
+
|
27
|
+
def self.light!
|
28
|
+
mode :dark # indicate that there is a dark variant
|
29
|
+
mode! :light
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.dark!
|
33
|
+
mode :light # indicate that there is a light variant
|
34
|
+
mode! :dark
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.make_dark!
|
38
|
+
style 'Text', :fg => :base05, :bg => :base00
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.make_light!
|
42
|
+
style 'Text', :fg => :base02
|
43
|
+
end
|
44
|
+
|
45
|
+
light!
|
46
|
+
|
47
|
+
style 'Error', :fg => :base00, :bg => :base08
|
48
|
+
style 'Comment', :fg => :base03
|
49
|
+
|
50
|
+
style 'Comment.Preproc',
|
51
|
+
'Name.Tag', :fg => :base0A
|
52
|
+
|
53
|
+
style 'Operator',
|
54
|
+
'Punctuation', :fg => :base05
|
55
|
+
|
56
|
+
style 'Generic.Inserted', :fg => :base0B
|
57
|
+
style 'Generic.Removed', :fg => :base08
|
58
|
+
style 'Generic.Heading', :fg => :base0D, :bg => :base00, :bold => true
|
59
|
+
|
60
|
+
style 'Keyword', :fg => :base0E
|
61
|
+
style 'Keyword.Constant',
|
62
|
+
'Keyword.Type', :fg => :base09
|
63
|
+
|
64
|
+
style 'Keyword.Declaration', :fg => :base09
|
65
|
+
|
66
|
+
style 'Literal.String', :fg => :base0B
|
67
|
+
style 'Literal.String.Regex', :fg => :base0C
|
68
|
+
|
69
|
+
style 'Literal.String.Interpol',
|
70
|
+
'Literal.String.Escape', :fg => :base0F
|
71
|
+
|
72
|
+
style 'Name.Namespace',
|
73
|
+
'Name.Class',
|
74
|
+
'Name.Constant', :fg => :base0A
|
75
|
+
|
76
|
+
style 'Name.Attribute', :fg => :base0D
|
77
|
+
|
78
|
+
style 'Literal.Number',
|
79
|
+
'Literal.String.Symbol', :fg => :base0B
|
80
|
+
|
81
|
+
class Solarized < Base16
|
82
|
+
name 'base16.solarized'
|
83
|
+
light!
|
84
|
+
# author "Ethan Schoonover (http://ethanschoonover.com/solarized)"
|
85
|
+
|
86
|
+
palette base00: "#002b36"
|
87
|
+
palette base01: "#073642"
|
88
|
+
palette base02: "#586e75"
|
89
|
+
palette base03: "#657b83"
|
90
|
+
palette base04: "#839496"
|
91
|
+
palette base05: "#93a1a1"
|
92
|
+
palette base06: "#eee8d5"
|
93
|
+
palette base07: "#fdf6e3"
|
94
|
+
palette base08: "#dc322f"
|
95
|
+
palette base09: "#cb4b16"
|
96
|
+
palette base0A: "#b58900"
|
97
|
+
palette base0B: "#859900"
|
98
|
+
palette base0C: "#2aa198"
|
99
|
+
palette base0D: "#268bd2"
|
100
|
+
palette base0E: "#6c71c4"
|
101
|
+
palette base0F: "#d33682"
|
102
|
+
end
|
103
|
+
|
104
|
+
class Monokai < Base16
|
105
|
+
name 'base16.monokai'
|
106
|
+
dark!
|
107
|
+
|
108
|
+
# author "Wimer Hazenberg (http://www.monokai.nl)"
|
109
|
+
palette base00: "#272822"
|
110
|
+
palette base01: "#383830"
|
111
|
+
palette base02: "#49483e"
|
112
|
+
palette base03: "#75715e"
|
113
|
+
palette base04: "#a59f85"
|
114
|
+
palette base05: "#f8f8f2"
|
115
|
+
palette base06: "#f5f4f1"
|
116
|
+
palette base07: "#f9f8f5"
|
117
|
+
palette base08: "#f92672"
|
118
|
+
palette base09: "#fd971f"
|
119
|
+
palette base0A: "#f4bf75"
|
120
|
+
palette base0B: "#a6e22e"
|
121
|
+
palette base0C: "#a1efe4"
|
122
|
+
palette base0D: "#66d9ef"
|
123
|
+
palette base0E: "#ae81ff"
|
124
|
+
palette base0F: "#cc6633"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -2,62 +2,64 @@ module Rouge
|
|
2
2
|
module Themes
|
3
3
|
# stolen from pygments
|
4
4
|
class Colorful < CSSTheme
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
5
|
+
name 'colorful'
|
6
|
+
|
7
|
+
style 'Text', :fg => "#bbbbbb", :bg => 'black'
|
8
|
+
|
9
|
+
style 'Comment', :fg => "#888"
|
10
|
+
style 'Comment.Preproc', :fg => "#579"
|
11
|
+
style 'Comment.Special', :fg => "#cc0000", :bold => true
|
12
|
+
|
13
|
+
style 'Keyword', :fg => "#080", :bold => true
|
14
|
+
style 'Keyword.Pseudo', :fg => "#038"
|
15
|
+
style 'Keyword.Type', :fg => "#339"
|
16
|
+
|
17
|
+
style 'Operator', :fg => "#333"
|
18
|
+
style 'Operator.Word', :fg => "#000", :bold => true
|
19
|
+
|
20
|
+
style 'Name.Builtin', :fg => "#007020"
|
21
|
+
style 'Name.Function', :fg => "#06B", :bold => true
|
22
|
+
style 'Name.Class', :fg => "#B06", :bold => true
|
23
|
+
style 'Name.Namespace', :fg => "#0e84b5", :bold => true
|
24
|
+
style 'Name.Exception', :fg => "#F00", :bold => true
|
25
|
+
style 'Name.Variable', :fg => "#963"
|
26
|
+
style 'Name.Variable.Instance', :fg => "#33B"
|
27
|
+
style 'Name.Variable.Class', :fg => "#369"
|
28
|
+
style 'Name.Variable.Global', :fg => "#d70", :bold => true
|
29
|
+
style 'Name.Constant', :fg => "#036", :bold => true
|
30
|
+
style 'Name.Label', :fg => "#970", :bold => true
|
31
|
+
style 'Name.Entity', :fg => "#800", :bold => true
|
32
|
+
style 'Name.Attribute', :fg => "#00C"
|
33
|
+
style 'Name.Tag', :fg => "#070"
|
34
|
+
style 'Name.Decorator', :fg => "#555", :bold => true
|
35
|
+
|
36
|
+
style 'Literal.String', :bg => "#fff0f0"
|
37
|
+
style 'Literal.String.Char', :fg => "#04D"
|
38
|
+
style 'Literal.String.Doc', :fg => "#D42"
|
39
|
+
style 'Literal.String.Interpol', :bg => "#eee"
|
40
|
+
style 'Literal.String.Escape', :fg => "#666", :bold => true
|
41
|
+
style 'Literal.String.Regex', :fg => "#000", :bg => "#fff0ff"
|
42
|
+
style 'Literal.String.Symbol', :fg => "#A60"
|
43
|
+
style 'Literal.String.Other', :fg => "#D20"
|
44
|
+
|
45
|
+
style 'Literal.Number', :fg => "#60E", :bold => true
|
46
|
+
style 'Literal.Number.Integer', :fg => "#00D", :bold => true
|
47
|
+
style 'Literal.Number.Float', :fg => "#60E", :bold => true
|
48
|
+
style 'Literal.Number.Hex', :fg => "#058", :bold => true
|
49
|
+
style 'Literal.Number.Oct', :fg => "#40E", :bold => true
|
50
|
+
|
51
|
+
style 'Generic.Heading', :fg => "#000080", :bold => true
|
52
|
+
style 'Generic.Subheading', :fg => "#800080", :bold => true
|
53
|
+
style 'Generic.Deleted', :fg => "#A00000"
|
54
|
+
style 'Generic.Inserted', :fg => "#00A000"
|
55
|
+
style 'Generic.Error', :fg => "#FF0000"
|
56
|
+
style 'Generic.Emph', :italic => true
|
57
|
+
style 'Generic.Strong', :bold => true
|
58
|
+
style 'Generic.Prompt', :fg => "#c65d09", :bold => true
|
59
|
+
style 'Generic.Output', :fg => "#888"
|
60
|
+
style 'Generic.Traceback', :fg => "#04D"
|
61
|
+
|
62
|
+
style 'Error', :fg => "#F00", :bg => "#FAA"
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
@@ -1,45 +1,47 @@
|
|
1
1
|
module Rouge
|
2
2
|
module Themes
|
3
3
|
class ThankfulEyes < CSSTheme
|
4
|
+
name 'thankful_eyes'
|
5
|
+
|
4
6
|
# pallette, from GTKSourceView's ThankfulEyes
|
5
|
-
cool_as_ice
|
6
|
-
slate_blue
|
7
|
-
eggshell_cloud
|
8
|
-
krasna
|
9
|
-
aluminum1
|
10
|
-
scarletred2
|
11
|
-
butter3
|
12
|
-
go_get_it
|
13
|
-
chilly
|
14
|
-
unicorn
|
15
|
-
sandy
|
16
|
-
pink_merengue
|
17
|
-
dune
|
18
|
-
backlit
|
19
|
-
schrill
|
7
|
+
palette :cool_as_ice => '#6c8b9f'
|
8
|
+
palette :slate_blue => '#4e5d62'
|
9
|
+
palette :eggshell_cloud => '#dee5e7'
|
10
|
+
palette :krasna => '#122b3b'
|
11
|
+
palette :aluminum1 => '#fefeec'
|
12
|
+
palette :scarletred2 => '#cc0000'
|
13
|
+
palette :butter3 => '#c4a000'
|
14
|
+
palette :go_get_it => '#b2fd6d'
|
15
|
+
palette :chilly => '#a8e1fe'
|
16
|
+
palette :unicorn => '#faf6e4'
|
17
|
+
palette :sandy => '#f6dd62'
|
18
|
+
palette :pink_merengue => '#f696db'
|
19
|
+
palette :dune => '#fff0a6'
|
20
|
+
palette :backlit => '#4df4ff'
|
21
|
+
palette :schrill => '#ffb000'
|
20
22
|
|
21
|
-
style 'Text', :fg => unicorn, :bg => krasna
|
23
|
+
style 'Text', :fg => :unicorn, :bg => :krasna
|
22
24
|
|
23
|
-
style 'Comment', :fg => cool_as_ice
|
25
|
+
style 'Comment', :fg => :cool_as_ice
|
24
26
|
style 'Error',
|
25
|
-
'Generic.Error', :fg => aluminum1, :bg => scarletred2
|
26
|
-
style 'Keyword', :fg => sandy, :bold => true
|
27
|
+
'Generic.Error', :fg => :aluminum1, :bg => :scarletred2
|
28
|
+
style 'Keyword', :fg => :sandy, :bold => true
|
27
29
|
style 'Operator',
|
28
|
-
'Punctuation', :fg => backlit, :bold => true
|
30
|
+
'Punctuation', :fg => :backlit, :bold => true
|
29
31
|
style 'Comment.Preproc',
|
30
32
|
'Comment.Multiline',
|
31
33
|
'Comment.Single',
|
32
|
-
'Comment.Special', :fg => cool_as_ice, :italic => true
|
33
|
-
style 'Generic.Deleted', :fg => scarletred2
|
34
|
-
style 'Generic.Inserted', :fg => go_get_it
|
34
|
+
'Comment.Special', :fg => :cool_as_ice, :italic => true
|
35
|
+
style 'Generic.Deleted', :fg => :scarletred2
|
36
|
+
style 'Generic.Inserted', :fg => :go_get_it
|
35
37
|
style 'Generic.Emph', :italic => true
|
36
38
|
style 'Generic.Subheading', :fg => '#800080', :bold => true
|
37
39
|
style 'Generic.Traceback', :fg => '#0040D0'
|
38
|
-
style 'Keyword.Constant', :fg => pink_merengue, :bold => true
|
40
|
+
style 'Keyword.Constant', :fg => :pink_merengue, :bold => true
|
39
41
|
style 'Keyword.Namespace',
|
40
42
|
'Keyword.Pseudo',
|
41
43
|
'Keyword.Reserved',
|
42
|
-
'Generic.Heading', :fg => schrill, :bold => true
|
44
|
+
'Generic.Heading', :fg => :schrill, :bold => true
|
43
45
|
style 'Keyword.Type',
|
44
46
|
'Name.Constant',
|
45
47
|
'Name.Class',
|
@@ -47,21 +49,21 @@ module Rouge
|
|
47
49
|
'Name.Namespace',
|
48
50
|
'Name.Builtin.Pseudo',
|
49
51
|
'Name.Exception',
|
50
|
-
'Name.Tag', :fg => go_get_it, :bold => true
|
51
|
-
style 'Literal.Number', :fg => pink_merengue, :bold => true
|
52
|
-
style 'Literal.String', :fg => dune, :bold => true
|
52
|
+
'Name.Tag', :fg => :go_get_it, :bold => true
|
53
|
+
style 'Literal.Number', :fg => :pink_merengue, :bold => true
|
54
|
+
style 'Literal.String', :fg => :dune, :bold => true
|
53
55
|
style 'Literal.String.Escape',
|
54
56
|
'Literal.String.Char',
|
55
57
|
'Literal.String.Interpol',
|
56
58
|
'Literal.String.Other',
|
57
|
-
'Literal.String.Symbol', :fg => backlit, :bold => true
|
58
|
-
style 'Name.Builtin', :fg => sandy
|
59
|
+
'Literal.String.Symbol', :fg => :backlit, :bold => true
|
60
|
+
style 'Name.Builtin', :fg => :sandy
|
59
61
|
style 'Name.Entity', :fg => '#999999', :bold => true
|
60
62
|
style 'Text.Whitespace', :fg => '#BBBBBB'
|
61
63
|
style 'Name.Variable',
|
62
64
|
'Name.Function',
|
63
65
|
'Name.Label',
|
64
|
-
'Name.Attribute', :fg => chilly
|
66
|
+
'Name.Attribute', :fg => :chilly
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
data/lib/rouge/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rouge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
|
15
15
|
email:
|
@@ -19,6 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- Gemfile
|
22
|
+
- lib/rouge/lexers/python.rb
|
22
23
|
- lib/rouge/lexers/shell.rb
|
23
24
|
- lib/rouge/lexers/javascript.rb
|
24
25
|
- lib/rouge/lexers/diff.rb
|
@@ -29,6 +30,7 @@ files:
|
|
29
30
|
- lib/rouge/plugins/redcarpet.rb
|
30
31
|
- lib/rouge/themes/thankful_eyes.rb
|
31
32
|
- lib/rouge/themes/colorful.rb
|
33
|
+
- lib/rouge/themes/base16.rb
|
32
34
|
- lib/rouge/token.rb
|
33
35
|
- lib/rouge/formatters/html.rb
|
34
36
|
- lib/rouge/version.rb
|