rouge 3.5.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rouge.rb +1 -0
- data/lib/rouge/cli.rb +19 -11
- data/lib/rouge/demos/openedge +4 -0
- data/lib/rouge/demos/powershell +12 -48
- data/lib/rouge/demos/xojo +2 -1
- data/lib/rouge/demos/xpath +2 -0
- data/lib/rouge/demos/xquery +22 -0
- data/lib/rouge/formatters/html.rb +18 -2
- data/lib/rouge/formatters/html_line_table.rb +51 -0
- data/lib/rouge/guessers/modeline.rb +1 -1
- data/lib/rouge/lexers/apache.rb +1 -1
- data/lib/rouge/lexers/bpf.rb +12 -12
- data/lib/rouge/lexers/ceylon.rb +5 -5
- data/lib/rouge/lexers/docker.rb +2 -2
- data/lib/rouge/lexers/elixir.rb +5 -2
- data/lib/rouge/lexers/elm.rb +1 -1
- data/lib/rouge/lexers/fsharp.rb +4 -4
- data/lib/rouge/lexers/glsl.rb +1 -1
- data/lib/rouge/lexers/http.rb +1 -1
- data/lib/rouge/lexers/idlang.rb +1 -1
- data/lib/rouge/lexers/json.rb +1 -1
- data/lib/rouge/lexers/jsp.rb +3 -3
- data/lib/rouge/lexers/liquid.rb +23 -0
- data/lib/rouge/lexers/magik.rb +2 -1
- data/lib/rouge/lexers/make.rb +5 -4
- data/lib/rouge/lexers/mosel.rb +43 -43
- data/lib/rouge/lexers/nim.rb +2 -1
- data/lib/rouge/lexers/nix.rb +1 -1
- data/lib/rouge/lexers/openedge.rb +429 -0
- data/lib/rouge/lexers/perl.rb +12 -14
- data/lib/rouge/lexers/powershell.rb +181 -635
- data/lib/rouge/lexers/ruby.rb +2 -2
- data/lib/rouge/lexers/scala.rb +1 -1
- data/lib/rouge/lexers/shell.rb +1 -1
- data/lib/rouge/lexers/swift.rb +4 -4
- data/lib/rouge/lexers/tex.rb +1 -1
- data/lib/rouge/lexers/toml.rb +1 -1
- data/lib/rouge/lexers/vala.rb +1 -1
- data/lib/rouge/lexers/vhdl.rb +1 -1
- data/lib/rouge/lexers/wollok.rb +1 -1
- data/lib/rouge/lexers/xml.rb +1 -1
- data/lib/rouge/lexers/xojo.rb +4 -4
- data/lib/rouge/lexers/xpath.rb +332 -0
- data/lib/rouge/lexers/xquery.rb +145 -0
- data/lib/rouge/lexers/yaml.rb +5 -3
- data/lib/rouge/regex_lexer.rb +14 -13
- data/lib/rouge/tex_theme_renderer.rb +2 -2
- data/lib/rouge/themes/monokai_sublime.rb +2 -1
- data/lib/rouge/themes/pastie.rb +1 -1
- data/lib/rouge/util.rb +2 -2
- data/lib/rouge/version.rb +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0978a751e99189848662ab1f4d6b3763ff4ffc6bafa51d53f74a5f7d085492f5'
|
4
|
+
data.tar.gz: 06b154a4db8264d688c8a279c04ca6d82f8f188ae184b75a4b75df8726af3b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1296057ef9206c038ba0da5a2c06e7e9658c95ece00bc98e8b5e22d53865930fd132ea5c3bbb9eaf6d1590c38b4680e9a83e5a7101e6a4ad5aab1be4910f01d2
|
7
|
+
data.tar.gz: 34acb9f469772310659845294d8fd3adfe989102cc6533a9632e64f41f1f20ad42f2e3951a0377ce8380b83b3a886178829c70868df987eb7f16f02b5f131272
|
data/lib/rouge.rb
CHANGED
@@ -69,6 +69,7 @@ load_relative 'rouge/formatters/html_table'
|
|
69
69
|
load_relative 'rouge/formatters/html_pygments'
|
70
70
|
load_relative 'rouge/formatters/html_legacy'
|
71
71
|
load_relative 'rouge/formatters/html_linewise'
|
72
|
+
load_relative 'rouge/formatters/html_line_table'
|
72
73
|
load_relative 'rouge/formatters/html_inline'
|
73
74
|
load_relative 'rouge/formatters/terminal256'
|
74
75
|
load_relative 'rouge/formatters/tex'
|
data/lib/rouge/cli.rb
CHANGED
@@ -38,7 +38,7 @@ module Rouge
|
|
38
38
|
def self.doc
|
39
39
|
return enum_for(:doc) unless block_given?
|
40
40
|
|
41
|
-
yield %|usage: rougify [command] [args...]|
|
41
|
+
yield %|usage: rougify {global options} [command] [args...]|
|
42
42
|
yield %||
|
43
43
|
yield %|where <command> is one of:|
|
44
44
|
yield %| highlight #{Highlight.desc}|
|
@@ -48,6 +48,9 @@ module Rouge
|
|
48
48
|
yield %| guess #{Guess.desc}|
|
49
49
|
yield %| version #{Version.desc}|
|
50
50
|
yield %||
|
51
|
+
yield %|global options:|
|
52
|
+
yield %[ --require|-r <fname> require <fname> after loading rouge]
|
53
|
+
yield %||
|
51
54
|
yield %|See `rougify help <command>` for more info.|
|
52
55
|
end
|
53
56
|
|
@@ -62,18 +65,22 @@ module Rouge
|
|
62
65
|
def self.parse(argv=ARGV)
|
63
66
|
argv = normalize_syntax(argv)
|
64
67
|
|
65
|
-
|
68
|
+
while (head = argv.shift)
|
69
|
+
case head
|
70
|
+
when '-h', '--help', 'help', '-help'
|
71
|
+
return Help.parse(argv)
|
72
|
+
when '--require', '-r'
|
73
|
+
require argv.shift
|
74
|
+
else
|
75
|
+
break
|
76
|
+
end
|
77
|
+
end
|
66
78
|
|
67
|
-
klass = class_from_arg(
|
79
|
+
klass = class_from_arg(head)
|
68
80
|
return klass.parse(argv) if klass
|
69
81
|
|
70
|
-
|
71
|
-
|
72
|
-
Help.parse(argv)
|
73
|
-
else
|
74
|
-
argv.unshift(mode) if mode
|
75
|
-
Highlight.parse(argv)
|
76
|
-
end
|
82
|
+
argv.unshift(head) if head
|
83
|
+
Highlight.parse(argv)
|
77
84
|
end
|
78
85
|
|
79
86
|
def initialize(options={})
|
@@ -91,7 +98,7 @@ module Rouge
|
|
91
98
|
case arg
|
92
99
|
when 'version', '--version', '-v'
|
93
100
|
Version
|
94
|
-
when 'help'
|
101
|
+
when 'help', nil
|
95
102
|
Help
|
96
103
|
when 'highlight', 'hi'
|
97
104
|
Highlight
|
@@ -297,6 +304,7 @@ module Rouge
|
|
297
304
|
when 'html' then Formatters::HTML.new
|
298
305
|
when 'html-pygments' then Formatters::HTMLPygments.new(Formatters::HTML.new, opts[:css_class])
|
299
306
|
when 'html-inline' then Formatters::HTMLInline.new(theme)
|
307
|
+
when 'html-line-table' then Formatters::HTMLLineTable.new(Formatters::HTML.new)
|
300
308
|
when 'html-table' then Formatters::HTMLTable.new(Formatters::HTML.new)
|
301
309
|
when 'null', 'raw', 'tokens' then Formatters::Null.new
|
302
310
|
when 'tex' then Formatters::Tex.new
|
data/lib/rouge/demos/powershell
CHANGED
@@ -1,49 +1,13 @@
|
|
1
|
-
|
2
|
-
<#
|
3
|
-
.SYNOPSIS
|
4
|
-
Read IPv4Scopes from an array of servers
|
5
|
-
.PARAMETER Servers
|
6
|
-
Specifies an array of servers
|
7
|
-
.EXAMPLE
|
8
|
-
Get-IPv4Scopes
|
9
|
-
|
10
|
-
Will prompt for all inputs
|
11
|
-
#>
|
1
|
+
function Verb-Noun
|
12
2
|
{
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
[parameter(Mandatory=$false,ValueFromPipeline=$false)]
|
25
|
-
[bool]$Unique=$false
|
26
|
-
) #EndParam
|
27
|
-
|
28
|
-
Begin {}
|
29
|
-
|
30
|
-
Process {
|
31
|
-
$arrayJobs=@()
|
32
|
-
foreach ($server in $Servers) {
|
33
|
-
$arrayJobs+=Invoke-Command -ComputerName $server -scriptblock {Get-DhcpServerv4Scope} -AsJob
|
34
|
-
}
|
35
|
-
$complete=$false
|
36
|
-
while (-not $complete) {
|
37
|
-
$arrayJobsInProgress= $arrayJobs | Where-Object { $_.State -match 'running' }
|
38
|
-
if (-not $arrayJobsInProgress) { $complete=$true }
|
39
|
-
}
|
40
|
-
$Scopes=$arrayJobs|Receive-Job
|
41
|
-
$UniqueScopes=$Scopes|Sort-Object -Property ScopeId -Unique
|
42
|
-
}
|
43
|
-
|
44
|
-
End {
|
45
|
-
if ($Unique) { return $UniqueScopes }
|
46
|
-
else { return $Scopes }
|
47
|
-
}
|
48
|
-
|
49
|
-
} #end function
|
3
|
+
<#
|
4
|
+
.SYNOPSIS
|
5
|
+
Tells you what it does
|
6
|
+
|
7
|
+
.DESCRIPTION
|
8
|
+
Tells you what it does with more detail.
|
9
|
+
#>
|
10
|
+
param ([string]$Name, [string]$Extension = "txt", [string]$foo="bar")
|
11
|
+
$name = $name + "." + $extension
|
12
|
+
$name
|
13
|
+
}
|
data/lib/rouge/demos/xojo
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Dim f As FolderItem
|
2
2
|
f = GetOpenFolderItem(FileTypes1.jpeg) // defined in the File Type Set editor
|
3
|
+
rem - we should check for nil!
|
3
4
|
If not f.Exists Then
|
4
|
-
Beep
|
5
|
+
Beep 'Just for fun
|
5
6
|
MsgBox("The file " + f.NativePath + "doesn't ""exist.""")
|
6
7
|
Else // document exists
|
7
8
|
ImageWell1.image=Picture.Open(f)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
declare namespace html = "http://www.w3.org/1999/xhtml";
|
2
|
+
|
3
|
+
declare function local:test-function($catalog as document-node()) {
|
4
|
+
<html>
|
5
|
+
<head>
|
6
|
+
<title>XQuery example for the Rouge highlighter</title>
|
7
|
+
<link href="style.css"/>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h1>List</h1>
|
11
|
+
<ul>
|
12
|
+
{for $product in $catalog/items/product[@sell-by > current-date()] return
|
13
|
+
<li>
|
14
|
+
<ul>
|
15
|
+
<li>{data($product/name)}</li>
|
16
|
+
<li>{$product/price * (1 + $product/tax)}$</li>
|
17
|
+
</ul>
|
18
|
+
</li>}
|
19
|
+
</ul>
|
20
|
+
</body>
|
21
|
+
</html>
|
22
|
+
};
|
@@ -15,7 +15,7 @@ module Rouge
|
|
15
15
|
def span(tok, val)
|
16
16
|
return val if escape?(tok)
|
17
17
|
|
18
|
-
safe_span(tok, val
|
18
|
+
safe_span(tok, escape_special_html_chars(val))
|
19
19
|
end
|
20
20
|
|
21
21
|
def safe_span(tok, safe_val)
|
@@ -29,12 +29,28 @@ module Rouge
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
32
|
TABLE_FOR_ESCAPE_HTML = {
|
34
33
|
'&' => '&',
|
35
34
|
'<' => '<',
|
36
35
|
'>' => '>',
|
37
36
|
}
|
37
|
+
|
38
|
+
private
|
39
|
+
# A performance-oriented helper method to escape `&`, `<` and `>` for the rendered
|
40
|
+
# HTML from this formatter.
|
41
|
+
#
|
42
|
+
# `String#gsub` will always return a new string instance irrespective of whether
|
43
|
+
# a substitution occurs. This method however invokes `String#gsub` only if
|
44
|
+
# a substitution is imminent.
|
45
|
+
#
|
46
|
+
# Returns either the given `value` argument string as is or a new string with the
|
47
|
+
# special characters replaced with their escaped counterparts.
|
48
|
+
def escape_special_html_chars(value)
|
49
|
+
escape_regex = /[&<>]/
|
50
|
+
return value unless value =~ escape_regex
|
51
|
+
|
52
|
+
value.gsub(escape_regex, TABLE_FOR_ESCAPE_HTML)
|
53
|
+
end
|
38
54
|
end
|
39
55
|
end
|
40
56
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Formatters
|
6
|
+
class HTMLLineTable < Formatter
|
7
|
+
tag 'html_line_table'
|
8
|
+
|
9
|
+
# @param [Rouge::Formatters::Formatter] formatter An instance of a
|
10
|
+
# `Rouge::Formatters::HTML` or `Rouge::Formatters::HTMLInline`
|
11
|
+
# @param [Hash] opts options for HTMLLineTable instance.
|
12
|
+
# @option opts [Integer] :start_line line number to start from. Defaults to `1`.
|
13
|
+
# @option opts [String] :table_class Class name for the table.
|
14
|
+
# Defaults to `"rouge-line-table"`.
|
15
|
+
# @option opts [String] :line_id a `sprintf` template for generating an `id`
|
16
|
+
# attribute for each table row corresponding to current line number.
|
17
|
+
# Defaults to `"line-%i"`.
|
18
|
+
# @option opts [String] :line_class Class name for each table row.
|
19
|
+
# Defaults to `"lineno"`.
|
20
|
+
# @option opts [String] :gutter_class Class name for rendered line-number cell.
|
21
|
+
# Defaults to `"rouge-gutter"`.
|
22
|
+
# @option opts [String] :code_class Class name for rendered code cell.
|
23
|
+
# Defaults to `"rouge-code"`.
|
24
|
+
def initialize(formatter, opts={})
|
25
|
+
@formatter = formatter
|
26
|
+
@start_line = opts.fetch :start_line, 1
|
27
|
+
@table_class = opts.fetch :table_class, 'rouge-line-table'
|
28
|
+
@gutter_class = opts.fetch :gutter_class, 'rouge-gutter'
|
29
|
+
@code_class = opts.fetch :code_class, 'rouge-code'
|
30
|
+
@line_class = opts.fetch :line_class, 'lineno'
|
31
|
+
@line_id = opts.fetch :line_id, 'line-%i'
|
32
|
+
end
|
33
|
+
|
34
|
+
def stream(tokens, &b)
|
35
|
+
lineno = @start_line - 1
|
36
|
+
buffer = [%(<table class="#@table_class"><tbody>)]
|
37
|
+
token_lines(tokens) do |line_tokens|
|
38
|
+
lineno += 1
|
39
|
+
buffer << %(<tr id="#{sprintf @line_id, lineno}" class="#@line_class">)
|
40
|
+
buffer << %(<td class="#@gutter_class gl">)
|
41
|
+
buffer << %(<pre>#{lineno}</pre></td>)
|
42
|
+
buffer << %(<td class="#@code_class"><pre>)
|
43
|
+
@formatter.stream(line_tokens) { |formatted| buffer << formatted }
|
44
|
+
buffer << "\n</pre></td></tr>"
|
45
|
+
end
|
46
|
+
buffer << %(</tbody></table>)
|
47
|
+
yield buffer.join
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -37,7 +37,7 @@ module Rouge
|
|
37
37
|
|
38
38
|
matches = MODELINES.map { |re| re.match(search_space) }.compact
|
39
39
|
return lexers unless matches.any?
|
40
|
-
|
40
|
+
|
41
41
|
match_set = Set.new(matches.map { |m| m[1] })
|
42
42
|
lexers.select { |l| match_set.include?(l.tag) || l.aliases.any? { |a| match_set.include?(a) } }
|
43
43
|
end
|
data/lib/rouge/lexers/apache.rb
CHANGED
data/lib/rouge/lexers/bpf.rb
CHANGED
@@ -18,25 +18,25 @@ module Rouge
|
|
18
18
|
|
19
19
|
state :root do
|
20
20
|
# Calls to helpers
|
21
|
-
rule %r/(call)(\s+)(\d+)/i do
|
21
|
+
rule %r/(call)(\s+)(\d+)/i do
|
22
22
|
groups Keyword, Text::Whitespace, Literal::Number::Integer
|
23
23
|
end
|
24
24
|
|
25
25
|
# Unconditional jumps
|
26
|
-
rule %r/(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
26
|
+
rule %r/(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
27
27
|
groups Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
28
28
|
end
|
29
29
|
|
30
30
|
# Conditional jumps
|
31
|
-
rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
31
|
+
rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
32
32
|
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
33
33
|
end
|
34
|
-
rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(r\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
34
|
+
rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(r\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
|
35
35
|
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Name, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
36
36
|
end
|
37
37
|
|
38
38
|
# Dereferences
|
39
|
-
rule %r/(\*)(\s*)(\()(#{TYPE_KEYWORDS})(\s*)(\*)(\))/i do
|
39
|
+
rule %r/(\*)(\s*)(\()(#{TYPE_KEYWORDS})(\s*)(\*)(\))/i do
|
40
40
|
groups Operator, Text::Whitespace, Punctuation, Keyword::Type, Text::Whitespace, Operator, Punctuation
|
41
41
|
push :address
|
42
42
|
end
|
@@ -45,7 +45,7 @@ module Rouge
|
|
45
45
|
rule %r/[+-\/\*&|><^s]{0,3}=/i, Operator
|
46
46
|
|
47
47
|
# Registers
|
48
|
-
rule %r/([+-]?)(r\d+)/i do
|
48
|
+
rule %r/([+-]?)(r\d+)/i do
|
49
49
|
groups Punctuation, Name
|
50
50
|
end
|
51
51
|
|
@@ -56,15 +56,15 @@ module Rouge
|
|
56
56
|
rule %r/#{MISC_KEYWORDS}/i, Keyword
|
57
57
|
|
58
58
|
# Literals and global objects (maps) refered by name
|
59
|
-
rule %r/(0x\h+|[-]?\d+)(\s*)(ll)?/i do
|
59
|
+
rule %r/(0x\h+|[-]?\d+)(\s*)(ll)?/i do
|
60
60
|
groups Literal::Number, Text::Whitespace, Keyword::Type
|
61
61
|
end
|
62
|
-
rule %r/(\w+)(\s*)(ll)/i do
|
62
|
+
rule %r/(\w+)(\s*)(ll)/i do
|
63
63
|
groups Name, Text::Whitespace, Keyword::Type
|
64
64
|
end
|
65
65
|
|
66
66
|
# Labels
|
67
|
-
rule %r/(\w+)(\s*)(:)/i do
|
67
|
+
rule %r/(\w+)(\s*)(:)/i do
|
68
68
|
groups Name::Label, Text::Whitespace, Punctuation
|
69
69
|
end
|
70
70
|
|
@@ -73,17 +73,17 @@ module Rouge
|
|
73
73
|
|
74
74
|
state :address do
|
75
75
|
# Address is offset from register
|
76
|
-
rule %r/(\()(r\d+)(\s*)([+-])(\s*)(\d+)(\))/i do
|
76
|
+
rule %r/(\()(r\d+)(\s*)([+-])(\s*)(\d+)(\))/i do
|
77
77
|
groups Punctuation, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number::Integer, Punctuation
|
78
78
|
pop!
|
79
79
|
end
|
80
80
|
|
81
81
|
# Address is array subscript
|
82
|
-
rule %r/(\w+)(\[)(\d+)(\])/i do
|
82
|
+
rule %r/(\w+)(\[)(\d+)(\])/i do
|
83
83
|
groups Name, Punctuation, Literal::Number::Integer, Punctuation
|
84
84
|
pop!
|
85
85
|
end
|
86
|
-
rule %r/(\w+)(\[)(r\d+)(\])/i do
|
86
|
+
rule %r/(\w+)(\[)(r\d+)(\])/i do
|
87
87
|
groups Name, Punctuation, Name, Punctuation
|
88
88
|
pop!
|
89
89
|
end
|
data/lib/rouge/lexers/ceylon.rb
CHANGED
@@ -31,14 +31,14 @@ module Rouge
|
|
31
31
|
rule %r((abstracts|extends|satisfies|super|given|of|out|assign)\b), Keyword::Declaration
|
32
32
|
|
33
33
|
rule %r((function|value|void|new)\b), Keyword::Type
|
34
|
-
|
34
|
+
|
35
35
|
rule %r((assembly|module|package)(\s+)) do
|
36
36
|
groups Keyword::Namespace, Text
|
37
37
|
push :import
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
rule %r((true|false|null)\b), Keyword::Constant
|
41
|
-
|
41
|
+
|
42
42
|
rule %r((class|interface|object|alias)(\s+)) do
|
43
43
|
groups Keyword::Declaration, Text
|
44
44
|
push :class
|
@@ -48,7 +48,7 @@ module Rouge
|
|
48
48
|
groups Keyword::Namespace, Text
|
49
49
|
push :import
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
rule %r("(\\\\|\\"|[^"])*"), Literal::String
|
53
53
|
rule %r('\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'), Literal::String::Char
|
54
54
|
rule %r(".*``.*``.*"', String::Interpol
|
@@ -84,7 +84,7 @@ module Rouge
|
|
84
84
|
rule %r([a-z][\w.]*), Name::Namespace, :pop!
|
85
85
|
rule %r("(\\\\|\\"|[^"])*"), Literal::String, :pop!
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
state :comment do
|
89
89
|
rule %r([^*/]), Comment.Multiline
|
90
90
|
rule %r(/\*), Comment::Multiline, :push!
|
data/lib/rouge/lexers/docker.rb
CHANGED
@@ -20,11 +20,11 @@ module Rouge
|
|
20
20
|
state :root do
|
21
21
|
rule %r/\s+/, Text
|
22
22
|
|
23
|
-
rule %r/^(ONBUILD)(\s+)(#{KEYWORDS})(.*)/io do
|
23
|
+
rule %r/^(ONBUILD)(\s+)(#{KEYWORDS})(.*)/io do
|
24
24
|
groups Keyword, Text::Whitespace, Keyword, Str
|
25
25
|
end
|
26
26
|
|
27
|
-
rule %r/^(#{KEYWORDS})\b(.*)/io do
|
27
|
+
rule %r/^(#{KEYWORDS})\b(.*)/io do
|
28
28
|
groups Keyword, Str
|
29
29
|
end
|
30
30
|
|
data/lib/rouge/lexers/elixir.rb
CHANGED
@@ -38,8 +38,11 @@ module Rouge
|
|
38
38
|
rule %r/[a-zA-Z_!]\w*[!\?]?/, Name
|
39
39
|
rule %r{::|[%(){};,/\|:\\\[\]]}, Punctuation
|
40
40
|
rule %r/@[a-zA-Z_]\w*|&\d/, Name::Variable
|
41
|
-
rule %r{\b
|
42
|
-
|
41
|
+
rule %r{\b\d(_?\d)*(\.(?![^\d\s])(_?\d)+)([eE][-+]?\d(_?\d)*)?\b}, Num::Float
|
42
|
+
rule %r{\b0x[0-9A-Fa-f](_?[0-9A-Fa-f])*\b}, Num::Hex
|
43
|
+
rule %r{\b0o[0-7](_?[0-7])*\b}, Num::Oct
|
44
|
+
rule %r{\b0b[01](_?[01])*\b}, Num::Bin
|
45
|
+
rule %r{\b\d(_?\d)*\b}, Num::Integer
|
43
46
|
|
44
47
|
mixin :strings
|
45
48
|
mixin :sigil_strings
|