Skip to content

Commit e768e5c

Browse files
authored
Add Kotlin to language comment-character maps (#14482)
Adds kotlin (//) to the language comment-character maps in constants.lua, partition-cell-options.ts, jupyter.ts, notebook.py, and hooks.R, plus an entry in the smoke-all language-support test. Closes #14472.
1 parent 8724216 commit e768e5c

7 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎news/changelog-1.10.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ All changes included in 1.10:
6969
- ([#14255](https://github.com/quarto-dev/quarto-cli/issues/14255)): Fix shortcodes inside inline and display math expressions not being resolved.
7070
- ([#14342](https://github.com/quarto-dev/quarto-cli/issues/14342)): Work around TOCTOU race in Deno's `expandGlobSync` that can cause unexpected exceptions to be raised while traversing directories during project initialization.
7171
- ([#14445](https://github.com/quarto-dev/quarto-cli/issues/14445)): Fix intermittent `Uncaught (in promise) TypeError: Writable stream is closed or errored.` aborting renders on Linux. `execProcess` now awaits and swallows the rejection from `process.stdin.close()` when the child closes its stdin first. The captured stderr is now also surfaced when `typst-gather analyze` falls back to staging all packages, so failures are diagnosable without bypassing `quarto`.
72-
- ([#14359](https://github.com/quarto-dev/quarto-cli/issues/14359)): Fix intermediate `.quarto_ipynb` file not being deleted after rendering a `.qmd` with Jupyter engine, causing numbered variants (`_1`, `_2`, ...) to accumulate on disk across renders.
72+
- ([#14359](https://github.com/quarto-dev/quarto-cli/issues/14359)): Fix intermediate `.quarto_ipynb` file not being deleted after rendering a `.qmd` with Jupyter engine, causing numbered variants (`_1`, `_2`, ...) to accumulate on disk across renders.
73+
- ([#14472](https://github.com/quarto-dev/quarto-cli/issues/14472)): Add support for Kotlin in code annotations and YAML cell options. (author: @barendgehrels)

‎src/core/jupyter/jupyter.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,7 @@ const kLangCommentChars: Record<string, string | string[]> = {
12331233
stata: "*",
12341234
java: "//",
12351235
groovy: "//",
1236+
kotlin: "//",
12361237
sed: "#",
12371238
perl: "#",
12381239
ruby: "#",

‎src/core/lib/partition-cell-options.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ export const kLangCommentChars: Record<string, string | [string, string]> = {
335335
stata: "*",
336336
java: "//",
337337
groovy: "//",
338+
kotlin: "//",
338339
sed: "#",
339340
perl: "#",
340341
prql: "#",

‎src/resources/filters/modules/constants.lua‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ local kLangCommentChars = {
102102
js = {"//"},
103103
json = {"//"},
104104
julia = {"#"},
105+
kotlin = {"//"},
105106
latex = {"%"},
106107
lua = {"--"},
107108
markdown = {"<!--", "-->"},

‎src/resources/jupyter/notebook.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ def nb_language_comment_chars(lang):
884884
stata="*",
885885
java="//",
886886
groovy="//",
887+
kotlin="//",
887888
sed="#",
888889
perl="#",
889890
ruby="#",

‎src/resources/rmd/hooks.R‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ engine_comment_chars <- function(engine) {
10311031
stata = "*",
10321032
java = "//",
10331033
groovy = "//",
1034+
kotlin = "//",
10341035
sed = "#",
10351036
perl = "#",
10361037
ruby = "#",

‎tests/docs/smoke-all/code-annotations/code-annotations-language-support.qmd‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ _quarto:
3434
- "[data-filename='JS'] .code-annotation-code, .code-annotation-code[data-filename='JS']"
3535
- "[data-filename='JSON'] .code-annotation-code, .code-annotation-code[data-filename='JSON']"
3636
- "[data-filename='Julia'] .code-annotation-code, .code-annotation-code[data-filename='Julia']"
37+
- "[data-filename='Kotlin'] .code-annotation-code, .code-annotation-code[data-filename='Kotlin']"
3738
- "[data-filename='LaTeX'] .code-annotation-code, .code-annotation-code[data-filename='LaTeX']"
3839
- "[data-filename='Lua'] .code-annotation-code, .code-annotation-code[data-filename='Lua']"
3940
- "[data-filename='Markdown'] .code-annotation-code, .code-annotation-code[data-filename='Markdown']"
@@ -68,7 +69,7 @@ _quarto:
6869
- []
6970
---
7071

71-
This test verifies code annotation support for all 49 languages from `src/resources/filters/modules/constants.lua`.
72+
This test verifies code annotation support for all 50 languages from `src/resources/filters/modules/constants.lua`.
7273

7374
## APL
7475

@@ -270,6 +271,13 @@ x = 1 # <1>
270271
```
271272
1. Julia annotation.
272273

274+
## Kotlin
275+
276+
```{.kotlin filename="Kotlin"}
277+
fun main() { println("hello") } // <1>
278+
```
279+
1. Kotlin annotation.
280+
273281
## LaTeX
274282

275283
```{.latex filename="LaTeX"}

0 commit comments

Comments
 (0)