rouge 3.6.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/rouge/demos/ada +26 -0
- data/lib/rouge/demos/armasm +12 -0
- data/lib/rouge/demos/batchfile +3 -0
- data/lib/rouge/demos/bbcbasic +6 -0
- data/lib/rouge/demos/cmhg +8 -0
- data/lib/rouge/demos/cuda +11 -0
- data/lib/rouge/demos/cython +6 -0
- data/lib/rouge/demos/epp +4 -0
- data/lib/rouge/demos/gdscript +18 -0
- data/lib/rouge/demos/hocon +8 -0
- data/lib/rouge/demos/mason +22 -0
- data/lib/rouge/demos/msgtrans +4 -0
- data/lib/rouge/demos/opentype_feature_file +6 -0
- data/lib/rouge/demos/plist +1 -132
- data/lib/rouge/demos/reasonml +12 -0
- data/lib/rouge/demos/sas +13 -0
- data/lib/rouge/formatters/html_line_table.rb +3 -1
- data/lib/rouge/formatters/tex.rb +14 -12
- data/lib/rouge/guessers/disambiguation.rb +12 -0
- data/lib/rouge/lexers/ada.rb +162 -0
- data/lib/rouge/lexers/armasm.rb +145 -0
- data/lib/rouge/lexers/batchfile.rb +164 -0
- data/lib/rouge/lexers/bbcbasic.rb +112 -0
- data/lib/rouge/lexers/cmhg.rb +34 -0
- data/lib/rouge/lexers/console.rb +1 -1
- data/lib/rouge/lexers/cpp.rb +4 -1
- data/lib/rouge/lexers/cuda.rb +35 -0
- data/lib/rouge/lexers/cython.rb +151 -0
- data/lib/rouge/lexers/epp.rb +51 -0
- data/lib/rouge/lexers/escape.rb +3 -0
- data/lib/rouge/lexers/gdscript.rb +171 -0
- data/lib/rouge/lexers/gherkin.rb +4 -2
- data/lib/rouge/lexers/graphql.rb +10 -3
- data/lib/rouge/lexers/handlebars.rb +14 -3
- data/lib/rouge/lexers/hocon.rb +86 -0
- data/lib/rouge/lexers/html.rb +2 -2
- data/lib/rouge/lexers/igorpro.rb +1 -1
- data/lib/rouge/lexers/json.rb +43 -5
- data/lib/rouge/lexers/julia.rb +1 -1
- data/lib/rouge/lexers/make.rb +39 -12
- data/lib/rouge/lexers/mason.rb +115 -0
- data/lib/rouge/lexers/msgtrans.rb +26 -0
- data/lib/rouge/lexers/ocaml.rb +12 -48
- data/lib/rouge/lexers/ocaml/common.rb +53 -0
- data/lib/rouge/lexers/opentype_feature_file.rb +113 -0
- data/lib/rouge/lexers/php.rb +31 -9
- data/lib/rouge/lexers/php/builtins.rb +181 -174
- data/lib/rouge/lexers/plain_text.rb +1 -1
- data/lib/rouge/lexers/puppet.rb +2 -2
- data/lib/rouge/lexers/r.rb +2 -3
- data/lib/rouge/lexers/reasonml.rb +65 -0
- data/lib/rouge/lexers/rust.rb +12 -9
- data/lib/rouge/lexers/sas.rb +563 -0
- data/lib/rouge/lexers/sed.rb +1 -1
- data/lib/rouge/lexers/smarty.rb +10 -10
- data/lib/rouge/tex_theme_renderer.rb +5 -1
- data/lib/rouge/themes/magritte.rb +3 -3
- data/lib/rouge/themes/thankful_eyes.rb +1 -1
- data/lib/rouge/themes/tulip.rb +1 -1
- data/lib/rouge/version.rb +1 -1
- data/rouge.gemspec +4 -3
- metadata +38 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4041f8ac950b427b35d8d3147b6d9aed3743655daaaf09f57d303932b11259a6
|
4
|
+
data.tar.gz: cddd94af18b0f7ba578fa4c57f75415233d5518095b29202a7c12afd2662b804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b649f1f965e5cd21fd722263bdff8720ba04119b8fff2245bb9c4178648d255362c3a18129c6724dd56893f777a518d1ff74ade223697530f5a6595d20f2aa
|
7
|
+
data.tar.gz: 182df2ef3e868eb95132022309db218e34f2cd19e9e874a7d119f6250db0971e7ba6fd28ddea2ebfa8fdb759504dfe8a8401e085e95386748c7a00de347fc5d9
|
data/Gemfile
CHANGED
data/lib/rouge/demos/ada
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
with Ada.Directories;
|
2
|
+
with Ada.Direct_IO;
|
3
|
+
with Ada.Text_IO;
|
4
|
+
|
5
|
+
procedure Extra_IO.Read_File (Name : String) is
|
6
|
+
|
7
|
+
package Dirs renames Ada.Directories;
|
8
|
+
package Text_IO renames Ada.Text_IO;
|
9
|
+
|
10
|
+
-- Get the size of the file for a new string.
|
11
|
+
Size : Natural := Natural (Dirs.Size (Name));
|
12
|
+
subtype File_String is String (1 .. Size);
|
13
|
+
|
14
|
+
-- Instantiate Direct_IO for our file type.
|
15
|
+
package FIO is new Ada.Direct_IO (File_String);
|
16
|
+
|
17
|
+
File : FIO.File_Type;
|
18
|
+
Contents : File_String;
|
19
|
+
|
20
|
+
begin
|
21
|
+
FIO.Open (File, FIO.In_File, Name);
|
22
|
+
FIO.Read (File, Contents);
|
23
|
+
FIO.Close (File);
|
24
|
+
|
25
|
+
Text_IO.Put (Contents);
|
26
|
+
end Extra_IO.Read_File;
|
data/lib/rouge/demos/epp
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
extends Node
|
2
|
+
|
3
|
+
# Variables & Built-in Types
|
4
|
+
|
5
|
+
var a = 5
|
6
|
+
var b = true
|
7
|
+
var s = "Hello"
|
8
|
+
var arr = [1, 2, 3]
|
9
|
+
|
10
|
+
# Constants & Enums
|
11
|
+
|
12
|
+
const ANSWER = 42
|
13
|
+
enum { UNIT_NEUTRAL, UNIT_ENEMY, UNIT_ALLY }
|
14
|
+
|
15
|
+
# Functions
|
16
|
+
|
17
|
+
func _ready():
|
18
|
+
print("Hello, World")
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# These are our own config values defined by the app
|
2
|
+
simple-app {
|
3
|
+
answer = 42
|
4
|
+
}
|
5
|
+
|
6
|
+
# Here we override some values used by a library
|
7
|
+
simple-lib.foo = "This value comes from simple-app's application.conf"
|
8
|
+
simple-lib.whatever = "This value comes from simple-app's application.conf"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%doc>
|
2
|
+
This is a mason component.
|
3
|
+
# This is a comment.
|
4
|
+
</%doc>
|
5
|
+
|
6
|
+
<%args>
|
7
|
+
$color # this argument is required!
|
8
|
+
$size => 20 # default size
|
9
|
+
$country => undef # this argument is optional, default value is 'undef'
|
10
|
+
@items => (1, 2, 'something else')
|
11
|
+
%pairs => (name => "John", age => 29)
|
12
|
+
</%args>
|
13
|
+
|
14
|
+
% # A random block of Perl code
|
15
|
+
<%perl>
|
16
|
+
my @people = ('mary' 'john' 'pete' 'david');
|
17
|
+
</%perl>
|
18
|
+
|
19
|
+
% # Note how each line of code begins with the mandatory %
|
20
|
+
% foreach my $person (@people) {
|
21
|
+
Name: <% $person %>
|
22
|
+
% }
|
data/lib/rouge/demos/plist
CHANGED
@@ -5,138 +5,7 @@
|
|
5
5
|
};
|
6
6
|
objectVersion = 46;
|
7
7
|
objects = {
|
8
|
-
|
9
|
-
/* Begin PBXGroup section */
|
10
|
-
1D67B9537FE4C81097096F85 /* Frameworks */ = {
|
11
|
-
isa = PBXGroup;
|
12
|
-
children = (
|
13
|
-
);
|
14
|
-
name = Frameworks;
|
15
|
-
sourceTree = "<group>";
|
16
|
-
};
|
17
|
-
74946460D3EE9E1FA4792785 = {
|
18
|
-
isa = PBXGroup;
|
19
|
-
children = (
|
20
|
-
E3060171E73473A889949AB5 /* Products */,
|
21
|
-
1D67B9537FE4C81097096F85 /* Frameworks */,
|
22
|
-
);
|
23
|
-
sourceTree = "<group>";
|
24
|
-
};
|
25
|
-
E3060171E73473A889949AB5 /* Products */ = {
|
26
|
-
isa = PBXGroup;
|
27
|
-
children = (
|
28
|
-
);
|
29
|
-
name = Products;
|
30
|
-
sourceTree = "<group>";
|
31
|
-
};
|
32
|
-
/* End PBXGroup section */
|
33
|
-
|
34
|
-
/* Begin PBXProject section */
|
35
|
-
B3A67937542EC2041CBF1CA2 /* Project object */ = {
|
36
|
-
isa = PBXProject;
|
37
|
-
attributes = {
|
38
|
-
LastSwiftUpdateCheck = 0730;
|
39
|
-
LastUpgradeCheck = 0700;
|
40
|
-
};
|
41
|
-
buildConfigurationList = 442CE273DD7DF2DFDC620C8B /* Build configuration list for PBXProject "foo" */;
|
42
|
-
compatibilityVersion = "Xcode 3.2";
|
43
|
-
developmentRegion = English;
|
44
|
-
hasScannedForEncodings = 0;
|
45
|
-
knownRegions = (
|
46
|
-
en,
|
47
|
-
);
|
48
|
-
mainGroup = 74946460D3EE9E1FA4792785;
|
49
|
-
productRefGroup = E3060171E73473A889949AB5 /* Products */;
|
50
|
-
projectDirPath = "";
|
51
|
-
projectRoot = "";
|
52
|
-
targets = (
|
53
|
-
);
|
54
|
-
};
|
55
|
-
/* End PBXProject section */
|
56
|
-
|
57
|
-
/* Begin XCBuildConfiguration section */
|
58
|
-
09AC0D63F19B6944E1045E60 /* Release */ = {
|
59
|
-
isa = XCBuildConfiguration;
|
60
|
-
buildSettings = {
|
61
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
62
|
-
CLANG_ANALYZER_NONNULL = YES;
|
63
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
64
|
-
CLANG_CXX_LIBRARY = "libc++";
|
65
|
-
CLANG_ENABLE_MODULES = YES;
|
66
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
67
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
68
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
69
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
|
70
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
71
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
72
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
73
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES;
|
74
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
75
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
76
|
-
COPY_PHASE_STRIP = YES;
|
77
|
-
ENABLE_NS_ASSERTIONS = NO;
|
78
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
79
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
80
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
81
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
82
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
83
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
84
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
85
|
-
VALIDATE_PRODUCT = YES;
|
86
|
-
};
|
87
|
-
name = Release;
|
88
|
-
};
|
89
|
-
4D494CA5F82DCCAB3194BA09 /* Debug */ = {
|
90
|
-
isa = XCBuildConfiguration;
|
91
|
-
buildSettings = {
|
92
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
93
|
-
CLANG_ANALYZER_NONNULL = YES;
|
94
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
95
|
-
CLANG_CXX_LIBRARY = "libc++";
|
96
|
-
CLANG_ENABLE_MODULES = YES;
|
97
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
98
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
99
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
100
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
|
101
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
102
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
103
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
104
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES;
|
105
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
106
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
107
|
-
COPY_PHASE_STRIP = NO;
|
108
|
-
ENABLE_TESTABILITY = YES;
|
109
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
110
|
-
GCC_DYNAMIC_NO_PIC = NO;
|
111
|
-
GCC_OPTIMIZATION_LEVEL = 0;
|
112
|
-
GCC_PREPROCESSOR_DEFINITIONS = (
|
113
|
-
"DEBUG=1",
|
114
|
-
"$(inherited)",
|
115
|
-
);
|
116
|
-
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
117
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
118
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
119
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
120
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
121
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
122
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
123
|
-
ONLY_ACTIVE_ARCH = YES;
|
124
|
-
};
|
125
|
-
name = Debug;
|
126
|
-
};
|
127
|
-
/* End XCBuildConfiguration section */
|
128
|
-
|
129
|
-
/* Begin XCConfigurationList section */
|
130
|
-
442CE273DD7DF2DFDC620C8B /* Build configuration list for PBXProject "foo" */ = {
|
131
|
-
isa = XCConfigurationList;
|
132
|
-
buildConfigurations = (
|
133
|
-
4D494CA5F82DCCAB3194BA09 /* Debug */,
|
134
|
-
09AC0D63F19B6944E1045E60 /* Release */,
|
135
|
-
);
|
136
|
-
defaultConfigurationIsVisible = 0;
|
137
|
-
defaultConfigurationName = Release;
|
138
|
-
};
|
139
|
-
/* End XCConfigurationList section */
|
8
|
+
/* ... */
|
140
9
|
};
|
141
10
|
rootObject = B3A67937542EC2041CBF1CA2 /* Project object */;
|
142
11
|
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/* I like a teacher who gives you something to take
|
2
|
+
home to think about besides homework. */
|
3
|
+
let gpa_score = 5.0;
|
4
|
+
type schoolPerson = Teacher | Director | Student(string);
|
5
|
+
|
6
|
+
let greeting = person =>
|
7
|
+
switch (person) {
|
8
|
+
| Teacher => "Hey Professor!"
|
9
|
+
| Director => "Hello Director."
|
10
|
+
| Student("Richard") => "Still here Ricky?"
|
11
|
+
| Student(anyOtherName) => "Hey, " ++ anyOtherName ++ "."
|
12
|
+
};
|
data/lib/rouge/demos/sas
ADDED
@@ -37,7 +37,9 @@ module Rouge
|
|
37
37
|
token_lines(tokens) do |line_tokens|
|
38
38
|
lineno += 1
|
39
39
|
buffer << %(<tr id="#{sprintf @line_id, lineno}" class="#@line_class">)
|
40
|
-
buffer << %(<td class="#@gutter_class gl"
|
40
|
+
buffer << %(<td class="#@gutter_class gl" )
|
41
|
+
buffer << %(style="-moz-user-select: none;-ms-user-select: none;)
|
42
|
+
buffer << %(-webkit-user-select: none;user-select: none;">)
|
41
43
|
buffer << %(<pre>#{lineno}</pre></td>)
|
42
44
|
buffer << %(<td class="#@code_class"><pre>)
|
43
45
|
@formatter.stream(line_tokens) { |formatted| buffer << formatted }
|
data/lib/rouge/formatters/tex.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
1
4
|
module Rouge
|
2
5
|
module Formatters
|
3
6
|
class Tex < Formatter
|
@@ -19,6 +22,9 @@ module Rouge
|
|
19
22
|
'^' => '{\textasciicircum}',
|
20
23
|
'|' => '{\textbar}',
|
21
24
|
'\\' => '{\textbackslash}',
|
25
|
+
'`' => '{\textasciigrave}',
|
26
|
+
"'" => "'{}",
|
27
|
+
'"' => '"{}',
|
22
28
|
"\t" => '{\tab}',
|
23
29
|
}
|
24
30
|
|
@@ -56,24 +62,20 @@ module Rouge
|
|
56
62
|
end
|
57
63
|
|
58
64
|
def render_line(line, &b)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
tag_first(*head, &b)
|
63
|
-
rest.each do |(tok, val)|
|
64
|
-
yield tag(tok, val)
|
65
|
+
line.each do |(tok, val)|
|
66
|
+
hphantom_tag(tok, val, &b)
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
def
|
70
|
+
# Special handling for leading spaces, since they may be gobbled
|
71
|
+
# by a previous command. We replace all initial spaces with
|
72
|
+
# \hphantom{xxxx}, which renders an empty space equal to the size
|
73
|
+
# of the x's.
|
74
|
+
def hphantom_tag(tok, val)
|
73
75
|
leading = nil
|
74
76
|
val.sub!(/^[ ]+/) { leading = $&.size; '' }
|
75
77
|
yield "\\hphantom{#{'x' * leading}}" if leading
|
76
|
-
yield tag(tok, val)
|
78
|
+
yield tag(tok, val) unless val.empty?
|
77
79
|
end
|
78
80
|
|
79
81
|
def tag(tok, val)
|
@@ -75,6 +75,8 @@ module Rouge
|
|
75
75
|
disambiguate '*.h' do
|
76
76
|
next ObjectiveC if matches?(/@(end|implementation|protocol|property)\b/)
|
77
77
|
next ObjectiveC if contains?('@"')
|
78
|
+
next Cpp if matches?(/^\s*(?:catch|class|constexpr|namespace|private|
|
79
|
+
protected|public|template|throw|try|using)\b/x)
|
78
80
|
|
79
81
|
C
|
80
82
|
end
|
@@ -86,7 +88,11 @@ module Rouge
|
|
86
88
|
next Mathematica if contains?('(*')
|
87
89
|
next Mathematica if contains?(':=')
|
88
90
|
|
91
|
+
next Mason if matches?(/<%(def|method|text|doc|args|flags|attr|init|once|shared|perl|cleanup|filter)([^>]*)(>)/)
|
92
|
+
|
89
93
|
next Matlab if matches?(/^\s*?%/)
|
94
|
+
|
95
|
+
next Mason if matches? %r!(</?%|<&)!
|
90
96
|
end
|
91
97
|
|
92
98
|
disambiguate '*.php' do
|
@@ -114,6 +120,12 @@ module Rouge
|
|
114
120
|
|
115
121
|
next Python
|
116
122
|
end
|
123
|
+
|
124
|
+
disambiguate 'Messages' do
|
125
|
+
next MsgTrans if matches?(/^[^\s:]+:[^\s:]+/)
|
126
|
+
|
127
|
+
next PlainText
|
128
|
+
end
|
117
129
|
end
|
118
130
|
end
|
119
131
|
end
|