rouge 1.11.0 → 1.11.1
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 +8 -0
- data/lib/rouge/cli.rb +3 -3
- data/lib/rouge/demos/cfscript +18 -0
- data/lib/rouge/demos/kotlin +3 -0
- data/lib/rouge/demos/pascal +14 -0
- data/lib/rouge/guesser.rb +46 -0
- data/lib/rouge/guessers/filename.rb +25 -0
- data/lib/rouge/guessers/glob_mapping.rb +46 -0
- data/lib/rouge/guessers/mimetype.rb +14 -0
- data/lib/rouge/guessers/modeline.rb +42 -0
- data/lib/rouge/guessers/source.rb +39 -0
- data/lib/rouge/lexer.rb +11 -85
- data/lib/rouge/lexers/cfscript.rb +153 -0
- data/lib/rouge/lexers/d.rb +1 -1
- data/lib/rouge/lexers/groovy.rb +8 -4
- data/lib/rouge/lexers/http.rb +3 -3
- data/lib/rouge/lexers/javascript.rb +16 -1
- data/lib/rouge/lexers/kotlin.rb +84 -0
- data/lib/rouge/lexers/pascal.rb +66 -0
- data/lib/rouge/lexers/praat.rb +107 -100
- data/lib/rouge/theme.rb +5 -5
- data/lib/rouge/themes/gruvbox.rb +167 -0
- data/lib/rouge/version.rb +1 -1
- metadata +15 -3
- data/lib/rouge/formatters/html_wrapper.rb +0 -11
data/lib/rouge/theme.rb
CHANGED
@@ -63,6 +63,8 @@ module Rouge
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
def palette(*a) self.class.palette(*a) end
|
67
|
+
|
66
68
|
@styles = {}
|
67
69
|
def self.styles
|
68
70
|
@styles ||= InheritableHash.new(superclass.styles)
|
@@ -76,8 +78,6 @@ module Rouge
|
|
76
78
|
def style(*tokens)
|
77
79
|
style = tokens.last.is_a?(Hash) ? tokens.pop : {}
|
78
80
|
|
79
|
-
style = Style.new(self, style)
|
80
|
-
|
81
81
|
tokens.each do |tok|
|
82
82
|
styles[tok] = style
|
83
83
|
end
|
@@ -85,7 +85,7 @@ module Rouge
|
|
85
85
|
|
86
86
|
def get_own_style(token)
|
87
87
|
token.token_chain.reverse_each do |anc|
|
88
|
-
return styles[anc] if styles[anc]
|
88
|
+
return Style.new(self, styles[anc]) if styles[anc]
|
89
89
|
end
|
90
90
|
|
91
91
|
nil
|
@@ -96,7 +96,7 @@ module Rouge
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def base_style
|
99
|
-
|
99
|
+
get_own_style(Token::Tokens::Text)
|
100
100
|
end
|
101
101
|
|
102
102
|
def name(n=nil)
|
@@ -150,7 +150,7 @@ module Rouge
|
|
150
150
|
yield "#{@scope} table pre { margin: 0; }"
|
151
151
|
|
152
152
|
styles.each do |tok, style|
|
153
|
-
style.render(css_selector(tok), &b)
|
153
|
+
Style.new(self, style).render(css_selector(tok), &b)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
# TODO how are we going to handle soft/hard contrast?
|
4
|
+
|
5
|
+
module Rouge
|
6
|
+
module Themes
|
7
|
+
# Based on https://github.com/morhetz/gruvbox, with help from
|
8
|
+
# https://github.com/daveyarwood/gruvbox-pygments
|
9
|
+
class Gruvbox < CSSTheme
|
10
|
+
name 'gruvbox'
|
11
|
+
|
12
|
+
# global Gruvbox colours {{{
|
13
|
+
C_dark0_hard = '#1d2021'
|
14
|
+
C_dark0 ='#282828'
|
15
|
+
C_dark0_soft = '#32302f'
|
16
|
+
C_dark1 = '#3c3836'
|
17
|
+
C_dark2 = '#504945'
|
18
|
+
C_dark3 = '#665c54'
|
19
|
+
C_dark4 = '#7c6f64'
|
20
|
+
C_dark4_256 = '#7c6f64'
|
21
|
+
|
22
|
+
C_gray_245 = '#928374'
|
23
|
+
C_gray_244 = '#928374'
|
24
|
+
|
25
|
+
C_light0_hard = '#f9f5d7'
|
26
|
+
C_light0 = '#fbf1c7'
|
27
|
+
C_light0_soft = '#f2e5bc'
|
28
|
+
C_light1 = '#ebdbb2'
|
29
|
+
C_light2 = '#d5c4a1'
|
30
|
+
C_light3 = '#bdae93'
|
31
|
+
C_light4 = '#a89984'
|
32
|
+
C_light4_256 = '#a89984'
|
33
|
+
|
34
|
+
C_bright_red = '#fb4934'
|
35
|
+
C_bright_green = '#b8bb26'
|
36
|
+
C_bright_yellow = '#fabd2f'
|
37
|
+
C_bright_blue = '#83a598'
|
38
|
+
C_bright_purple = '#d3869b'
|
39
|
+
C_bright_aqua = '#8ec07c'
|
40
|
+
C_bright_orange = '#fe8019'
|
41
|
+
|
42
|
+
C_neutral_red = '#cc241d'
|
43
|
+
C_neutral_green = '#98971a'
|
44
|
+
C_neutral_yellow = '#d79921'
|
45
|
+
C_neutral_blue = '#458588'
|
46
|
+
C_neutral_purple = '#b16286'
|
47
|
+
C_neutral_aqua = '#689d6a'
|
48
|
+
C_neutral_orange = '#d65d0e'
|
49
|
+
|
50
|
+
C_faded_red = '#9d0006'
|
51
|
+
C_faded_green = '#79740e'
|
52
|
+
C_faded_yellow = '#b57614'
|
53
|
+
C_faded_blue = '#076678'
|
54
|
+
C_faded_purple = '#8f3f71'
|
55
|
+
C_faded_aqua = '#427b58'
|
56
|
+
C_faded_orange = '#af3a03'
|
57
|
+
# }}}
|
58
|
+
|
59
|
+
extend HasModes
|
60
|
+
|
61
|
+
def self.light!
|
62
|
+
mode :dark # indicate that there is a dark variant
|
63
|
+
mode! :light
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.dark!
|
67
|
+
mode :light # indicate that there is a light variant
|
68
|
+
mode! :dark
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.make_dark!
|
72
|
+
palette bg0: C_dark0
|
73
|
+
palette bg1: C_dark1
|
74
|
+
palette bg2: C_dark2
|
75
|
+
palette bg3: C_dark3
|
76
|
+
palette bg4: C_dark4
|
77
|
+
|
78
|
+
palette gray: C_gray_245
|
79
|
+
|
80
|
+
palette fg0: C_light0
|
81
|
+
palette fg1: C_light1
|
82
|
+
palette fg2: C_light2
|
83
|
+
palette fg3: C_light3
|
84
|
+
palette fg4: C_light4
|
85
|
+
|
86
|
+
palette fg4_256: C_light4_256
|
87
|
+
|
88
|
+
palette red: C_bright_red
|
89
|
+
palette green: C_bright_green
|
90
|
+
palette yellow: C_bright_yellow
|
91
|
+
palette blue: C_bright_blue
|
92
|
+
palette purple: C_bright_purple
|
93
|
+
palette aqua: C_bright_aqua
|
94
|
+
palette orange: C_bright_orange
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.make_light!
|
99
|
+
palette bg0: C_light0
|
100
|
+
palette bg1: C_light1
|
101
|
+
palette bg2: C_light2
|
102
|
+
palette bg3: C_light3
|
103
|
+
palette bg4: C_light4
|
104
|
+
|
105
|
+
palette gray: C_gray_244
|
106
|
+
|
107
|
+
palette fg0: C_dark0
|
108
|
+
palette fg1: C_dark1
|
109
|
+
palette fg2: C_dark2
|
110
|
+
palette fg3: C_dark3
|
111
|
+
palette fg4: C_dark4
|
112
|
+
|
113
|
+
palette fg4_256: C_dark4_256
|
114
|
+
|
115
|
+
palette red: C_faded_red
|
116
|
+
palette green: C_faded_green
|
117
|
+
palette yellow: C_faded_yellow
|
118
|
+
palette blue: C_faded_blue
|
119
|
+
palette purple: C_faded_purple
|
120
|
+
palette aqua: C_faded_aqua
|
121
|
+
palette orange: C_faded_orange
|
122
|
+
end
|
123
|
+
|
124
|
+
dark!
|
125
|
+
mode :light
|
126
|
+
|
127
|
+
style Text, :fg => :fg0, :bg => :bg0
|
128
|
+
style Error, :fg => :red, :bg => :bg0, :bold => true
|
129
|
+
style Comment, :fg => :gray, :italic => true
|
130
|
+
|
131
|
+
style Comment::Preproc, :fg => :aqua
|
132
|
+
|
133
|
+
style Name::Tag, :fg => :red
|
134
|
+
|
135
|
+
style Operator,
|
136
|
+
Punctuation, :fg => :fg0
|
137
|
+
|
138
|
+
style Generic::Inserted, :fg => :green, :bg => :bg0
|
139
|
+
style Generic::Deleted, :fg => :red, :bg => :bg0
|
140
|
+
style Generic::Heading, :fg => :green, :bold => true
|
141
|
+
|
142
|
+
style Keyword, :fg => :red
|
143
|
+
style Keyword::Constant, :fg => :purple
|
144
|
+
style Keyword::Type, :fg => :yellow
|
145
|
+
|
146
|
+
style Keyword::Declaration, :fg => :orange
|
147
|
+
|
148
|
+
style Literal::String,
|
149
|
+
Literal::String::Interpol,
|
150
|
+
Literal::String::Regex, :fg => :green, :italic => true
|
151
|
+
|
152
|
+
style Literal::String::Escape, :fg => :orange
|
153
|
+
|
154
|
+
style Name::Namespace,
|
155
|
+
Name::Class, :fg => :aqua
|
156
|
+
|
157
|
+
style Name::Constant, :fg => :purple
|
158
|
+
|
159
|
+
style Name::Attribute, :fg => :green
|
160
|
+
|
161
|
+
style Literal::Number, :fg => :purple
|
162
|
+
|
163
|
+
style Literal::String::Symbol, :fg => :blue
|
164
|
+
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
data/lib/rouge/version.rb
CHANGED
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: 1.11.
|
4
|
+
version: 1.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeanine Adkisson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-14 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:
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- lib/rouge/demos/biml
|
31
31
|
- lib/rouge/demos/c
|
32
32
|
- lib/rouge/demos/ceylon
|
33
|
+
- lib/rouge/demos/cfscript
|
33
34
|
- lib/rouge/demos/clojure
|
34
35
|
- lib/rouge/demos/cmake
|
35
36
|
- lib/rouge/demos/coffeescript
|
@@ -67,6 +68,7 @@ files:
|
|
67
68
|
- lib/rouge/demos/json-doc
|
68
69
|
- lib/rouge/demos/jsonnet
|
69
70
|
- lib/rouge/demos/julia
|
71
|
+
- lib/rouge/demos/kotlin
|
70
72
|
- lib/rouge/demos/liquid
|
71
73
|
- lib/rouge/demos/literate_coffeescript
|
72
74
|
- lib/rouge/demos/literate_haskell
|
@@ -81,6 +83,7 @@ files:
|
|
81
83
|
- lib/rouge/demos/nim
|
82
84
|
- lib/rouge/demos/objective_c
|
83
85
|
- lib/rouge/demos/ocaml
|
86
|
+
- lib/rouge/demos/pascal
|
84
87
|
- lib/rouge/demos/perl
|
85
88
|
- lib/rouge/demos/php
|
86
89
|
- lib/rouge/demos/plaintext
|
@@ -123,9 +126,14 @@ files:
|
|
123
126
|
- lib/rouge/demos/yaml
|
124
127
|
- lib/rouge/formatter.rb
|
125
128
|
- lib/rouge/formatters/html.rb
|
126
|
-
- lib/rouge/formatters/html_wrapper.rb
|
127
129
|
- lib/rouge/formatters/null.rb
|
128
130
|
- lib/rouge/formatters/terminal256.rb
|
131
|
+
- lib/rouge/guesser.rb
|
132
|
+
- lib/rouge/guessers/filename.rb
|
133
|
+
- lib/rouge/guessers/glob_mapping.rb
|
134
|
+
- lib/rouge/guessers/mimetype.rb
|
135
|
+
- lib/rouge/guessers/modeline.rb
|
136
|
+
- lib/rouge/guessers/source.rb
|
129
137
|
- lib/rouge/lexer.rb
|
130
138
|
- lib/rouge/lexers/actionscript.rb
|
131
139
|
- lib/rouge/lexers/apache.rb
|
@@ -135,6 +143,7 @@ files:
|
|
135
143
|
- lib/rouge/lexers/biml.rb
|
136
144
|
- lib/rouge/lexers/c.rb
|
137
145
|
- lib/rouge/lexers/ceylon.rb
|
146
|
+
- lib/rouge/lexers/cfscript.rb
|
138
147
|
- lib/rouge/lexers/clojure.rb
|
139
148
|
- lib/rouge/lexers/cmake.rb
|
140
149
|
- lib/rouge/lexers/coffeescript.rb
|
@@ -171,6 +180,7 @@ files:
|
|
171
180
|
- lib/rouge/lexers/jinja.rb
|
172
181
|
- lib/rouge/lexers/jsonnet.rb
|
173
182
|
- lib/rouge/lexers/julia.rb
|
183
|
+
- lib/rouge/lexers/kotlin.rb
|
174
184
|
- lib/rouge/lexers/liquid.rb
|
175
185
|
- lib/rouge/lexers/literate_coffeescript.rb
|
176
186
|
- lib/rouge/lexers/literate_haskell.rb
|
@@ -187,6 +197,7 @@ files:
|
|
187
197
|
- lib/rouge/lexers/nim.rb
|
188
198
|
- lib/rouge/lexers/objective_c.rb
|
189
199
|
- lib/rouge/lexers/ocaml.rb
|
200
|
+
- lib/rouge/lexers/pascal.rb
|
190
201
|
- lib/rouge/lexers/perl.rb
|
191
202
|
- lib/rouge/lexers/php.rb
|
192
203
|
- lib/rouge/lexers/php/builtins.rb
|
@@ -238,6 +249,7 @@ files:
|
|
238
249
|
- lib/rouge/themes/base16.rb
|
239
250
|
- lib/rouge/themes/colorful.rb
|
240
251
|
- lib/rouge/themes/github.rb
|
252
|
+
- lib/rouge/themes/gruvbox.rb
|
241
253
|
- lib/rouge/themes/molokai.rb
|
242
254
|
- lib/rouge/themes/monokai.rb
|
243
255
|
- lib/rouge/themes/monokai_sublime.rb
|