Skip to content

Commit 6c4ed30

Browse files
J-Moravecyihui
andauthored
fix #88: the prefix ./ should be removed from fig.dir instead of being substituted with .(#94)
Co-authored-by: Yihui Xie <[email protected]>
1 parent 817447d commit 6c4ed30

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: litedown
22
Type: Package
33
Title: A Lightweight Version of R Markdown
4-
Version: 0.7.2
4+
Version: 0.7.3
55
Authors@R: c(
66
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666", URL = "https://yihui.org")),
77
person("Tim", "Taylor", role = "ctb", comment = c(ORCID = "0000-0002-8587-7113")),

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- `fuse(text = '# text')` will be treated as Markdown input instead of R code input (thanks, @chuxinyuan, #102).
66

7+
- Fixed the bug that the chunk option `fig.path` does not work when it does not contain `/` (thanks, @J-Moravec, #88).
8+
79
# CHANGES IN litedown VERSION 0.7
810

911
- `pkg_manual()` will exclude help pages with the keyword `internal` (thanks, @TimTaylor, #78).

R/fuse.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ fuse_code = function(x, blocks) {
746746
p3 = unlist(p2) # vector of plot paths
747747
# get the relative path of the plot directory
748748
fig.dir = if (length(p3)) tryCatch(
749-
sub('^[.]/', '.', paste0(dirname(relative_path(p3[1], .env$wd_out)), '/')),
749+
sub('^[.]/', '', paste0(dirname(relative_path(p3[1], .env$wd_out)), '/')),
750750
error = function(e) NULL
751751
)
752752

tests/fig_path.R

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
src = '
2+
---
3+
output:
4+
html:
5+
options:
6+
embed_resources: false
7+
---
8+
9+
```{r}
10+
plot(1)
11+
```
12+
'
13+
14+
old = litedown::reactor(fig.path = 'foo')
15+
out = litedown::fuse(text = src, output = 'markdown')
16+
stopifnot('![](<foochunk-1-1.png>)' %in% unlist(strsplit(out, '\n')))
17+
unlink('foochunk-1-1.png')
18+
19+
litedown::reactor(fig.path = 'foo/bar')
20+
out = litedown::fuse(text = src, output = 'markdown')
21+
stopifnot('![](<foo/barchunk-1-1.png>)' %in% unlist(strsplit(out, '\n')))
22+
unlink('foo', recursive = TRUE)
23+
24+
litedown::reactor(old)

0 commit comments

Comments
 (0)