[education/rkward] /: Document the possibility to use template literals in JS
Thomas Friedrichsmeier
null at kde.org
Wed May 7 14:21:37 BST 2025
Git commit a1bb46e6adea21e0bd4318d9e449e0b118d7a26f by Thomas Friedrichsmeier.
Committed on 07/05/2025 at 13:21.
Pushed by tfry into branch 'master'.
Document the possibility to use template literals in JS
M +1 -1 doc/rkwardplugins/CMakeLists.txt
M +6 -0 doc/rkwardplugins/index.docbook
M +1 -1 rkward/plugins/00saveload/setworkdir.js
https://invent.kde.org/education/rkward/-/commit/a1bb46e6adea21e0bd4318d9e449e0b118d7a26f
diff --git a/doc/rkwardplugins/CMakeLists.txt b/doc/rkwardplugins/CMakeLists.txt
index 15bb37b3c..b4723fd48 100644
--- a/doc/rkwardplugins/CMakeLists.txt
+++ b/doc/rkwardplugins/CMakeLists.txt
@@ -7,5 +7,5 @@
kdoctools_create_handbook (index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR rkwardplugins)
ADD_CUSTOM_TARGET (webdocs
- COMMAND meinproc5 --stylesheet customization/kde-web.xsl ${CMAKE_CURRENT_SOURCE_DIR}/index.docbook
+ COMMAND meinproc6 --stylesheet customization/kde-web.xsl ${CMAKE_CURRENT_SOURCE_DIR}/index.docbook
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/doc/rkwardplugins/index.docbook b/doc/rkwardplugins/index.docbook
index 3c3d33da8..7b1fa3041 100644
--- a/doc/rkwardplugins/index.docbook
+++ b/doc/rkwardplugins/index.docbook
@@ -566,6 +566,12 @@ res <- t.test (
<para>
[suppressed due to size limit]
</para>
+ <note>
+ <para>Instead concatenating strings using the <command>+</command> operator, you can also use a "template literal", like this (note the string is enclosed in backticks (`)):</para>
+ <programlisting>
+echo(`res <- t.test (x=${ getString("x") }, y=${ getString("y") }, hypothesis="${ getString("hypothesis") }"`); // etc.
+ </programlisting>
+ </note>
<para>
Note that instead of concatenating the output snippets with <quote>+</quote>, you can also use several <function>echo()</function> statements. Everything is printed on a single line. To produce a line break in the generated code, insert a <replaceable>"\n"</replaceable> in the echoed string. In theory, you can even produce many lines with a single echo-statement, but please keep it to one line (or less) of generated code per <function>echo()</function>.
</para>
diff --git a/rkward/plugins/00saveload/setworkdir.js b/rkward/plugins/00saveload/setworkdir.js
index df75ff50d..24de0877d 100644
--- a/rkward/plugins/00saveload/setworkdir.js
+++ b/rkward/plugins/00saveload/setworkdir.js
@@ -4,5 +4,5 @@ SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
function calculate() {
- echo('setwd("' + getValue("dir") + '")\n');
+ echo(`setwd("${ getValue("dir") }")\n`);
}
More information about the kde-doc-english
mailing list