Skip to content

Commit

Permalink
fix an edge case revealed in yihui/knitr#2387: the whole document may…
Browse files Browse the repository at this point in the history
… consist of a single chunk, in which case the error location would not be printed
  • Loading branch information
yihui committed Jan 8, 2025
1 parent 1f154bc commit c7a61e5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: litedown
Type: Package
Title: A Lightweight Version of R Markdown
Version: 0.5.1
Version: 0.5.2
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666", URL = "https://yihui.org")),
person("Tim", "Taylor", role = "ctb", comment = c(ORCID = "0000-0002-8587-7113")),
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2024
YEAR: 2024-2025
COPYRIGHT HOLDER: Yihui Xie
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MIT License

Copyright (c) 2023 Posit Software, PBC
Copyright (c) 2024 Yihui Xie
Copyright (c) 2024-2025 Yihui Xie

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CHANGES IN litedown VERSION 0.6

- Fixed a bug that `fuse()` fails to print the error location when the whole input document consists of a single chunk that throws an error (thanks, @kevinushey, yihui/knitr#2387).

# CHANGES IN litedown VERSION 0.5

- Added a wizard in `roam()` to create new `.Rmd`/`.md`/`.R` files with selected HTML features.
Expand Down
6 changes: 3 additions & 3 deletions R/fuse.R
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ fiss = function(input, output = '.R', text = NULL) {
}
}
# if error occurs, print error location with a clickable file link
k = n - 1 # when exiting, k should be n instead
k = 0 # when exiting, k should be n + 1
on_error = function() {
if (k == n) return() # blocks have been successfully fused
if (k > n) return() # blocks have been successfully fused
p_bar(p_clr)
ansi_link(input)
message('Quitting from ', get_loc(nms[k]))
Expand All @@ -557,7 +557,7 @@ fiss = function(input, output = '.R', text = NULL) {
if (!isFALSE(time)) record_time(Sys.time() - t1, b$lines, nms[k])
p_bar(p_clr)
}
k = n
k = n + 1
res
}

Expand Down

0 comments on commit c7a61e5

Please sign in to comment.