[education/rkward/snippets] rkward: Move changes to the correct files
Thomas Friedrichsmeier
null at kde.org
Sun Jun 19 08:33:08 BST 2022
Git commit 26aa780e14751de19b89c46a76d880739277e3bd by Thomas Friedrichsmeier.
Committed on 19/06/2022 at 07:18.
Pushed by tfry into branch 'snippets'.
Move changes to the correct files
M +43 -45 rkward/RKWardR.xml
M +98 -34 rkward/RKWardRMd.xml
https://invent.kde.org/education/rkward/commit/26aa780e14751de19b89c46a76d880739277e3bd
diff --git a/rkward/RKWardR.xml b/rkward/RKWardR.xml
index 54f23733..88fdfd5b 100644
--- a/rkward/RKWardR.xml
+++ b/rkward/RKWardR.xml
@@ -1,5 +1,5 @@
-<snippets name="LaTeX (RKWard)" filetypes="tex" authors="RKWard Team" namespace="SnippetsLaTeX" license="BSD">
- <script>require("range.js")
+<snippets name="R (RKWard)" filetypes="R" authors="RKWard Team" namespace="SnippetsR" license="BSD">
+ <script>require("range.js")
require("cursor.js")
require("document.js")
require("view.js")
@@ -29,59 +29,57 @@ function rangeCommand(command, def) {
}
</script>
<item>
- <match>Newline</match>
- <fillin>\newline</fillin>
+ <match>Figure as PDF</match>
+ <fillin>
+pdf(filename="myplot.pdf", width=5, height=5)
+plot(rnorm(100))
+dev.off()
+ </fillin>
</item>
<item>
- <match>x=y</match>
- <fillin>$x = y$</fillin>
+ <match>Plotting area (3x3 array)</match>
+ <fillin>
+# Plotting area (3x3 array) with 3 rows and 3 columns
+par(mfrow=c(3,3))
+ </fillin>
</item>
<item>
- <match>α Α</match>
- <fillin>$\alpha A$</fillin>
+ <match>Matrix multiplication</match>
+ <fillin>
+%*%
+ </fillin>
</item>
<item>
- <match>|A|</match>
- <fillin>$|A|$</fillin>
+ <match>Concatenate vectors after converting to character</match>
+ <fillin>
+paste(…, sep = " ", collapse = NULL)
+ </fillin>
</item>
<item>
- <match>x∈A</match>
- <fillin>$x \in A$</fillin>
- </item>
- <item>
- <match>P(A∣B)</match>
- <fillin>$P(A \mid B)$</fillin>
- </item>
- <item>
- <match>Overlined</match>
- <fillin>$\overline{x}$</fillin>
- </item>
- <item>
- <match>Hat</match>
- <fillin>$\hat{x}$</fillin>
- </item>
- <item>
- <match>Tile</match>
- <fillin>$\tilde{x}$</fillin>
- </item>
- <item>
- <match>Subset</match>
- <fillin>$x \subset B$</fillin>
- </item>
- <item>
- <match>Subset equal</match>
- <fillin>$x \subseteq B$</fillin>
- </item>
- <item>
- <match>Or</match>
- <fillin>$A \cup B$</fillin>
+ <match>for loop</match>
+ <fillin>
+# Print for 10 capital LETTERS
+for(i in 1:10){
+ print(LETTERS[i])
+}
+ </fillin>
</item>
<item>
- <match>And</match>
- <fillin>$A \cap B$</fillin>
+ <match>while loop</match>
+ <fillin>
+while(condition){
+ Do something
+}
+ </fillin>
</item>
<item>
- <match>And</match>
- <fillin>$A \cap B$</fillin>
+ <match>ifelse statement</match>
+ <fillin>
+if (condition){
+ Do something
+ } else {
+ Do something different
+ }
+ </fillin>
</item>
-</snippets>
+ </snippets>
diff --git a/rkward/RKWardRMd.xml b/rkward/RKWardRMd.xml
index 88fdfd5b..4e50221e 100644
--- a/rkward/RKWardRMd.xml
+++ b/rkward/RKWardRMd.xml
@@ -1,4 +1,4 @@
-<snippets name="R (RKWard)" filetypes="R" authors="RKWard Team" namespace="SnippetsR" license="BSD">
+<snippets name="R Markdown (RKWard)" filetypes="R Markdown" authors="RKWard Team" namespace="SnippetsRmd" license="BSD">
<script>require("range.js")
require("cursor.js")
require("document.js")
@@ -29,57 +29,121 @@ function rangeCommand(command, def) {
}
</script>
<item>
- <match>Figure as PDF</match>
- <fillin>
-pdf(filename="myplot.pdf", width=5, height=5)
-plot(rnorm(100))
-dev.off()
- </fillin>
+ <match>Heading1</match>
+ <fillin>${lineCommand("#", "^#+ ", "Heading")}</fillin>
</item>
<item>
- <match>Plotting area (3x3 array)</match>
- <fillin>
-# Plotting area (3x3 array) with 3 rows and 3 columns
-par(mfrow=c(3,3))
- </fillin>
+ <match>Heading2</match>
+ <fillin>${lineCommand("##", "^#+ ", "Heading")}</fillin>
+ </item>
+ <item>
+ <match>Heading3</match>
+ <fillin>${lineCommand("###", "^#+ ", "Heading")}</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>
+ <fillin>${rangeCommand("**%%1**", "Bold")}</fillin>
+ </item>
+ <item>
+ <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>En dash</match>
+ <fillin>--</fillin>
</item>
<item>
- <match>Matrix multiplication</match>
+ <match>Em dash</match>
+ <fillin>---</fillin>
+ </item>
+ <item>
+ <match>Equation (inline)</match>
<fillin>
-%*%
- </fillin>
+$e^${braces("i\\pi")} + 1$
+</fillin>
</item>
<item>
- <match>Concatenate vectors after converting to character</match>
+ <match>Equation (block)</match>
<fillin>
-paste(…, sep = " ", collapse = NULL)
- </fillin>
+$$e^${braces("i\\pi")} + 1$$
+</fillin>
+ </item>
+ <item>
+ <match>Strikethrough</match>
+ <fillin>${rangeCommand("~~%%1~~", "Strikethrough")}</fillin>
</item>
<item>
- <match>for loop</match>
+ <match>Link</match>
+ <fillin>${rangeCommand("(title)[%%1]", "URL")}</fillin>
+ </item>
+ <item>
+ <match>rmarkdown::render()</match>
+ <fillin>rmarkdown::render()</fillin>
+ </item>
+ <item>
+ <match>Code (inline)</match>
+ <fillin>${rangeCommand("`r %%1`", "paste(\"The sum of 1 to 1000 is\", sum(1L:1000))")}</fillin>
+ </item>
+ <item>
+ <match>Code (simple chunk)</match>
+ <fillin>${rangeCommand("\n```"+ braces("r") +" %%1```\n", "\nx <- 1\n\n")}</fillin>
+ </item>
+ <item>
+ <match>Quote</match>
+ <fillin>${rangeCommand("> %%1", "Text")}</fillin>
+ </item>
+ <item>
+ <match>Code (chunk with 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>
+ <item>
+ <match>Table</match>
<fillin>
-# Print for 10 capital LETTERS
-for(i in 1:10){
- print(LETTERS[i])
-}
+| Right | Left | Default | Center |
+|-------:|:------|-----------|:---------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
</fillin>
</item>
<item>
- <match>while loop</match>
+ <match>Table with caption</match>
<fillin>
-while(condition){
- Do something
-}
+| Right | Left | Default | Center |
+|-------:|:------|-----------|:---------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
+:Caption text
</fillin>
</item>
<item>
- <match>ifelse statement</match>
+ <match>Table (kable)</match>
<fillin>
-if (condition){
- Do something
- } else {
- Do something different
- }
+```{r}
+data <- iris[1:4, ]
+knitr::kable(data, caption = "Table caption text.")
+```
</fillin>
</item>
- </snippets>
+</snippets>
More information about the rkward-tracker
mailing list