Skip to content

Commit 4bacd15

Browse files
committed
upd translation script and r -> {r} code blocks
1 parent c653cf6 commit 4bacd15

25 files changed

+86
-86
lines changed

vignettes/_translation_links.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# idea is to look like 'Other languages: en | fr | de'
33
.write.translation.links <- function(fmt) {
44
url = "https://rdatatable.gitlab.io/data.table/articles"
5-
path = dirname(knitr::current_input(TRUE))
5+
path = dirname(litedown::get_context("input"))
66
if (basename(path) == "vignettes") {
77
lang = "en"
88
} else {
@@ -11,13 +11,13 @@
1111
}
1212
translation = dir(path,
1313
recursive = TRUE,
14-
pattern = glob2rx(knitr::current_input(FALSE))
14+
pattern = glob2rx(litedown::get_context("input"))
1515
)
1616
transl_lang = ifelse(dirname(translation) == ".", "en", dirname(translation))
1717
block = if (!all(transl_lang == lang)) {
1818
linked_transl = sprintf("[%s](%s)", transl_lang, file.path(url, sub("(?i)\\.Rmd$", ".html", translation)))
1919
linked_transl[transl_lang == lang] = lang
2020
sprintf(fmt, paste(linked_transl, collapse = " | "))
2121
} else ""
22-
knitr::asis_output(block)
22+
litedown::raw_text(block)
2323
}

vignettes/datatable-benchmarking.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Benchmarking data.table"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format:
66
options:
@@ -30,9 +30,9 @@ h2 {
3030
}
3131
</style>
3232

33-
```{r echo=FALSE, file='_translation_links.R'}
33+
```{r, echo=FALSE, file='_translation_links.R'}
3434
```
35-
`r .write.translation.links("Translations of this document are available in: %s")`
35+
`{r} .write.translation.links("Translations of this document are available in: %s")`
3636

3737
This document is meant to guide on measuring performance of `data.table`. Single place to document best practices and traps to avoid.
3838

vignettes/datatable-faq.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Frequently Asked Questions about data.table"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format:
66
options:
@@ -26,9 +26,9 @@ h2 {
2626
}
2727
</style>
2828

29-
```{r echo=FALSE, file='_translation_links.R'}
29+
```{r, echo=FALSE, file='_translation_links.R'}
3030
```
31-
`r .write.translation.links("Translations of this document are available in: %s")`
31+
`{r} .write.translation.links("Translations of this document are available in: %s")`
3232

3333
```{r, echo = FALSE, message = FALSE}
3434
library(data.table)

vignettes/datatable-importing.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Importing data.table"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format
66
vignette: >
@@ -20,9 +20,9 @@ h2 {
2020
}
2121
</style>
2222

23-
```{r echo=FALSE, file='_translation_links.R'}
23+
```{r, echo=FALSE, file='_translation_links.R'}
2424
```
25-
`r .write.translation.links("Translations of this document are available in: %s")`
25+
`{r} .write.translation.links("Translations of this document are available in: %s")`
2626

2727
This document is focused on using `data.table` as a dependency in other R packages. If you are interested in using `data.table` C code from a non-R application, or in calling its C functions directly, jump to the [last section](#non-r-api) of this vignette.
2828

vignettes/datatable-intro.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Introduction to data.table"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format
66
vignette: >
@@ -9,9 +9,9 @@ vignette: >
99
\usepackage[utf8]{inputenc}
1010
---
1111

12-
```{r echo=FALSE, file='_translation_links.R'}
12+
```{r, echo=FALSE, file='_translation_links.R'}
1313
```
14-
`r .write.translation.links("Translations of this document are available in: %s")`
14+
`{r} .write.translation.links("Translations of this document are available in: %s")`
1515

1616
```{r, echo = FALSE, message = FALSE}
1717
library(data.table)
@@ -41,7 +41,7 @@ In this vignette, we will use [NYC-flights14](https://raw.githubusercontent.com/
4141

4242
We can use `data.table`'s fast-and-friendly file reader `fread` to load `flights` directly as follows:
4343

44-
```{r echo = FALSE}
44+
```{r, echo = FALSE}
4545
options(width = 100L)
4646
```
4747

vignettes/datatable-joins.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Joins in data.table"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format
66
vignette: >
@@ -18,7 +18,7 @@ litedown::reactor(comment = "# ", print = NA)
1818

1919
```{r, echo=FALSE, file='_translation_links.R'}
2020
```
21-
`r .write.translation.links("Translations of this document are available in: %s")`
21+
`{r} .write.translation.links("Translations of this document are available in: %s")`
2222

2323
In this vignette you will learn how to perform any join operation using resources available in the `data.table` syntax.
2424

vignettes/datatable-keys-fast-subset.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Keys and fast binary search based subset"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format
66
vignette: >
@@ -9,9 +9,9 @@ vignette: >
99
\usepackage[utf8]{inputenc}
1010
---
1111

12-
```{r echo=FALSE, file='_translation_links.R'}
12+
```{r, echo=FALSE, file='_translation_links.R'}
1313
```
14-
`r .write.translation.links("Translations of this document are available in: %s")`
14+
`{r} .write.translation.links("Translations of this document are available in: %s")`
1515

1616
```{r, echo = FALSE, message = FALSE}
1717
library(data.table)
@@ -27,7 +27,7 @@ This vignette is aimed at those who are already familiar with *data.table* synta
2727

2828
We will use the same `flights` data as in the [`vignette("datatable-intro", package="data.table")`](datatable-intro.html) vignette.
2929

30-
```{r echo = FALSE}
30+
```{r, echo = FALSE}
3131
options(width = 100L)
3232
```
3333

vignettes/datatable-programming.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Programming on data.table"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format
66
vignette: >
@@ -9,9 +9,9 @@ vignette: >
99
\usepackage[utf8]{inputenc}
1010
---
1111

12-
```{r echo=FALSE, file='_translation_links.R'}
12+
```{r, echo=FALSE, file='_translation_links.R'}
1313
```
14-
`r .write.translation.links("Translations of this document are available in: %s")`
14+
`{r} .write.translation.links("Translations of this document are available in: %s")`
1515

1616
```{r init, include = FALSE}
1717
require(data.table)

vignettes/datatable-reference-semantics.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Reference semantics"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format
66
vignette: >
@@ -9,9 +9,9 @@ vignette: >
99
\usepackage[utf8]{inputenc}
1010
---
1111

12-
```{r echo=FALSE, file='_translation_links.R'}
12+
```{r, echo=FALSE, file='_translation_links.R'}
1313
```
14-
`r .write.translation.links("Translations of this document are available in: %s")`
14+
`{r} .write.translation.links("Translations of this document are available in: %s")`
1515

1616
```{r, echo = FALSE, message = FALSE}
1717
library(data.table)
@@ -27,7 +27,7 @@ This vignette discusses *data.table*'s reference semantics which allows to *add/
2727

2828
We will use the same `flights` data as in the [`vignette("datatable-intro", package="data.table")`](datatable-intro.html) vignette.
2929

30-
```{r echo = FALSE}
30+
```{r, echo = FALSE}
3131
options(width = 100L)
3232
```
3333

vignettes/datatable-reshape.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Efficient reshaping using data.tables"
3-
date: "`r Sys.Date()`"
3+
date: "`{r} Sys.Date()`"
44
output:
55
litedown::html_format
66
vignette: >
@@ -9,9 +9,9 @@ vignette: >
99
\usepackage[utf8]{inputenc}
1010
---
1111

12-
```{r echo=FALSE, file='_translation_links.R'}
12+
```{r, echo=FALSE, file='_translation_links.R'}
1313
```
14-
`r .write.translation.links("Translations of this document are available in: %s")`
14+
`{r} .write.translation.links("Translations of this document are available in: %s")`
1515

1616
```{r, echo = FALSE, message = FALSE}
1717
library(data.table)
@@ -23,7 +23,7 @@ This vignette discusses the default usage of reshaping functions `melt` (wide to
2323

2424
***
2525

26-
```{r echo = FALSE}
26+
```{r, echo = FALSE}
2727
options(width = 100L)
2828
```
2929

0 commit comments

Comments
 (0)