[education/rkward/snippets] rkward: several Chucks and commends added
Stefan Rödiger
null at kde.org
Sat Jun 18 14:08:11 BST 2022
Git commit c8444cf747da14ff1bd3c46ec22b7a9544506ff7 by Stefan Rödiger.
Committed on 18/06/2022 at 13:03.
Pushed by srodiger into branch 'snippets'.
several Chucks and commends added
M +57 -4 rkward/RKWardRMd.xml
https://invent.kde.org/education/rkward/commit/c8444cf747da14ff1bd3c46ec22b7a9544506ff7
diff --git a/rkward/RKWardRMd.xml b/rkward/RKWardRMd.xml
index 5ae568e7..0be7aeac 100644
--- a/rkward/RKWardRMd.xml
+++ b/rkward/RKWardRMd.xml
@@ -9,6 +9,7 @@ function encoding() { return document.encoding(); }
function year() { return new Date().getFullYear(); }
function upper(x) { return x.toUpperCase(); }
function lower(x) { return x.toLowerCase(); }
+function braces(text) { return "{" + text + "}"}
function lineCommand(command) {
if (view.selectedText().length > 0) {
let prefix = view.selection().start.column > 0 ? "\n" : "";
@@ -31,15 +32,27 @@ function rangeCommand(command, def) {
</script>
<item>
<match>Heading1</match>
- <fillin>${lineCommand("#")}</fillin>
+ <fillin>${rangeCommand("# ")}</fillin>
</item>
<item>
<match>Heading2</match>
- <fillin>${lineCommand("##")}</fillin>
+ <fillin>${rangeCommand("## ")}</fillin>
</item>
<item>
<match>Heading3</match>
- <fillin>${lineCommand("###")}</fillin>
+ <fillin>${rangeCommand("### ")}</fillin>
+ </item>
+ <item>
+ <match>List (Unordered)</match>
+ <fillin>${rangeCommand("\n- A\n- B\n- C\n\n")}</fillin>
+ </item>
+ <item>
+ <match>List (Ordered)</match>
+ <fillin>${rangeCommand("\n1. A\n2. B\n3. C\n\n")}</fillin>
+ </item>
+ <item>
+ <match>List (Unordered & Nested)</match>
+ <fillin>${rangeCommand("\n- A\n - a\n- B\n - b\n- C\n - c\n\n")}</fillin>
</item>
<item>
<match>Bold</match>
@@ -49,6 +62,30 @@ function rangeCommand(command, def) {
<match>Italics</match>
<fillin>${rangeCommand("*%%1*", "Italics")}</fillin>
</item>
+ <item>
+ <match>Superscript</match>
+ <fillin>${rangeCommand("\n$A^2^$\n")}</fillin>
+ </item>
+ <item>
+ <match>Subscript</match>
+ <fillin>${rangeCommand("\n$H~2~O$\n")}</fillin>
+ </item>
+ <item>
+ <match>Endasch</match>
+ <fillin>${rangeCommand("\n--\n")}</fillin>
+ </item>
+ <item>
+ <match>Emdasch</match>
+ <fillin>${rangeCommand("\n---\n")}</fillin>
+ </item>
+ <item>
+ <match>Equantion</match>
+ <fillin>${rangeCommand("\n$e^" + braces("i\\pi")+ " + 1$\n")}</fillin>
+ </item>
+ <item>
+ <match>Equantion Block</match>
+ <fillin>${rangeCommand("\n$$e^ " + braces("i\\pi")+ " + 1$$\n")}</fillin>
+ </item>
<item>
<match>Strikethrough</match>
<fillin>${rangeCommand("~~%%1~~", "Strikethrough")}</fillin>
@@ -57,8 +94,24 @@ function rangeCommand(command, def) {
<match>Link</match>
<fillin>${rangeCommand("(title)[%%1]", "URL")}</fillin>
</item>
+ <item>
+ <match>rmarkdown::render()</match>
+ <fillin>${rangeCommand("rmarkdown::render()")}</fillin>
+ </item>
+ <item>
+ <match>Inline Code</match>
+ <fillin>${rangeCommand("`r paste(\"The sum of 1 to 1000 is\", sum(1L:1000))`")}</fillin>
+ </item>
<item>
<match>Code_Block</match>
- <fillin>${rangeCommand("\n```r%%1```\n", "\nx <- 1\n")}</fillin>
+ <fillin>${rangeCommand("\n```%%1```\n", "\nx <- 1\n")}</fillin>
+ </item>
+ <item>
+ <match>Chunck (Simple)</match>
+ <fillin>${rangeCommand("\n```"+ braces("r") +" %%1```\n", "\nx <- 1\n\n")}</fillin>
+ </item>
+ <item>
+ <match>Chunck (defaults)</match>
+ <fillin>${rangeCommand("\n```"+ braces("r, echo = FALSE, eval = FALSE, fig.show = \"hide\", include = FALSE, message = FALSE, results = \"hide\", warning = FALSE") +" %%1```\n", "\nx <- 1\n\n")}</fillin>
</item>
</snippets>
More information about the rkward-tracker
mailing list