[education/rkward] rkward: new Generate Rmd source,

Stefan Rödiger null at kde.org
Tue Jun 21 15:32:32 BST 2022


Git commit 300646c92749dd2668cabe18e2518a8e2ea16939 by Stefan Rödiger.
Committed on 21/06/2022 at 14:31.
Pushed by srodiger into branch 'master'.

new Generate Rmd source,
new Write raw LaTeX code
new Text comment (HTML)
new Read external scripts into a chunk
new dynamic YAML title:
fix Code (chunk with defaults)
fix Text comment (HTML)

M  +39   -7    rkward/RKWardRMd.xml

https://invent.kde.org/education/rkward/commit/300646c92749dd2668cabe18e2518a8e2ea16939

diff --git a/rkward/RKWardRMd.xml b/rkward/RKWardRMd.xml
index 42b2f9f6..4bc51dd1 100644
--- a/rkward/RKWardRMd.xml
+++ b/rkward/RKWardRMd.xml
@@ -69,7 +69,7 @@ function rangeCommand(command, def) {
  </item>
  <item>
   <match>Text comment (HTML)</match>
-  <fillin>${rangeCommand("<--!*%%1*-->", "Text")}</fillin>
+  <fillin>${rangeCommand("<!-- %%1 -->", "Text")}</fillin>
  </item>
  <item>
   <match>Image</match>
@@ -139,17 +139,49 @@ $$e^${braces("i\\pi")} + 1$$
   <match>Quote</match>
   <fillin>${rangeCommand("> %%1", "Text")}</fillin>
  </item>
+ <item>
+  <match>Generate Rmd source</match>
+  <fillin>
+knitr::knit_expand(
+  text = "This is RKWard using `R` version {{R_version}} with the `rkward` package {{rkward_version}}.",
+  R_version = getRversion(),
+  rkward_version = packageVersion("rkward"))
+</fillin>
+ </item>
  <item>
   <match>Separator \-</match>
   <fillin> &shy; </fillin>
  </item>
+ <item>
+  <match>Heading (Omit heading in table of contents)</match>
+  <fillin># Heading {.unlisted .unnumbered}</fillin>
+ </item>
  <item>
   <match>Halfspace \,</match>
   <fillin> &#8239; </fillin>
  </item>
+ <item>
+  <match>Read external scripts into a chunk</match>
+  <fillin>
+```{r, file=c(${cursor}'one.R', 'two.R'), echo = FALSE, eval = TRUE, include = FALSE, message = FALSE, warning = FALSE"}
+# One or more external scripts can be read via the file option of a chunk
+```
+</fillin>
+ </item>
+ <item>
+  <match>Write raw LaTeX code</match>
+<fillin>
+```{=latex}
+\begin{tabular}{ll}
+A & B \\
+A & B \\
+\end{tabular}
+```
+</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>
+  <fillin>${rangeCommand("\n```"+ braces("r, chunk-label, 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>
@@ -185,7 +217,7 @@ knitr::kable(data, caption = "Table caption text.")
   <match>YAML header</match>
     <fillin>
 ---
-title: "Document title"
+title: "Example R Markdown in RKWard with R version `r getRversion()`"
 author: "Author Name"
 date: "`r Sys.Date()`"
 output:
@@ -215,7 +247,7 @@ knitr::opts_chunk$set(
  <item>
    <match>R Markdown HTML template</match>
    <fillin>---
-title: "Document title"
+title: "Example R Markdown in RKWard with R version `r getRversion()`"
 author: "The RKWard Team"
 date: "`r format(Sys.time(), '%d %B, %Y')`"
 output:
@@ -254,7 +286,7 @@ Please feel free to adjust it to your needs.
 The HTML file is rendered via rmarkdown::render("/path/to/your_rmarkdown_file.Rmd").
 -->
 
-```{r, echo=TRUE}
+```{r, echo=FALSE, include=FALSE}
 # Defaults to suppress warnings and messages
 # Figure height and width are set to 7 inches
 # See more options by running str(knitr::opts_chunk$get())
@@ -370,7 +402,7 @@ If you like RKWard consider to donate. Some small amount for a cup of coffee or
  <item>
    <match>R Markdown PDF template</match>
    <fillin>---
-title: "Document title"
+title: "Example R Markdown in RKWard with R version `r getRversion()`"
 author: "The RKWard Team"
 date: "`r format(Sys.time(), '%d %B, %Y')`"
 output:
@@ -415,7 +447,7 @@ Please feel free to adjust it to your needs.
 
 \pagebreak
 
-```{r, echo=TRUE}
+```{r, chunk-label, echo=FALSE, include=FALSE}
 # Defaults to suppress warnings and messages
 # Figure height and width are set to 7 inches
 # See more options by running str(knitr::opts_chunk$get())


More information about the rkward-tracker mailing list