rouge 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rouge/lexers/make.rb +17 -10
- data/lib/rouge/lexers/shell.rb +1 -1
- data/lib/rouge/plugins/redcarpet.rb +7 -0
- data/lib/rouge/version.rb +1 -1
- metadata +2 -2
data/lib/rouge/lexers/make.rb
CHANGED
@@ -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
|
-
|
97
|
-
rule(
|
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
|
data/lib/rouge/lexers/shell.rb
CHANGED
@@ -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
|
|
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.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-
|
12
|
+
date: 2012-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|