rouge 4.1.3 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rouge/demos/codeowners +6 -0
- data/lib/rouge/demos/svelte +29 -0
- data/lib/rouge/lexers/bpf.rb +10 -10
- data/lib/rouge/lexers/codeowners.rb +30 -0
- data/lib/rouge/lexers/dart.rb +1 -1
- data/lib/rouge/lexers/elixir.rb +4 -0
- data/lib/rouge/lexers/groovy.rb +3 -3
- data/lib/rouge/lexers/python.rb +2 -2
- data/lib/rouge/lexers/svelte.rb +91 -0
- data/lib/rouge/lexers/xojo.rb +5 -5
- data/lib/rouge/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3281f8cbea5fa288016ada176d8fd748d2426af2f6a02a49c4f519ae4a385c9
|
4
|
+
data.tar.gz: a0e5aae51677fa27c6c448d3d617b0f4748934ad267dc0be49b705e2fc89f93b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fe33d5d2a60be45a82839227de784d92440a99c77e700d55cba412f1d8a2cb5b516013bd92f7db62f88a25fa6aee8bdd65415cd9c2203c1e4a1538549d7a1a7
|
7
|
+
data.tar.gz: 1b4598ed31db53da50a79e5aeaff8eca539c91dd7102b07a7e1106c4bd050071e689fb21a4d435b2e8d465cb91ae8a9275a91d777509961a6c95739e1ecc8d76
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!-- This file is made up from several examples on https://svelte.dev/examples and is not expected to function. -->
|
2
|
+
<script lang="ts">
|
3
|
+
import Image from './Image.svelte';
|
4
|
+
|
5
|
+
let src: string = '/tutorial/image.gif';
|
6
|
+
let count: number = 1;
|
7
|
+
$: doubled = count * 2; // the `$:` is special in svelte
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<Image {src} bind:alt="{name.capitalize()} dancing" user={name.toUpperCase(false, 42, {key: 'value'})}
|
11
|
+
tooltip="I'm helping" false text=asdf on:message={handleMessage} />
|
12
|
+
|
13
|
+
{#await loadSrc(src)}
|
14
|
+
loading...
|
15
|
+
{:then data}
|
16
|
+
{#each cats as { name }, i}
|
17
|
+
<li>{name}</li>
|
18
|
+
{/each}
|
19
|
+
|
20
|
+
<!-- Keyed Each Block -->
|
21
|
+
{#each cats as cat (cat.id)}
|
22
|
+
<li>{cat.name}</li>
|
23
|
+
{/each}
|
24
|
+
{:catch err}
|
25
|
+
{@debug err}
|
26
|
+
{#await solveErr(err, {x: 'asdf'}) then reason}{@html reason}{/await}
|
27
|
+
{/await}
|
28
|
+
|
29
|
+
<style>p {font-family: 'Comic Sans MS', cursive;}</style>
|
data/lib/rouge/lexers/bpf.rb
CHANGED
@@ -9,11 +9,11 @@ module Rouge
|
|
9
9
|
tag 'bpf'
|
10
10
|
|
11
11
|
TYPE_KEYWORDS = %w(
|
12
|
-
u8 u16 u32 u64 ll
|
12
|
+
u8 u16 u32 u64 s8 s16 s32 s64 ll
|
13
13
|
).join('|')
|
14
14
|
|
15
15
|
MISC_KEYWORDS = %w(
|
16
|
-
be16 be32 be64 exit lock map
|
16
|
+
be16 be32 be64 le16 le32 le64 bswap16 bswap32 bswap64 exit lock map
|
17
17
|
).join('|')
|
18
18
|
|
19
19
|
state :root do
|
@@ -32,21 +32,21 @@ module Rouge
|
|
32
32
|
rule %r/(call)(\s+)(\d+)/i do
|
33
33
|
groups Keyword, Text::Whitespace, Literal::Number::Integer
|
34
34
|
end
|
35
|
-
rule %r/(call)(\s+)(\w+)(#)(\d+)
|
35
|
+
rule %r/(call)(\s+)(\w+)(?:(#)(\d+))?/i do
|
36
36
|
groups Keyword, Text::Whitespace, Name::Builtin, Punctuation, Literal::Number::Integer
|
37
37
|
end
|
38
38
|
|
39
39
|
# Unconditional jumps
|
40
|
-
rule %r/(
|
41
|
-
groups Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
40
|
+
rule %r/(gotol?)(\s*)([-+]0x\w+)?([-+]\d+)?(\s*)(<?\w+>?)/i do
|
41
|
+
groups Keyword, Text::Whitespace, Literal::Number::Hex, Literal::Number::Integer, Text::Whitespace, Name::Label
|
42
42
|
end
|
43
43
|
|
44
44
|
# Conditional jumps
|
45
|
-
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(
|
46
|
-
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
45
|
+
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(gotol?)(\s*)([-+]0x\w+)?([-+]\d+)?(\s*)(<?\w+>?)/i do
|
46
|
+
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Hex, Literal::Number::Integer, Text::Whitespace, Name::Label
|
47
47
|
end
|
48
|
-
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)([rw]\d+)(\s*)(
|
49
|
-
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Name, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
|
48
|
+
rule %r/(if)(\s+)([rw]\d+)(\s*)([s!=<>]+)(\s*)([rw]\d+)(\s*)(gotol?)(\s*)([-+]0x\w+)?([-+]\d+)?(\s*)(<?\w+>?)/i do
|
49
|
+
groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Name, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Hex, Literal::Number::Integer, Text::Whitespace, Name::Label
|
50
50
|
end
|
51
51
|
|
52
52
|
# Dereferences
|
@@ -70,7 +70,7 @@ module Rouge
|
|
70
70
|
rule %r/#{MISC_KEYWORDS}/i, Keyword
|
71
71
|
|
72
72
|
# Literals and global objects (maps) refered by name
|
73
|
-
rule %r/(0x\h+|[-]?\d+)(\s*)(ll)?/i do
|
73
|
+
rule %r/([-]?0x\h+|[-]?\d+)(\s*)(ll)?/i do
|
74
74
|
groups Literal::Number, Text::Whitespace, Keyword::Type
|
75
75
|
end
|
76
76
|
rule %r/(\w+)(\s*)(ll)/i do
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class Codeowners < RegexLexer
|
7
|
+
title 'CODEOWNERS'
|
8
|
+
desc 'Code Owners syntax (https://docs.gitlab.com/ee/user/project/codeowners/reference.html)'
|
9
|
+
tag 'codeowners'
|
10
|
+
filenames 'CODEOWNERS'
|
11
|
+
|
12
|
+
state :root do
|
13
|
+
rule %r/[ \t\r\n]+/, Text::Whitespace
|
14
|
+
rule %r/^\s*#.*$/, Comment::Single
|
15
|
+
|
16
|
+
rule %r(
|
17
|
+
(\^?\[(?!\d+\])[^\]]+\])
|
18
|
+
(\[\d+\])?
|
19
|
+
)x do
|
20
|
+
groups Name::Namespace, Literal::Number
|
21
|
+
end
|
22
|
+
|
23
|
+
rule %r/\S*@\S+/, Name::Function
|
24
|
+
|
25
|
+
rule %r/[\p{Word}\.\/\-\*]+/, Name
|
26
|
+
rule %r/.*\\[\#\s]/, Name
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/rouge/lexers/dart.rb
CHANGED
@@ -18,7 +18,7 @@ module Rouge
|
|
18
18
|
|
19
19
|
declarations = %w(
|
20
20
|
abstract base async dynamic const covariant external extends factory final get implements
|
21
|
-
|
21
|
+
interface late native on operator required sealed set static sync typedef var
|
22
22
|
)
|
23
23
|
|
24
24
|
types = %w(bool Comparable double Dynamic enum Function int List Map Never Null num Object Pattern Record Set String Symbol Type Uri void)
|
data/lib/rouge/lexers/elixir.rb
CHANGED
data/lib/rouge/lexers/groovy.rb
CHANGED
@@ -23,7 +23,7 @@ module Rouge
|
|
23
23
|
|
24
24
|
def self.declarations
|
25
25
|
@declarations ||= Set.new %w(
|
26
|
-
abstract const
|
26
|
+
abstract const extends final implements native private
|
27
27
|
protected public static strictfp super synchronized throws
|
28
28
|
transient volatile
|
29
29
|
)
|
@@ -31,7 +31,7 @@ module Rouge
|
|
31
31
|
|
32
32
|
def self.types
|
33
33
|
@types ||= Set.new %w(
|
34
|
-
def boolean byte char double float int long short void
|
34
|
+
def var boolean byte char double float int long short void
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
@@ -56,7 +56,7 @@ module Rouge
|
|
56
56
|
rule %r(//.*?$), Comment::Single
|
57
57
|
rule %r(/[*].*?[*]/)m, Comment::Multiline
|
58
58
|
rule %r/@\w[\w.]*/, Name::Decorator
|
59
|
-
rule %r/(class|interface|trait)\b/, Keyword::Declaration, :class
|
59
|
+
rule %r/(class|interface|trait|enum|record)\b/, Keyword::Declaration, :class
|
60
60
|
rule %r/package\b/, Keyword::Namespace, :import
|
61
61
|
rule %r/import\b/, Keyword::Namespace, :import
|
62
62
|
|
data/lib/rouge/lexers/python.rb
CHANGED
@@ -8,8 +8,8 @@ module Rouge
|
|
8
8
|
desc "The Python programming language (python.org)"
|
9
9
|
tag 'python'
|
10
10
|
aliases 'py'
|
11
|
-
filenames '*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript',
|
12
|
-
'*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE'
|
11
|
+
filenames '*.py', '*.pyi', '*.pyw', '*.sc', 'SConstruct', 'SConscript',
|
12
|
+
'*.tac', '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE'
|
13
13
|
mimetypes 'text/x-python', 'application/x-python'
|
14
14
|
|
15
15
|
def self.detect?(text)
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
load_lexer 'html.rb'
|
7
|
+
|
8
|
+
class Svelte < HTML
|
9
|
+
desc 'Svelte single-file components (https://svelte.dev/)'
|
10
|
+
tag 'svelte'
|
11
|
+
filenames '*.svelte'
|
12
|
+
mimetypes 'text/x-svelte', 'application/x-svelte'
|
13
|
+
|
14
|
+
def initialize(*)
|
15
|
+
super
|
16
|
+
# todo add support for typescript script blocks
|
17
|
+
@js = Javascript.new(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Shorthand syntax for passing attributes - ex, `{src}` instead of `src={src}`
|
21
|
+
prepend :tag do
|
22
|
+
rule %r/(\{)\s*([a-zA-Z0-9_]+)\s*(})/m do
|
23
|
+
groups Str::Interpol, Name::Variable, Str::Interpol
|
24
|
+
pop!
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
prepend :attr do
|
29
|
+
# Duplicate template_start mixin here with a pop!
|
30
|
+
# Because otherwise we'll never exit the attr state
|
31
|
+
rule %r/\{/ do
|
32
|
+
token Str::Interpol
|
33
|
+
pop!
|
34
|
+
push :template
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# handle templates within attribute single/double quotes
|
39
|
+
prepend :dq do
|
40
|
+
mixin :template_start
|
41
|
+
end
|
42
|
+
|
43
|
+
prepend :sq do
|
44
|
+
mixin :template_start
|
45
|
+
end
|
46
|
+
|
47
|
+
prepend :root do
|
48
|
+
# detect curly braces within HTML text (outside of tags/attributes)
|
49
|
+
rule %r/([^<&{]*)(\{)(\s*)/ do
|
50
|
+
groups Text, Str::Interpol, Text
|
51
|
+
push :template
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
state :template_start do
|
56
|
+
# open template
|
57
|
+
rule %r/\s*\{\s*/, Str::Interpol, :template
|
58
|
+
end
|
59
|
+
|
60
|
+
state :template do
|
61
|
+
# template end
|
62
|
+
rule %r/}/, Str::Interpol, :pop!
|
63
|
+
|
64
|
+
# Allow JS lexer to handle matched curly braces within template
|
65
|
+
rule(/(?<=^|[^\\])\{.*?(?<=^|[^\\])\}/) do
|
66
|
+
delegate @js
|
67
|
+
end
|
68
|
+
|
69
|
+
# keywords
|
70
|
+
rule %r/@(debug|html)\b/, Keyword
|
71
|
+
rule %r/(#await)(.*)(then|catch)(\s+)(\w+)/ do |m|
|
72
|
+
token Keyword, m[1]
|
73
|
+
delegate @js, m[2]
|
74
|
+
token Keyword, m[3]
|
75
|
+
token Text, m[4]
|
76
|
+
delegate @js, m[5]
|
77
|
+
end
|
78
|
+
rule %r/([#\/])(await|each|if|key)\b/, Keyword
|
79
|
+
rule %r/(:else)(\s+)(if)?\b/ do
|
80
|
+
groups Keyword, Text, Keyword
|
81
|
+
end
|
82
|
+
rule %r/:?(catch|then)\b/, Keyword
|
83
|
+
|
84
|
+
# allow JS parser to handle anything that's not a curly brace
|
85
|
+
rule %r/[^{}]+/ do
|
86
|
+
delegate @js
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/lib/rouge/lexers/xojo.rb
CHANGED
@@ -12,20 +12,20 @@ module Rouge
|
|
12
12
|
|
13
13
|
keywords = %w(
|
14
14
|
addhandler aggregates array asc assigns attributes begin break
|
15
|
-
byref byval call case catch class const continue
|
15
|
+
byref byval call case catch class const continue color ctype declare
|
16
16
|
delegate dim do downto each else elseif end enum event exception
|
17
17
|
exit extends false finally for function global goto if
|
18
18
|
implements inherits interface lib loop mod module
|
19
19
|
new next nil object of optional paramarray
|
20
20
|
private property protected public raise raiseevent rect redim
|
21
21
|
removehandler return select shared soft static step sub super
|
22
|
-
then to true try until using
|
22
|
+
then to true try until using var wend while
|
23
23
|
)
|
24
24
|
|
25
25
|
keywords_type = %w(
|
26
|
-
boolean cfstringref cgfloat cstring
|
27
|
-
int32 int64 integer ostype pstring ptr short single
|
28
|
-
|
26
|
+
boolean byte cfstringref cgfloat cstring currency date datetime double int8 int16
|
27
|
+
int32 int64 integer ostype pair pstring ptr short single
|
28
|
+
string structure variant uinteger uint8 uint16 uint32 uint64
|
29
29
|
ushort windowptr wstring
|
30
30
|
)
|
31
31
|
|
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: 4.
|
4
|
+
version: 4.2.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: 2023-
|
11
|
+
date: 2023-10-25 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:
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/rouge/demos/clojure
|
50
50
|
- lib/rouge/demos/cmake
|
51
51
|
- lib/rouge/demos/cmhg
|
52
|
+
- lib/rouge/demos/codeowners
|
52
53
|
- lib/rouge/demos/coffeescript
|
53
54
|
- lib/rouge/demos/common_lisp
|
54
55
|
- lib/rouge/demos/conf
|
@@ -210,6 +211,7 @@ files:
|
|
210
211
|
- lib/rouge/demos/stan
|
211
212
|
- lib/rouge/demos/stata
|
212
213
|
- lib/rouge/demos/supercollider
|
214
|
+
- lib/rouge/demos/svelte
|
213
215
|
- lib/rouge/demos/swift
|
214
216
|
- lib/rouge/demos/systemd
|
215
217
|
- lib/rouge/demos/syzlang
|
@@ -290,6 +292,7 @@ files:
|
|
290
292
|
- lib/rouge/lexers/clojure.rb
|
291
293
|
- lib/rouge/lexers/cmake.rb
|
292
294
|
- lib/rouge/lexers/cmhg.rb
|
295
|
+
- lib/rouge/lexers/codeowners.rb
|
293
296
|
- lib/rouge/lexers/coffeescript.rb
|
294
297
|
- lib/rouge/lexers/common_lisp.rb
|
295
298
|
- lib/rouge/lexers/conf.rb
|
@@ -463,6 +466,7 @@ files:
|
|
463
466
|
- lib/rouge/lexers/stan.rb
|
464
467
|
- lib/rouge/lexers/stata.rb
|
465
468
|
- lib/rouge/lexers/supercollider.rb
|
469
|
+
- lib/rouge/lexers/svelte.rb
|
466
470
|
- lib/rouge/lexers/swift.rb
|
467
471
|
- lib/rouge/lexers/systemd.rb
|
468
472
|
- lib/rouge/lexers/syzlang.rb
|
@@ -543,7 +547,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
543
547
|
- !ruby/object:Gem::Version
|
544
548
|
version: '0'
|
545
549
|
requirements: []
|
546
|
-
rubygems_version: 3.4.
|
550
|
+
rubygems_version: 3.4.10
|
547
551
|
signing_key:
|
548
552
|
specification_version: 4
|
549
553
|
summary: A pure-ruby colorizer based on pygments
|