rouge 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,68 +6,143 @@ module Rouge
6
6
  class Github < CSSTheme
7
7
  name 'github'
8
8
 
9
- style Comment::Multiline, :fg => '#999988', :italic => true
10
- style Comment::Preproc, :fg => '#999999', :bold => true
11
- style Comment::Single, :fg => '#999988', :italic => true
12
- style Comment::Special, :fg => '#999999', :italic => true, :bold => true
13
- style Comment, :fg => '#999988', :italic => true
14
- style Error, :fg => '#a61717', :bg => '#e3d2d2'
15
- style Generic::Deleted, :fg => '#000000', :bg => '#ffdddd'
16
- style Generic::Emph, :fg => '#000000', :italic => true
17
- style Generic::Error, :fg => '#aa0000'
18
- style Generic::Heading, :fg => '#999999'
19
- style Generic::Inserted, :fg => '#000000', :bg => '#ddffdd'
20
- style Generic::Output, :fg => '#888888'
21
- style Generic::Prompt, :fg => '#555555'
22
- style Generic::Strong, :bold => true
23
- style Generic::Subheading, :fg => '#aaaaaa'
24
- style Generic::Traceback, :fg => '#aa0000'
25
- style Keyword::Constant, :fg => '#000000', :bold => true
26
- style Keyword::Declaration, :fg => '#000000', :bold => true
27
- style Keyword::Namespace, :fg => '#000000', :bold => true
28
- style Keyword::Pseudo, :fg => '#000000', :bold => true
29
- style Keyword::Reserved, :fg => '#000000', :bold => true
30
- style Keyword::Type, :fg => '#445588', :bold => true
31
- style Keyword, :fg => '#000000', :bold => true
32
- style Literal::Number::Float, :fg => '#009999'
33
- style Literal::Number::Hex, :fg => '#009999'
34
- style Literal::Number::Integer::Long, :fg => '#009999'
35
- style Literal::Number::Integer, :fg => '#009999'
36
- style Literal::Number::Oct, :fg => '#009999'
37
- style Literal::Number, :fg => '#009999'
38
- style Literal::String::Affix, :fg => '#000000', :bold => true
39
- style Literal::String::Backtick, :fg => '#d14'
40
- style Literal::String::Char, :fg => '#d14'
41
- style Literal::String::Doc, :fg => '#d14'
42
- style Literal::String::Double, :fg => '#d14'
43
- style Literal::String::Escape, :fg => '#d14'
44
- style Literal::String::Heredoc, :fg => '#d14'
45
- style Literal::String::Interpol, :fg => '#d14'
46
- style Literal::String::Other, :fg => '#d14'
47
- style Literal::String::Regex, :fg => '#009926'
48
- style Literal::String::Single, :fg => '#d14'
49
- style Literal::String::Symbol, :fg => '#990073'
50
- style Literal::String, :fg => '#d14'
51
- style Name::Attribute, :fg => '#008080'
52
- style Name::Builtin::Pseudo, :fg => '#999999'
53
- style Name::Builtin, :fg => '#0086B3'
54
- style Name::Class, :fg => '#445588', :bold => true
55
- style Name::Constant, :fg => '#008080'
56
- style Name::Decorator, :fg => '#3c5d5d', :bold => true
57
- style Name::Entity, :fg => '#800080'
58
- style Name::Exception, :fg => '#990000', :bold => true
59
- style Name::Function, :fg => '#990000', :bold => true
60
- style Name::Label, :fg => '#990000', :bold => true
61
- style Name::Namespace, :fg => '#555555'
62
- style Name::Tag, :fg => '#000080'
63
- style Name::Variable::Class, :fg => '#008080'
64
- style Name::Variable::Global, :fg => '#008080'
65
- style Name::Variable::Instance, :fg => '#008080'
66
- style Name::Variable, :fg => '#008080'
67
- style Operator::Word, :fg => '#000000', :bold => true
68
- style Operator, :fg => '#000000', :bold => true
69
- style Text::Whitespace, :fg => '#bbbbbb'
70
- style Text, :bg => '#f8f8f8'
9
+ # Primer primitives
10
+ # https://github.com/primer/primitives/tree/main/src/tokens
11
+ P_RED_0 = {:light => '#ffebe9', :dark => '#ffdcd7'}
12
+ P_RED_3 = {:dark => '#ff7b72'}
13
+ P_RED_5 = {:light => '#cf222e'}
14
+ P_RED_7 = {:light => '#82071e', :dark => '#8e1519'}
15
+ P_RED_8 = {:dark => '#67060c'}
16
+ P_ORANGE_2 = {:dark => '#ffa657'}
17
+ P_ORANGE_6 = {:light => '#953800'}
18
+ P_GREEN_0 = {:light => '#dafbe1', :dark => '#aff5b4'}
19
+ P_GREEN_1 = {:dark => '#7ee787'}
20
+ P_GREEN_6 = {:light => '#116329'}
21
+ P_GREEN_8 = {:dark => '#033a16'}
22
+ P_BLUE_1 = {:dark => '#a5d6ff'}
23
+ P_BLUE_2 = {:dark => '#79c0ff'}
24
+ P_BLUE_5 = {:dark => '#1f6feb'}
25
+ P_BLUE_6 = {:light => '#0550ae'}
26
+ P_BLUE_8 = {:light => '#0a3069'}
27
+ P_PURPLE_2 = {:dark => '#d2a8ff'}
28
+ P_PURPLE_5 = {:light => '#8250df'}
29
+ P_GRAY_0 = {:light => '#f6f8fa', :dark => '#f0f6fc'}
30
+ P_GRAY_1 = {:dark => '#c9d1d9'}
31
+ P_GRAY_3 = {:dark => '#8b949e'}
32
+ P_GRAY_5 = {:light => '#6e7781'}
33
+ P_GRAY_8 = {:dark => '#161b22'}
34
+ P_GRAY_9 = {:light => '#24292f'}
35
+
36
+ extend HasModes
37
+
38
+ def self.light!
39
+ mode :dark # indicate that there is a dark variant
40
+ mode! :light
41
+ end
42
+
43
+ def self.dark!
44
+ mode :light # indicate that there is a light variant
45
+ mode! :dark
46
+ end
47
+
48
+ def self.make_dark!
49
+ palette :comment => P_GRAY_3[@mode]
50
+ palette :constant => P_BLUE_2[@mode]
51
+ palette :entity => P_PURPLE_2[@mode]
52
+ palette :heading => P_BLUE_5[@mode]
53
+ palette :keyword => P_RED_3[@mode]
54
+ palette :string => P_BLUE_1[@mode]
55
+ palette :tag => P_GREEN_1[@mode]
56
+ palette :variable => P_ORANGE_2[@mode]
57
+
58
+ palette :fgDefault => P_GRAY_1[@mode]
59
+ palette :bgDefault => P_GRAY_8[@mode]
60
+
61
+ palette :fgInserted => P_GREEN_0[@mode]
62
+ palette :bgInserted => P_GREEN_8[@mode]
63
+
64
+ palette :fgDeleted => P_RED_0[@mode]
65
+ palette :bgDeleted => P_RED_8[@mode]
66
+
67
+ palette :fgError => P_GRAY_0[@mode]
68
+ palette :bgError => P_RED_7[@mode]
69
+ end
70
+
71
+ def self.make_light!
72
+ palette :comment => P_GRAY_5[@mode]
73
+ palette :constant => P_BLUE_6[@mode]
74
+ palette :entity => P_PURPLE_5[@mode]
75
+ palette :heading => P_BLUE_6[@mode]
76
+ palette :keyword => P_RED_5[@mode]
77
+ palette :string => P_BLUE_8[@mode]
78
+ palette :tag => P_GREEN_6[@mode]
79
+ palette :variable => P_ORANGE_6[@mode]
80
+
81
+ palette :fgDefault => P_GRAY_9[@mode]
82
+ palette :bgDefault => P_GRAY_0[@mode]
83
+
84
+ palette :fgInserted => P_GREEN_6[@mode]
85
+ palette :bgInserted => P_GREEN_0[@mode]
86
+
87
+ palette :fgDeleted => P_RED_7[@mode]
88
+ palette :bgDeleted => P_RED_0[@mode]
89
+
90
+ palette :fgError => P_GRAY_0[@mode]
91
+ palette :bgError => P_RED_7[@mode]
92
+ end
93
+
94
+ light!
95
+
96
+ style Text, :fg => :fgDefault, :bg => :bgDefault
97
+
98
+ style Keyword, :fg => :keyword
99
+
100
+ style Generic::Error, :fg => :fgError
101
+
102
+ style Generic::Deleted, :fg => :fgDeleted, :bg => :bgDeleted
103
+
104
+ style Name::Builtin,
105
+ Name::Class,
106
+ Name::Constant,
107
+ Name::Namespace, :fg => :variable
108
+
109
+ style Literal::String::Regex,
110
+ Name::Attribute,
111
+ Name::Tag, :fg => :tag
112
+
113
+ style Generic::Inserted, :fg => :fgInserted, :bg => :bgInserted
114
+
115
+ style Keyword::Constant,
116
+ Literal,
117
+ Literal::String::Backtick,
118
+ Name::Builtin::Pseudo,
119
+ Name::Exception,
120
+ Name::Label,
121
+ Name::Property,
122
+ Name::Variable,
123
+ Operator, :fg => :constant
124
+
125
+ style Generic::Heading,
126
+ Generic::Subheading, :fg => :heading, :bold => true
127
+
128
+ style Literal::String, :fg => :string
129
+
130
+ style Name::Decorator,
131
+ Name::Function, :fg => :entity
132
+
133
+ style Error, :fg => :fgError, :bg => :bgError
134
+
135
+ style Comment,
136
+ Generic::Lineno,
137
+ Generic::Traceback, :fg => :comment
138
+
139
+ style Name::Entity,
140
+ Literal::String::Interpol, :fg => :fgDefault
141
+
142
+ style Generic::Emph, :fg => :fgDefault, :italic => true
143
+
144
+ style Generic::Strong, :fg => :fgDefault, :bold => true
145
+
71
146
  end
72
147
  end
73
148
  end
data/lib/rouge/version.rb CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "4.0.0"
6
+ "4.1.0"
7
7
  end
8
8
  end
data/lib/rouge.rb CHANGED
@@ -47,11 +47,9 @@ module Rouge
47
47
  #
48
48
  # @api private
49
49
  def load_lexers
50
- # The trailing slash is necessary to avoid lexers being loaded multiple
51
- # times by `Lexers.load_lexer`
52
- lexer_dir = File.join(LIB_DIR, "rouge/lexers/")
53
- Dir.glob(File.join(lexer_dir, '*.rb')).each do |f|
54
- Lexers.load_lexer(f.sub(lexer_dir, ''))
50
+ lexer_dir = Pathname.new(LIB_DIR) / "rouge/lexers"
51
+ Pathname.glob(lexer_dir / '*.rb').each do |f|
52
+ Lexers.load_lexer(f.relative_path_from(lexer_dir))
55
53
  end
56
54
  end
57
55
  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.0.0
4
+ version: 4.1.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: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2023-02-12 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:
@@ -44,6 +44,7 @@ files:
44
44
  - lib/rouge/demos/c
45
45
  - lib/rouge/demos/ceylon
46
46
  - lib/rouge/demos/cfscript
47
+ - lib/rouge/demos/cisco_ios
47
48
  - lib/rouge/demos/clean
48
49
  - lib/rouge/demos/clojure
49
50
  - lib/rouge/demos/cmake
@@ -284,6 +285,7 @@ files:
284
285
  - lib/rouge/lexers/c.rb
285
286
  - lib/rouge/lexers/ceylon.rb
286
287
  - lib/rouge/lexers/cfscript.rb
288
+ - lib/rouge/lexers/cisco_ios.rb
287
289
  - lib/rouge/lexers/clean.rb
288
290
  - lib/rouge/lexers/clojure.rb
289
291
  - lib/rouge/lexers/cmake.rb