Skip to content

Commit 70fd1cd

Browse files
committed
Update Disable GraalPython patch
1 parent 7de0c9d commit 70fd1cd

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

util/Disable-GraalPython.patch

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
From 8dc0a7ea50bb88c18292c43003f6e5c00ecdf452 Mon Sep 17 00:00:00 2001
1+
From 63822eb57c371d3e1a8ee3f3e7d7936d975ace33 Mon Sep 17 00:00:00 2001
22
From: EXL <exlmotodev@gmail.com>
3-
Date: Thu, 17 Dec 2020 22:02:36 +0700
4-
Subject: [PATCH 2/2] Disable GraalPython
3+
Date: Tue, 19 Jan 2021 19:35:37 +0700
4+
Subject: [PATCH] Disable GraalPython
55

66
---
7-
.../code/highlight/HighlightService.java | 30 +++++++++----------
8-
.../code/highlight/enumeration/Mode.java | 19 ++++++------
7+
.../code/highlight/HighlightService.java | 36 +++++++++----------
8+
.../code/highlight/enumeration/Mode.java | 19 +++++-----
99
.../code/highlight/HighlightServiceTest.java | 6 ++--
1010
.../highlight/enumeration/ModeUnitTest.java | 6 ++--
11-
4 files changed, 31 insertions(+), 30 deletions(-)
11+
4 files changed, 34 insertions(+), 33 deletions(-)
1212

1313
diff --git a/src/main/java/ru/exlmoto/code/highlight/HighlightService.java b/src/main/java/ru/exlmoto/code/highlight/HighlightService.java
14-
index 1044a3e..2ef4276 100644
14+
index bd1b174..e759d82 100644
1515
--- a/src/main/java/ru/exlmoto/code/highlight/HighlightService.java
1616
+++ b/src/main/java/ru/exlmoto/code/highlight/HighlightService.java
17-
@@ -15,7 +15,7 @@ import ru.exlmoto.code.helper.UtilityHelper;
17+
@@ -39,7 +39,7 @@ import ru.exlmoto.code.helper.UtilityHelper;
1818
import ru.exlmoto.code.highlight.enumeration.Mode;
1919
import ru.exlmoto.code.highlight.filter.HighlightFilter;
2020
import ru.exlmoto.code.highlight.implementation.HighlightJs;
@@ -23,7 +23,7 @@ index 1044a3e..2ef4276 100644
2323
import ru.exlmoto.code.highlight.implementation.HighlightRouge;
2424
import ru.exlmoto.code.highlight.parser.Options;
2525
import ru.exlmoto.code.highlight.parser.OptionsParser;
26-
@@ -28,7 +28,7 @@ import java.util.Map;
26+
@@ -52,7 +52,7 @@ import java.util.Map;
2727

2828
import static ru.exlmoto.code.highlight.enumeration.Mode.HighlightJs;
2929
import static ru.exlmoto.code.highlight.enumeration.Mode.HighlightRouge;
@@ -32,7 +32,7 @@ index 1044a3e..2ef4276 100644
3232
//import static ru.exlmoto.code.highlight.enumeration.Mode.HighlightPygmentsJython;
3333

3434
@Service
35-
@@ -43,7 +43,7 @@ public class HighlightService {
35+
@@ -67,7 +67,7 @@ public class HighlightService {
3636
private final CodeConfiguration config;
3737

3838
private final HighlightJs highlightJs;
@@ -41,7 +41,7 @@ index 1044a3e..2ef4276 100644
4141
private final HighlightRouge highlightRouge;
4242

4343
private final Map<Mode, Pair<String, String>> versions;
44-
@@ -54,7 +54,7 @@ public class HighlightService {
44+
@@ -78,7 +78,7 @@ public class HighlightService {
4545
UtilityHelper util,
4646
CodeConfiguration config,
4747
HighlightJs highlightJs,
@@ -50,7 +50,7 @@ index 1044a3e..2ef4276 100644
5050
HighlightRouge highlightRouge) {
5151
this.context = context;
5252
this.optionsParser = optionsParser;
53-
@@ -62,7 +62,7 @@ public class HighlightService {
53+
@@ -86,7 +86,7 @@ public class HighlightService {
5454
this.util = util;
5555
this.config = config;
5656
this.highlightJs = highlightJs;
@@ -59,7 +59,7 @@ index 1044a3e..2ef4276 100644
5959
this.highlightRouge = highlightRouge;
6060

6161
this.versions = new HashMap<>();
62-
@@ -81,10 +81,10 @@ public class HighlightService {
62+
@@ -105,10 +105,10 @@ public class HighlightService {
6363
versions.get(HighlightRouge).getFirst(), versions.get(HighlightRouge).getSecond()));
6464

6565
// highlightPygments.setUseJython(false);
@@ -74,7 +74,7 @@ index 1044a3e..2ef4276 100644
7474

7575
// highlightPygments.setUseJython(true);
7676
// versions.put(HighlightPygmentsJython,
77-
@@ -104,8 +104,8 @@ public class HighlightService {
77+
@@ -128,8 +128,8 @@ public class HighlightService {
7878
highlightRouge.generateCssStyle("base16")
7979
.ifPresent((css) -> log.info(HighlightRouge.name() + ":\n" + css + "\n---\n"));
8080
// highlightPygments.setUseJython(false);
@@ -85,21 +85,27 @@ index 1044a3e..2ef4276 100644
8585
// highlightPygments.setUseJython(true);
8686
// highlightPygments.generateCssStyle("vim")
8787
// .ifPresent((css) -> log.info(HighlightPygmentsJython.name() + ":\n" + css + "\n---\n"));
88-
@@ -169,10 +169,10 @@ public class HighlightService {
89-
case HighlightRouge: {
90-
return highlightRouge.renderHtmlFromCode(options.getLanguage(), code).orElseThrow(() -> error);
88+
@@ -203,13 +203,13 @@ public class HighlightService {
89+
highlightRouge.renderHtmlFromCode(options.getLanguage(), code).orElseThrow(() -> error)
90+
);
9191
}
9292
-case HighlightPygments: {
9393
+// case HighlightPygments: {
9494
// highlightPygments.setUseJython(false);
95-
-return highlightPygments.renderHtmlFromCode(options.getLanguage(), code).orElseThrow(() -> error);
95+
-return Pair.of(
96+
-true,
97+
-highlightPygments.renderHtmlFromCode(options.getLanguage(), code).orElseThrow(() -> error)
98+
-);
9699
-}
97-
+// return highlightPygments.renderHtmlFromCode(options.getLanguage(), code).orElseThrow(() -> error);
100+
+// return Pair.of(
101+
+// true,
102+
+// highlightPygments.renderHtmlFromCode(options.getLanguage(), code).orElseThrow(() -> error)
103+
+// );
98104
+// }
99105
// case HighlightPygmentsJython: {
100106
// highlightPygments.setUseJython(true);
101107
// return highlightPygments.renderHtmlFromCode(options.getLanguage(), code).orElseThrow(() -> error);
102-
@@ -194,7 +194,7 @@ public class HighlightService {
108+
@@ -230,7 +230,7 @@ public class HighlightService {
103109
this.versions = new HashMap<>();
104110
versions.put(HighlightJs, Pair.of("20.3.0", "10.0.1"));
105111
versions.put(HighlightRouge, Pair.of("2.6.6", "3.1.0"));
@@ -109,10 +115,10 @@ index 1044a3e..2ef4276 100644
109115
}
110116

111117
diff --git a/src/main/java/ru/exlmoto/code/highlight/enumeration/Mode.java b/src/main/java/ru/exlmoto/code/highlight/enumeration/Mode.java
112-
index fe0edfd..6ffdb0a 100644
118+
index 24e398d..e88a9e4 100644
113119
--- a/src/main/java/ru/exlmoto/code/highlight/enumeration/Mode.java
114120
+++ b/src/main/java/ru/exlmoto/code/highlight/enumeration/Mode.java
115-
@@ -8,7 +8,8 @@ public enum Mode {
121+
@@ -32,7 +32,8 @@ public enum Mode {
116122
HighlightJs,
117123
HighlightRouge,
118124
// HighlightPygmentsJython,
@@ -122,7 +128,7 @@ index fe0edfd..6ffdb0a 100644
122128

123129
public static String getName(Mode mode) {
124130
switch (mode) {
125-
@@ -17,9 +18,9 @@ public enum Mode {
131+
@@ -41,9 +42,9 @@ public enum Mode {
126132
return "Highlight.js";
127133
case HighlightRouge:
128134
return "Rouge";
@@ -134,7 +140,7 @@ index fe0edfd..6ffdb0a 100644
134140
}
135141
}
136142

137-
@@ -28,7 +29,7 @@ public enum Mode {
143+
@@ -52,7 +53,7 @@ public enum Mode {
138144
default:
139145
case HighlightJs:
140146
case HighlightRouge:
@@ -143,7 +149,7 @@ index fe0edfd..6ffdb0a 100644
143149
return "GraalVM";
144150
// case HighlightPygmentsJython:
145151
// return "Jython";
146-
@@ -44,8 +45,8 @@ public enum Mode {
152+
@@ -68,8 +69,8 @@ public enum Mode {
147153
return "code.table.moderate";
148154
// case HighlightPygmentsJython:
149155
// return "code.table.slow";
@@ -154,7 +160,7 @@ index fe0edfd..6ffdb0a 100644
154160
}
155161
}
156162

157-
@@ -56,9 +57,9 @@ public enum Mode {
163+
@@ -80,9 +81,9 @@ public enum Mode {
158164
return "JavaScript";
159165
case HighlightRouge:
160166
return "Ruby";
@@ -166,7 +172,7 @@ index fe0edfd..6ffdb0a 100644
166172
}
167173
}
168174

169-
@@ -74,7 +75,7 @@ public enum Mode {
175+
@@ -98,7 +99,7 @@ public enum Mode {
170176
public static String getCss(Mode mode, Skin theme) {
171177
switch (mode) {
172178
case HighlightRouge:
@@ -176,10 +182,10 @@ index fe0edfd..6ffdb0a 100644
176182
return "static/css/" + theme.name() + "/merged.css";
177183
}
178184
diff --git a/src/test/java/ru/exlmoto/code/highlight/HighlightServiceTest.java b/src/test/java/ru/exlmoto/code/highlight/HighlightServiceTest.java
179-
index 3f53477..d51de50 100644
185+
index 2889c57..14bf848 100644
180186
--- a/src/test/java/ru/exlmoto/code/highlight/HighlightServiceTest.java
181187
+++ b/src/test/java/ru/exlmoto/code/highlight/HighlightServiceTest.java
182-
@@ -53,14 +53,14 @@ class HighlightServiceTest {
188+
@@ -77,14 +77,14 @@ class HighlightServiceTest {
183189
resource.readFileToString("classpath:/expected/HighlightJs/" + filename + ".html.txt");
184190
String htmlRouge =
185191
resource.readFileToString("classpath:/expected/Rouge/" + filename + ".html.txt");
@@ -198,10 +204,10 @@ index 3f53477..d51de50 100644
198204
}
199205

200206
diff --git a/src/test/java/ru/exlmoto/code/highlight/enumeration/ModeUnitTest.java b/src/test/java/ru/exlmoto/code/highlight/enumeration/ModeUnitTest.java
201-
index 0a6f286..7562bd2 100644
207+
index 61cd501..62f0744 100644
202208
--- a/src/test/java/ru/exlmoto/code/highlight/enumeration/ModeUnitTest.java
203209
+++ b/src/test/java/ru/exlmoto/code/highlight/enumeration/ModeUnitTest.java
204-
@@ -14,7 +14,7 @@ class ModeUnitTest {
210+
@@ -38,7 +38,7 @@ class ModeUnitTest {
205211
assertEquals(Mode.HighlightJs, Mode.getMode(" "));
206212
assertEquals(Mode.HighlightJs, Mode.getMode("unknown"));
207213
assertEquals(Mode.HighlightJs, Mode.getMode("HighlightJs"));
@@ -210,7 +216,7 @@ index 0a6f286..7562bd2 100644
210216
// assertEquals(Mode.HighlightPygmentsJython, Mode.getMode("HighlightPygmentsJython"));
211217
assertEquals(Mode.HighlightRouge, Mode.getMode("HighlightRouge"));
212218
}
213-
@@ -22,11 +22,11 @@ class ModeUnitTest {
219+
@@ -46,11 +46,11 @@ class ModeUnitTest {
214220
@Test
215221
public void testGetCss() {
216222
assertEquals("static/css/techno/hjs.css", Mode.getCss(Mode.HighlightJs, Skin.techno));

0 commit comments

Comments
 (0)