rouge 1.9.0 → 1.9.1
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/demos/http +1 -1
- data/lib/rouge/demos/powershell +49 -0
- data/lib/rouge/demos/tulip +14 -0
- data/lib/rouge/formatters/html_inline.rb +20 -0
- data/lib/rouge/formatters/html_linewise.rb +31 -0
- data/lib/rouge/lexer.rb +1 -1
- data/lib/rouge/lexers/c.rb +2 -2
- data/lib/rouge/lexers/csharp.rb +3 -3
- data/lib/rouge/lexers/groovy.rb +1 -1
- data/lib/rouge/lexers/php.rb +10 -1
- data/lib/rouge/lexers/powershell.rb +96 -0
- data/lib/rouge/lexers/prolog.rb +1 -1
- data/lib/rouge/lexers/tulip.rb +75 -0
- data/lib/rouge/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a5383a3f574741c04a723f85f983e87a7962e64
|
4
|
+
data.tar.gz: 67935c3ef91a6c7cbf47a0182aeed7af37dafca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb60ad1f8eb796a4da95ae4bbb8b508742d6faa069630feda3ade8de70870e2f0593c776c133f0d36639a1f01f0d8389d4c4b44b9334dbfdbc67bf26e372591
|
7
|
+
data.tar.gz: 72e5e033ef8b39c49a61ccc153a5811d584f5005f71f7cb522245dfdd964650d5c7d18a5bcb6d29ea35537c8cac31cfdd0e6891dbdbf1a868f72d198a118605e
|
data/lib/rouge/demos/http
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
Function Get-IPv4Scopes
|
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
|
+
#>
|
12
|
+
{
|
13
|
+
[CmdletBinding()]
|
14
|
+
Param(
|
15
|
+
# 1
|
16
|
+
[parameter(
|
17
|
+
Mandatory=$true,
|
18
|
+
Position=0,
|
19
|
+
ValueFromPipelineByPropertyName=$true,
|
20
|
+
HelpMessage="Server List"
|
21
|
+
)]
|
22
|
+
[string[]]$Servers,
|
23
|
+
#2
|
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
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# ref.tlp
|
2
|
+
@module ref
|
3
|
+
|
4
|
+
ref value = Instance (spawn [! loop value ])
|
5
|
+
|
6
|
+
loop value = receive [
|
7
|
+
.set new-value => loop new-value
|
8
|
+
p, .get => (send p value; loop value)
|
9
|
+
]
|
10
|
+
|
11
|
+
@module Instance pid [
|
12
|
+
set val = .set val > send pid
|
13
|
+
get! = .get > send-wait pid
|
14
|
+
]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Formatters
|
5
|
+
class HTMLInline < HTML
|
6
|
+
def initialize(theme)
|
7
|
+
@theme = theme
|
8
|
+
end
|
9
|
+
|
10
|
+
def safe_span(tok, safe_val)
|
11
|
+
return safe_val if tok == Token::Tokens::Text
|
12
|
+
|
13
|
+
rules = @inline_theme.style_for(tok).rendered_rules
|
14
|
+
|
15
|
+
"<span style=\"#{rules.to_a.join(';')}\">#{safe_val}</span>"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Formatters
|
5
|
+
class HTMLLinewise < Formatter
|
6
|
+
def initialize(formatter, opts={})
|
7
|
+
@formatter = formatter
|
8
|
+
@class_format = opts.fetch(:class, '%i')
|
9
|
+
end
|
10
|
+
|
11
|
+
def stream(tokens, &b)
|
12
|
+
yield "<span class=#{next_line_class}>"
|
13
|
+
tokens.each do |tok, val|
|
14
|
+
val.scan /\n|[^\n]+/ do |s|
|
15
|
+
if s == "\n"
|
16
|
+
yield "</span>\n<span class=#{next_line_class}>"
|
17
|
+
else
|
18
|
+
@formatter.span(tok, s)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
yield "</span>"
|
23
|
+
end
|
24
|
+
|
25
|
+
def next_line_class
|
26
|
+
@lineno ||= -1
|
27
|
+
sprintf(@class_format, @lineno += 1).inspect
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/rouge/lexer.rb
CHANGED
@@ -376,7 +376,7 @@ module Rouge
|
|
376
376
|
# @option opts :continue
|
377
377
|
# Continue the lex from the previous state (i.e. don't call #reset!)
|
378
378
|
def lex(string, opts={}, &b)
|
379
|
-
return enum_for(:lex, string) unless block_given?
|
379
|
+
return enum_for(:lex, string, opts) unless block_given?
|
380
380
|
|
381
381
|
Lexer.assert_utf8!(string)
|
382
382
|
|
data/lib/rouge/lexers/c.rb
CHANGED
@@ -158,10 +158,10 @@ module Rouge
|
|
158
158
|
)mx do |m|
|
159
159
|
# TODO: do this better.
|
160
160
|
recurse m[1]
|
161
|
-
token Name::Function
|
161
|
+
token Name::Function, m[2]
|
162
162
|
recurse m[3]
|
163
163
|
recurse m[4]
|
164
|
-
token Punctuation
|
164
|
+
token Punctuation, m[5]
|
165
165
|
push :statement
|
166
166
|
end
|
167
167
|
|
data/lib/rouge/lexers/csharp.rb
CHANGED
@@ -44,9 +44,9 @@ module Rouge
|
|
44
44
|
mixin :whitespace
|
45
45
|
|
46
46
|
rule /^\s*\[.*?\]/, Name::Attribute
|
47
|
-
rule /[$]\s*"/, Str, :splice_string
|
48
|
-
rule /[$]\s*<#/, Str, :splice_recstring
|
49
|
-
rule /<#/, Str, :recstring
|
47
|
+
# rule /[$]\s*"/, Str, :splice_string
|
48
|
+
# rule /[$]\s*<#/, Str, :splice_recstring
|
49
|
+
# rule /<#/, Str, :recstring
|
50
50
|
|
51
51
|
rule /(<\[)\s*(#{id}:)?/, Keyword
|
52
52
|
rule /\]>/, Keyword
|
data/lib/rouge/lexers/groovy.rb
CHANGED
@@ -50,7 +50,7 @@ module Rouge
|
|
50
50
|
|
51
51
|
# whitespace
|
52
52
|
rule /[^\S\n]+/, Text
|
53
|
-
rule %r(
|
53
|
+
rule %r(//.*?$), Comment::Single
|
54
54
|
rule %r(/[*].*?[*]/)m, Comment::Multiline
|
55
55
|
rule /@\w[\w\d.]*/, Name::Decorator
|
56
56
|
rule /(class|interface)\b/, Keyword::Declaration, :class
|
data/lib/rouge/lexers/php.rb
CHANGED
@@ -7,7 +7,10 @@ module Rouge
|
|
7
7
|
desc "The PHP scripting language (php.net)"
|
8
8
|
tag 'php'
|
9
9
|
aliases 'php', 'php3', 'php4', 'php5'
|
10
|
-
filenames '*.php', '*.php[345]'
|
10
|
+
filenames '*.php', '*.php[345]',
|
11
|
+
# Support Drupal file extensions, see:
|
12
|
+
# https://github.com/gitlabhq/gitlabhq/issues/8900
|
13
|
+
'*.module', '*.inc', '*.profile', '*.install', '*.test'
|
11
14
|
mimetypes 'text/x-php'
|
12
15
|
|
13
16
|
default_options :parent => 'html'
|
@@ -60,6 +63,12 @@ module Rouge
|
|
60
63
|
)
|
61
64
|
end
|
62
65
|
|
66
|
+
def self.analyze_text(text)
|
67
|
+
return 1 if text.shebang?('php')
|
68
|
+
return 0.3 if /<\?(?!xml)/ =~ text
|
69
|
+
0
|
70
|
+
end
|
71
|
+
|
63
72
|
state :root do
|
64
73
|
rule /<\?(php|=)?/, Comment::Preproc, :php
|
65
74
|
rule(/.*?(?=<\?)|.*/m) { delegate parent }
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
load_const :Shell, 'shell.rb'
|
6
|
+
|
7
|
+
class Powershell < Shell
|
8
|
+
title 'powershell'
|
9
|
+
desc 'powershell'
|
10
|
+
tag 'powershell'
|
11
|
+
aliases 'posh'
|
12
|
+
filenames '*.ps1', '*.psm1', '*.psd1'
|
13
|
+
mimetypes 'text/plain'
|
14
|
+
|
15
|
+
ATTRIBUTES = %w(
|
16
|
+
CmdletBinding ConfirmImpact DefaultParameterSetName HelpURI SupportsPaging
|
17
|
+
SupportsShouldProcess PositionalBinding
|
18
|
+
).join('|')
|
19
|
+
|
20
|
+
KEYWORDS = %w(
|
21
|
+
Begin Exit Process Break Filter Return Catch Finally Sequence Class For
|
22
|
+
Switch Continue ForEach Throw Data From Trap Define Function Try Do If
|
23
|
+
Until DynamicParam In Using Else InlineScript Var ElseIf Parallel While
|
24
|
+
End Param Workflow
|
25
|
+
).join('|')
|
26
|
+
|
27
|
+
KEYWORDS_TYPE = %w(
|
28
|
+
bool byte char decimal double float int long object sbyte
|
29
|
+
short string uint ulong ushort
|
30
|
+
).join('|')
|
31
|
+
|
32
|
+
OPERATORS = %w(
|
33
|
+
-split -isplit -csplit -join -is -isnot -as -eq -ieq -ceq -ne -ine
|
34
|
+
-cne -gt -igt -cgt -ge -ige -cge -lt -ilt -clt -le -ile -cle -like
|
35
|
+
-ilike -clike -notlike -inotlike -cnotlike -match -imatch -cmatch
|
36
|
+
-notmatch -inotmatch -cnotmatch -contains -icontains -ccontains
|
37
|
+
-notcontains -inotcontains -cnotcontains -replace -ireplace
|
38
|
+
-creplace -band -bor -bxor -and -or -xor \. & = \+= -= \*= \/= %=
|
39
|
+
).join('|')
|
40
|
+
|
41
|
+
BUILTINS = %w(
|
42
|
+
Add-Content Add-History Add-Member Add-PSSnapin Clear-Content
|
43
|
+
Clear-Item Clear-Item Property Clear-Variable Compare-Object
|
44
|
+
ConvertFrom-SecureString Convert-Path ConvertTo-Html
|
45
|
+
ConvertTo-SecureString Copy-Item Copy-ItemProperty Export-Alias
|
46
|
+
Export-Clixml Export-Console Export-Csv ForEach-Object
|
47
|
+
Format-Custom Format-List Format-Table Format-Wide
|
48
|
+
Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem
|
49
|
+
Get-Command Get-Content Get-Credential Get-Culture Get-Date
|
50
|
+
Get-EventLog Get-ExecutionPolicy Get-Help Get-History
|
51
|
+
Get-Host Get-Item Get-ItemProperty Get-Location Get-Member
|
52
|
+
Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider
|
53
|
+
Get-PSSnapin Get-Service Get-TraceSource Get-UICulture
|
54
|
+
Get-Unique Get-Variable Get-WmiObject Group-Object
|
55
|
+
Import-Alias Import-Clixml Import-Csv Invoke-Expression
|
56
|
+
Invoke-History Invoke-Item Join-Path Measure-Command
|
57
|
+
Measure-Object Move-Item Move-ItemProperty New-Alias
|
58
|
+
New-Item New-ItemProperty New-Object New-PSDrive New-Service
|
59
|
+
New-TimeSpan New-Variable Out-Default Out-File Out-Host Out-Null
|
60
|
+
Out-Printer Out-String Pop-Location Push-Location Read-Host
|
61
|
+
Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin
|
62
|
+
Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path
|
63
|
+
Restart-Service Resume-Service Select-Object Select-String
|
64
|
+
Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content Set-Date
|
65
|
+
Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location
|
66
|
+
Set-PSDebug Set-Service Set-TraceSource Set-Variable Sort-Object
|
67
|
+
Split-Path Start-Service Start-Sleep Start-Transcript Stop-Process
|
68
|
+
Stop-Service Stop-Transcript Suspend-Service Tee-Object Test-Path
|
69
|
+
Trace-Command Update-FormatData Update-TypeData Where-Object
|
70
|
+
Write-Debug Write-Error Write-Host Write-Output Write-Progress
|
71
|
+
Write-Verbose Write-Warning ac asnp cat cd chdir clc clear clhy
|
72
|
+
cli clp cls clv cnsn compare copy cp cpi cpp curl cvpa dbp del
|
73
|
+
diff dir dnsn ebp echo epal epcsv epsn erase etsn exsn fc fl
|
74
|
+
foreach ft fw gal gbp gc gci gcm gcs gdr ghy gi gjb gl gm gmo
|
75
|
+
gp gps group gsn gsnp gsv gu gv gwmi h history icm iex ihy ii
|
76
|
+
ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp ls man md measure
|
77
|
+
mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh popd ps
|
78
|
+
pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp
|
79
|
+
rp rsn rsnp rujb rv rvpa rwmi sajb sal saps sasv sbp sc select
|
80
|
+
set shcm si sl sleep sls sort sp spjb spps spsv start sujb sv
|
81
|
+
swmi tee trcm type wget where wjb write \% \?
|
82
|
+
).join('|')
|
83
|
+
|
84
|
+
prepend :basic do
|
85
|
+
rule %r(<#[\s,\S]*?#>)m, Comment::Multiline
|
86
|
+
rule /#.*$/, Comment::Single
|
87
|
+
rule /\b(#{OPERATORS})\s*\b/i, Operator
|
88
|
+
rule /\b(#{ATTRIBUTES})\s*\b/i, Name::Attribute
|
89
|
+
rule /\b(#{KEYWORDS})\s*\b/i, Keyword
|
90
|
+
rule /\b(#{KEYWORDS_TYPE})\s*\b/i, Keyword::Type
|
91
|
+
rule /\bcase\b/, Keyword, :case
|
92
|
+
rule /\b(#{BUILTINS})\s*\b(?!\.)/i, Name::Builtin
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/rouge/lexers/prolog.rb
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
module Rouge
|
2
|
+
module Lexers
|
3
|
+
class Tulip < RegexLexer
|
4
|
+
tag 'tulip'
|
5
|
+
aliases 'tlp'
|
6
|
+
filenames '*.tlp'
|
7
|
+
desc 'The tulip programming language http://github.com/jneen/tulip'
|
8
|
+
|
9
|
+
id = /\w[\w-]*/
|
10
|
+
|
11
|
+
def self.analyze_text(text)
|
12
|
+
return 1 if text.shebang?('tulip')
|
13
|
+
end
|
14
|
+
|
15
|
+
state :root do
|
16
|
+
rule /\s+/, Text
|
17
|
+
rule /#.*?\n/, Comment
|
18
|
+
rule /%#{id}/, Keyword::Type
|
19
|
+
rule /@#{id}/, Keyword
|
20
|
+
rule /[.][.]?#{id}/, Name::Label
|
21
|
+
rule /-#{id}[?]?/, Str::Symbol
|
22
|
+
rule /\d+/, Num
|
23
|
+
rule %r(/#{id}?), Name::Decorator
|
24
|
+
rule %r((#{id}/)(#{id})) do
|
25
|
+
groups Name::Namespace, Name::Variable
|
26
|
+
end
|
27
|
+
|
28
|
+
rule /"{/, Str, :string_interp
|
29
|
+
rule /'?{/, Str, :string
|
30
|
+
rule /['"][^\s)\]]+/, Str
|
31
|
+
|
32
|
+
rule /[$]/, Name::Variable
|
33
|
+
|
34
|
+
rule /[-+:;~!()\[\]=?>|_%,]/, Punctuation
|
35
|
+
rule /[.][.][.]/, Punctuation
|
36
|
+
rule id, Name
|
37
|
+
end
|
38
|
+
|
39
|
+
state :string_base do
|
40
|
+
rule /{/ do
|
41
|
+
token Str; push
|
42
|
+
end
|
43
|
+
|
44
|
+
rule /}/, Str, :pop!
|
45
|
+
rule /[$]/, Str
|
46
|
+
rule /[^${}\\]+/, Str
|
47
|
+
end
|
48
|
+
|
49
|
+
state :string do
|
50
|
+
mixin :string_base
|
51
|
+
rule /\\/, Str
|
52
|
+
end
|
53
|
+
|
54
|
+
state :interp do
|
55
|
+
rule(/[(]/) { token Punctuation; push }
|
56
|
+
rule /[)]/, Punctuation, :pop!
|
57
|
+
mixin :root
|
58
|
+
end
|
59
|
+
|
60
|
+
state :interp_root do
|
61
|
+
rule /[(]/, Str::Interpol, :interp
|
62
|
+
rule /[)]/, Str::Interpol, :pop!
|
63
|
+
mixin :root
|
64
|
+
end
|
65
|
+
|
66
|
+
state :string_interp do
|
67
|
+
rule /\\./, Str::Escape
|
68
|
+
rule /[$][(]/, Str::Interpol, :interp_root
|
69
|
+
rule /[$]#{id}?/, Name::Variable
|
70
|
+
mixin :string_base
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
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.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeanine Adkisson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-13 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:
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/rouge/demos/perl
|
71
71
|
- lib/rouge/demos/php
|
72
72
|
- lib/rouge/demos/plaintext
|
73
|
+
- lib/rouge/demos/powershell
|
73
74
|
- lib/rouge/demos/prolog
|
74
75
|
- lib/rouge/demos/properties
|
75
76
|
- lib/rouge/demos/puppet
|
@@ -93,12 +94,15 @@ files:
|
|
93
94
|
- lib/rouge/demos/tcl
|
94
95
|
- lib/rouge/demos/tex
|
95
96
|
- lib/rouge/demos/toml
|
97
|
+
- lib/rouge/demos/tulip
|
96
98
|
- lib/rouge/demos/vb
|
97
99
|
- lib/rouge/demos/viml
|
98
100
|
- lib/rouge/demos/xml
|
99
101
|
- lib/rouge/demos/yaml
|
100
102
|
- lib/rouge/formatter.rb
|
101
103
|
- lib/rouge/formatters/html.rb
|
104
|
+
- lib/rouge/formatters/html_inline.rb
|
105
|
+
- lib/rouge/formatters/html_linewise.rb
|
102
106
|
- lib/rouge/formatters/null.rb
|
103
107
|
- lib/rouge/formatters/terminal256.rb
|
104
108
|
- lib/rouge/lexer.rb
|
@@ -152,6 +156,7 @@ files:
|
|
152
156
|
- lib/rouge/lexers/php.rb
|
153
157
|
- lib/rouge/lexers/php/builtins.rb
|
154
158
|
- lib/rouge/lexers/plain_text.rb
|
159
|
+
- lib/rouge/lexers/powershell.rb
|
155
160
|
- lib/rouge/lexers/prolog.rb
|
156
161
|
- lib/rouge/lexers/properties.rb
|
157
162
|
- lib/rouge/lexers/puppet.rb
|
@@ -176,6 +181,7 @@ files:
|
|
176
181
|
- lib/rouge/lexers/tcl.rb
|
177
182
|
- lib/rouge/lexers/tex.rb
|
178
183
|
- lib/rouge/lexers/toml.rb
|
184
|
+
- lib/rouge/lexers/tulip.rb
|
179
185
|
- lib/rouge/lexers/vb.rb
|
180
186
|
- lib/rouge/lexers/viml.rb
|
181
187
|
- lib/rouge/lexers/viml/keywords.rb
|