From cd035e701618e7e7ba9ce135dcad0eb6ab499ba1 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 28 Aug 2023 17:33:25 +0200 Subject: [PATCH 1/4] handle empty description in articles json when creating the XML feed NULL in R gives empty list in JSON (when read back). Testing for NULL was not correct to default for `title` when no `description` is provided. This is now handle correctly and should avoid cryptic error from XML writing. Fix #490 and fix #448 --- R/sitemap.R | 2 +- R/utils.R | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/R/sitemap.R b/R/sitemap.R index fc36c095..b0743b21 100644 --- a/R/sitemap.R +++ b/R/sitemap.R @@ -281,7 +281,7 @@ write_feed_xml <- function(feed_xml, site_config, collection, articles) { } } else { - add_child(item, "description", text = not_null(article$description, default = article$title)) + add_child(item, "description", text = not_null_or_empty(article$description, default = article$title)) } if (!is.null(article$categories)) { diff --git a/R/utils.R b/R/utils.R index a6abaa02..68746b3c 100644 --- a/R/utils.R +++ b/R/utils.R @@ -31,6 +31,13 @@ not_null <- function(x, default="") { x } +not_null_or_empty <- function(x, default="") { + if (is.null(x) || length(x) == 0) + default + else + x +} + block_class = function(x){ if (length(x) == 0) return() classes = unlist(strsplit(x, '\\s+')) From f39720e051ee0c76ccdfbd2204a9c871f8165ad7 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 28 Aug 2023 17:44:19 +0200 Subject: [PATCH 2/4] Update doc --- man/publish_website.Rd | 3 --- 1 file changed, 3 deletions(-) diff --git a/man/publish_website.Rd b/man/publish_website.Rd index a0d204cf..c4ba4548 100644 --- a/man/publish_website.Rd +++ b/man/publish_website.Rd @@ -23,9 +23,6 @@ to the \code{name} provided in \verb{_site.yml} (or to the name of the site_dir \item{method}{Publishing method (currently only "rsconnect" is available)} -\item{server}{Server name. Required only if you use the same account name on -multiple servers.} - \item{account}{Account to deploy application to. This parameter is only required for the initial deployment of an application when there are multiple accounts configured on the system.} From cea2589a08000f39237c7b904e14ab2880be778a Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 28 Aug 2023 17:47:32 +0200 Subject: [PATCH 3/4] update NEWS --- NEWS.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index b27d1498..cabe31c1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,9 @@ # distill (development version) +- RSS feed creation now works correctly for listings when no `description` is provided in one of the Rmd post (thanks, \@cpsyctc, \@apeterson91, #490, #448). - Fix an issue with line numbering on code chunks when `highlight-downlit: false` by tweaking Pandoc's default CSS rules (thanks, \@SES-CE, #473). -- Internally use `format()` instead of `as.character()` with Dates to account for argument \`format=\` deprecation in R 4.3.0 (thanks, \\\@mbojan, #488). -- Add a `subtitle` variable in HTML template placed between title and categories (thanks, \\\@dicook, #480). +- Internally use `format()` instead of `as.character()` with Dates to account for argument `format=` deprecation in R 4.3.0 (thanks, \@mbojan, #488). +- Add a `subtitle` variable in HTML template placed between title and categories (thanks, \@dicook, #480). # distill 1.5 (CRAN) From 4c5d4d32e89066e8693623ba8bff454605d1d5d1 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 28 Aug 2023 18:24:09 +0200 Subject: [PATCH 4/4] Import params documentation follow new documentation in newer rsconnect --- R/publish.R | 5 +---- man/publish_website.Rd | 8 +++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/R/publish.R b/R/publish.R index 68bc2499..6384d320 100644 --- a/R/publish.R +++ b/R/publish.R @@ -3,15 +3,12 @@ #' #' Publish a website to RStudio Connect #' -#' @inheritParams rsconnect::deploySite +#' @inheritParams rsconnect::deployApp #' #' @param site_dir Directory containing website. Defaults to current working directory. #' @param site_name Name for the site (names must be unique within an account). Defaults #' to the `name` provided in `_site.yml` (or to the name of the site_dir if there is no #' `name` specified). -#' @param account Account to deploy application to. This parameter is only required for -#' the initial deployment of an application when there are multiple accounts configured -#' on the system. #' @param method Publishing method (currently only "rsconnect" is available) #' @param render `TRUE` to render the site locally before publishing. #' @param launch_browser If `TRUE`, the system's default web browser will be launched diff --git a/man/publish_website.Rd b/man/publish_website.Rd index c4ba4548..f93ef7d6 100644 --- a/man/publish_website.Rd +++ b/man/publish_website.Rd @@ -23,9 +23,11 @@ to the \code{name} provided in \verb{_site.yml} (or to the name of the site_dir \item{method}{Publishing method (currently only "rsconnect" is available)} -\item{account}{Account to deploy application to. This parameter is only required for -the initial deployment of an application when there are multiple accounts configured -on the system.} +\item{account, server}{Uniquely identify a remote server with either your +user \code{account}, the \code{server} name, or both. If neither are supplied, and +there are multiple options, you'll be prompted to pick one. + +Use \code{\link[rsconnect:accounts]{accounts()}} to see the full list of available options.} \item{render}{\code{TRUE} to render the site locally before publishing.}