From b67058ad532f7a17c14871fb6c5cf2fea8df0c34 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Thu, 4 Feb 2021 23:34:36 -0500 Subject: [PATCH 1/3] enh(scala) fix triple quoted string --- CHANGES.md | 3 ++- src/languages/scala.js | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 60b97a9bac..762d7ce286 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +6,8 @@ New Languages: Language grammar improvements: -- env(perl) Much improved regex detection (#2960) [Josh Goebel][] +- enh(scala) fix triple quoted strings [Josh Goebel][] +- enh(perl) Much improved regex detection (#2960) [Josh Goebel][] - enh(swift) Improved highlighting for operator and precedencegroup declarations. (#2938) [Steven Van Impe][] - fix(xml) Support single-character namespaces. (#2957) [Jan Pilzer][] - enh(ruby) Support for character literals (#2950) [Vaibhav Chanana][] diff --git a/src/languages/scala.js b/src/languages/scala.js index 817d834512..69aa988a24 100644 --- a/src/languages/scala.js +++ b/src/languages/scala.js @@ -29,23 +29,24 @@ export default function(hljs) { const STRING = { className: 'string', variants: [ + { + begin: '"""', + end: '"""' + }, { begin: '"', end: '"', illegal: '\\n', contains: [ hljs.BACKSLASH_ESCAPE ] }, - { - begin: '"""', - end: '"""', - relevance: 10 - }, { begin: '[a-z]+"', end: '"', illegal: '\\n', - contains: [ hljs.BACKSLASH_ESCAPE, - SUBST ] + contains: [ + hljs.BACKSLASH_ESCAPE, + SUBST + ] }, { className: 'string', From 82176538afc21414555bfebe550784a5473e3359 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Thu, 4 Feb 2021 23:35:25 -0500 Subject: [PATCH 2/3] add pr --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 762d7ce286..a2c9720629 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +6,7 @@ New Languages: Language grammar improvements: -- enh(scala) fix triple quoted strings [Josh Goebel][] +- enh(scala) fix triple quoted strings (#2987) [Josh Goebel][] - enh(perl) Much improved regex detection (#2960) [Josh Goebel][] - enh(swift) Improved highlighting for operator and precedencegroup declarations. (#2938) [Steven Van Impe][] - fix(xml) Support single-character namespaces. (#2957) [Jan Pilzer][] From fa5ad8751a08c1470744837aacfb6a4e74a38e50 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Thu, 4 Feb 2021 23:37:13 -0500 Subject: [PATCH 3/3] add initialtests --- test/markup/scala/strings.expect.txt | 1 + test/markup/scala/strings.txt | 1 + 2 files changed, 2 insertions(+) create mode 100644 test/markup/scala/strings.expect.txt create mode 100644 test/markup/scala/strings.txt diff --git a/test/markup/scala/strings.expect.txt b/test/markup/scala/strings.expect.txt new file mode 100644 index 0000000000..43bb021949 --- /dev/null +++ b/test/markup/scala/strings.expect.txt @@ -0,0 +1 @@ +val s = """ this is a string "this is still a string" another quote: " after the quote """ diff --git a/test/markup/scala/strings.txt b/test/markup/scala/strings.txt new file mode 100644 index 0000000000..26a45b3f58 --- /dev/null +++ b/test/markup/scala/strings.txt @@ -0,0 +1 @@ +val s = """ this is a string "this is still a string" another quote: " after the quote """