Skip to content

Commit

Permalink
use xfun 0.50
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Jan 7, 2025
1 parent 86944bd commit 27da344
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions 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
Version: 0.5.1
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 All @@ -22,7 +22,7 @@ Depends: R (>= 3.2.0)
Imports:
utils,
commonmark (>= 1.9.1),
xfun (>= 0.49)
xfun (>= 0.50)
Suggests:
rbibutils,
rstudioapi,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CHANGES IN litedown VERSION 0.6

# CHANGES IN litedown VERSION 0.5

- Added a wizard in `roam()` to create new `.Rmd`/`.md`/`.R` files with selected HTML features.
Expand Down
4 changes: 2 additions & 2 deletions R/format.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ map_args = function(

# split YAML and body from text input, and normalize rmarkdown output formats in
# YAML to litedown's formats
yaml_body = function(text) {
res = xfun::yaml_body(text, use_yaml = FALSE)
yaml_body = function(text, ...) {
res = xfun::yaml_body(text, use_yaml = FALSE, ...)
if (!length(out <- res$yaml[['output']])) {
# if the key 'format' is provided, normalize it to 'output'
if (length(out <- res$yaml[['format']])) res$yaml$format = NULL else return(res)
Expand Down
3 changes: 1 addition & 2 deletions R/preview.R
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@ new_file = function(path, ext, type, css = NULL, js = NULL) {
if (nrow(a)) m$output$html = list(meta = list(
css = I(na_omit(a[, 'css'])), js = I(na_omit(a[, 'js']))
))
taml_save = getFromNamespace('taml_save', 'xfun') # TODO: remove this hack
txt = c('---', taml_save(m), '---', '', 'Relax. I need some information first.')
txt = c('---', xfun::taml_save(m), '---', '', 'Relax. I need some information first.')
if (ext == 'r') txt = paste("#'", split_lines(txt))
write_utf8(txt, path)
'view'
Expand Down
5 changes: 2 additions & 3 deletions R/site.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ fuse_book = function(input = '.', output = NULL, envir = parent.frame()) {
}
}
# remove YAML in the preview mode since we only need the body
if (length(preview)) out = yaml_body(split_lines(out))$body # TODO: use parse = FALSE
if (length(preview)) out = yaml_body(split_lines(out), parse = FALSE)$body

if (format != 'html') return(out)
# add input filenames to the end for HTML output and wrap each file in a div
Expand Down Expand Up @@ -261,8 +261,7 @@ fuse_book = function(input = '.', output = NULL, envir = parent.frame()) {

# read the config file _litedown.yml
yml_config = function(d) {
if (file_exists(cfg <- file.path(d, '_litedown.yml')))
xfun::yaml_load(read_utf8(cfg), use_yaml = FALSE)
if (file_exists(cfg <- file.path(d, '_litedown.yml'))) xfun::taml_file(cfg)
}

site_pattern = '[.][Rq]?md$'
Expand Down

0 comments on commit 27da344

Please sign in to comment.