rouge 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,14 +28,6 @@ module Rouge
28
28
  start { @shell.reset! }
29
29
 
30
30
  state :root do
31
- rule /^(?:[\t ]+.*\n|\n)+/ do
32
- delegate @shell
33
- end
34
-
35
- # rule /\$\((?:.*\\\n|.*\n)+/ do
36
- # delegate Shell
37
- # end
38
-
39
31
  rule /\s+/, 'Text'
40
32
 
41
33
  rule /#.*?\n/, 'Comment'
@@ -93,8 +85,23 @@ module Rouge
93
85
  state :shell do
94
86
  # macro interpolation
95
87
  rule /\$\(\s*[a-z_]\w*\s*\)/i, 'Name.Variable'
96
- rule(/.+?(?=\$\(|\)|\n)/m) { delegate @shell }
97
- rule(/\$\(|\)|\n/) { delegate @shell }
88
+ # $(shell ...)
89
+ rule /(\$\()(\s*)(shell)(\s+)/m do
90
+ group 'Name.Function'; group 'Text'
91
+ group 'Name.Builtin'; group 'Text'
92
+ push :shell_expr
93
+ end
94
+
95
+ rule(/\\./m) { delegate @shell }
96
+ stop = /\$\(|\(|\)|\n|\\/
97
+ rule(/.+?(?=#{stop})/m) { delegate @shell }
98
+ rule(stop) { delegate @shell }
99
+ end
100
+
101
+ state :shell_expr do
102
+ rule(/\(/) { delegate @shell; push }
103
+ rule /\)/, 'Name.Variable', :pop!
104
+ mixin :shell
98
105
  end
99
106
 
100
107
  state :shell_line do
@@ -82,7 +82,7 @@ module Rouge
82
82
 
83
83
  rule /;/, 'Text'
84
84
  rule /\s+/, 'Text'
85
- rule /[^=\s{}()$"\'`\\<]+/, 'Text'
85
+ rule /[^=\*\s{}()$"\'`\\<]+/, 'Text'
86
86
  rule /\d+(?= |\Z)/, 'Number'
87
87
  rule /</, 'Text'
88
88
  mixin :interp
@@ -28,6 +28,13 @@ module Rouge
28
28
  Lexer.find(name)
29
29
  end || Lexers::Text
30
30
 
31
+ # XXX HACK: Redcarpet strips hard tabs out of code blocks,
32
+ # so we assume you're not using leading spaces that aren't tabs,
33
+ # and just replace them here.
34
+ if lexer_class.tag == 'make'
35
+ code.gsub! /^ /, "\t"
36
+ end
37
+
31
38
  lexer = lexer_class.new(opts)
32
39
  formatter = Formatters::HTML.new(:css_class => "highlight #{lexer_class.tag}")
33
40
 
@@ -1,5 +1,5 @@
1
1
  module Rouge
2
2
  def self.version
3
- "0.1.1"
3
+ "0.1.2"
4
4
  end
5
5
  end
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.1.1
4
+ version: 0.1.2
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-14 00:00:00.000000000 Z
12
+ date: 2012-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor