rouge 1.3.4 → 1.4.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/cli.rb +3 -0
- data/lib/rouge/formatters/html.rb +12 -10
- data/lib/rouge/themes/monokai.rb +73 -0
- data/lib/rouge/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7271e7e935f4e3a5e38187c5d53cd71578453f30
|
4
|
+
data.tar.gz: 1bd9cdf5744f515565f86602c0d6ac7b382d1afc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d8b40f7d369bab8e223ffa6cbea7742a707e849e9dc3f11a88eb30fd6c23accaf2b43a9176bdeae1cf671901fc61f9379897c220e0d0fc2ec124e2a851d07fe
|
7
|
+
data.tar.gz: 4a4541ed068a997755964649ed02d56e332609877f1282d4ded0e84073fb867ae14021470f9bf6e8740885f71ead3f8b551028dc0cfd80c1266c49b1d1f9a248
|
data/lib/rouge/cli.rb
CHANGED
@@ -272,6 +272,9 @@ module Rouge
|
|
272
272
|
yield %||
|
273
273
|
yield %|options:|
|
274
274
|
yield %| --scope (default: .highlight) a css selector to scope by|
|
275
|
+
yield %||
|
276
|
+
yield %|available themes:|
|
277
|
+
yield %| #{Theme.registry.keys.sort.join(', ')}|
|
275
278
|
end
|
276
279
|
|
277
280
|
def self.parse(argv)
|
@@ -23,8 +23,13 @@ module Rouge
|
|
23
23
|
# not) with the given `:css_class` unless `:wrap` is set to `false`.
|
24
24
|
def initialize(opts={})
|
25
25
|
@css_class = opts.fetch(:css_class, 'highlight')
|
26
|
+
@css_class = " class=#{@css_class.inspect}" if @css_class
|
27
|
+
|
26
28
|
@line_numbers = opts.fetch(:line_numbers, false)
|
29
|
+
@start_line = opts.fetch(:start_line, 1)
|
27
30
|
@inline_theme = opts.fetch(:inline_theme, nil)
|
31
|
+
@inline_theme = Theme.find(@inline_theme).new if @inline_theme.is_a? String
|
32
|
+
|
28
33
|
@wrap = opts.fetch(:wrap, true)
|
29
34
|
end
|
30
35
|
|
@@ -39,11 +44,9 @@ module Rouge
|
|
39
44
|
|
40
45
|
private
|
41
46
|
def stream_untableized(tokens, &b)
|
42
|
-
yield "<pre
|
43
|
-
tokens.each
|
44
|
-
|
45
|
-
end
|
46
|
-
yield "</pre>\n" if @wrap
|
47
|
+
yield "<pre><code#@css_class>" if @wrap
|
48
|
+
tokens.each{ |tok, val| span(tok, val, &b) }
|
49
|
+
yield "</code></pre>\n" if @wrap
|
47
50
|
end
|
48
51
|
|
49
52
|
def stream_tableized(tokens)
|
@@ -63,12 +66,11 @@ module Rouge
|
|
63
66
|
span(Token::Tokens::Text::Whitespace, "\n") { |str| formatted << str }
|
64
67
|
end
|
65
68
|
|
66
|
-
# generate a string of newline-separated line numbers for the gutter
|
67
|
-
numbers = num_lines
|
68
|
-
|
69
|
-
end.join
|
69
|
+
# generate a string of newline-separated line numbers for the gutter>
|
70
|
+
numbers = %<<pre class="lineno">#{(@start_line..num_lines+@start_line-1)
|
71
|
+
.to_a.join("\n")}</pre>>
|
70
72
|
|
71
|
-
yield "<div
|
73
|
+
yield "<div#@css_class>" if @wrap
|
72
74
|
yield '<table style="border-spacing: 0"><tbody><tr>'
|
73
75
|
|
74
76
|
# the "gl" class applies the style for Generic.Lineno
|
data/lib/rouge/themes/monokai.rb
CHANGED
@@ -19,6 +19,79 @@ module Rouge
|
|
19
19
|
palette :soft_yellow => '#e6db74'
|
20
20
|
palette :very_dark => '#1e0010'
|
21
21
|
palette :whitish => '#f8f8f2'
|
22
|
+
palette :orange => '#f6aa11'
|
23
|
+
palette :white => '#ffffff'
|
24
|
+
|
25
|
+
extend HasModes
|
26
|
+
|
27
|
+
def self.sublime!
|
28
|
+
mode! :sublime
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.make_sublime!
|
32
|
+
style Generic::Heading, :fg => :grey
|
33
|
+
style Literal::String::Regex, :fg => :orange
|
34
|
+
style Generic::Output, :fg => :dark_grey
|
35
|
+
style Generic::Prompt, :fg => :emperor
|
36
|
+
style Generic::Strong, :bold => false
|
37
|
+
style Generic::Subheading, :fg => :light_grey
|
38
|
+
style Name::Builtin, :fg => :orange
|
39
|
+
style Comment::Multiline,
|
40
|
+
Comment::Preproc,
|
41
|
+
Comment::Single,
|
42
|
+
Comment::Special,
|
43
|
+
Comment, :fg => :dimgrey
|
44
|
+
style Error,
|
45
|
+
Generic::Error,
|
46
|
+
Generic::Traceback, :fg => :carmine
|
47
|
+
style Generic::Deleted,
|
48
|
+
Generic::Inserted,
|
49
|
+
Generic::Emph, :fg => :dark
|
50
|
+
style Keyword::Constant,
|
51
|
+
Keyword::Declaration,
|
52
|
+
Keyword::Reserved,
|
53
|
+
Name::Constant,
|
54
|
+
Keyword::Type, :fg => :soft_cyan
|
55
|
+
style Literal::Number::Float,
|
56
|
+
Literal::Number::Hex,
|
57
|
+
Literal::Number::Integer::Long,
|
58
|
+
Literal::Number::Integer,
|
59
|
+
Literal::Number::Oct,
|
60
|
+
Literal::Number,
|
61
|
+
Literal::String::Char,
|
62
|
+
Literal::String::Escape,
|
63
|
+
Literal::String::Symbol, :fg => :light_violet
|
64
|
+
style Literal::String::Doc,
|
65
|
+
Literal::String::Double,
|
66
|
+
Literal::String::Backtick,
|
67
|
+
Literal::String::Heredoc,
|
68
|
+
Literal::String::Interpol,
|
69
|
+
Literal::String::Other,
|
70
|
+
Literal::String::Single,
|
71
|
+
Literal::String, :fg => :soft_yellow
|
72
|
+
style Name::Attribute,
|
73
|
+
Name::Class,
|
74
|
+
Name::Decorator,
|
75
|
+
Name::Exception,
|
76
|
+
Name::Function, :fg => :bright_green
|
77
|
+
style Name::Variable::Class,
|
78
|
+
Name::Namespace,
|
79
|
+
Name::Label,
|
80
|
+
Name::Entity,
|
81
|
+
Name::Builtin::Pseudo,
|
82
|
+
Name::Variable::Global,
|
83
|
+
Name::Variable::Instance,
|
84
|
+
Name::Variable,
|
85
|
+
Text::Whitespace,
|
86
|
+
Text,
|
87
|
+
Name, :fg => :white
|
88
|
+
style Operator::Word,
|
89
|
+
Name::Tag,
|
90
|
+
Keyword,
|
91
|
+
Keyword::Namespace,
|
92
|
+
Keyword::Pseudo,
|
93
|
+
Operator, :fg => :bright_pink
|
94
|
+
end
|
22
95
|
|
23
96
|
style Comment,
|
24
97
|
Comment::Multiline,
|
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.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Adkisson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-29 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:
|
@@ -199,9 +199,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
requirements: []
|
201
201
|
rubyforge_project: rouge
|
202
|
-
rubygems_version: 2.2.
|
202
|
+
rubygems_version: 2.2.0
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: A pure-ruby colorizer based on pygments
|
206
206
|
test_files: []
|
207
|
-
has_rdoc:
|