From 1046994c0c7e0624b05c1e5b56957a91bcd32b8f Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 16 Jan 2022 07:51:42 +0900 Subject: [PATCH 1/4] support empty cell with as_paragraph_md (solves #67) --- R/as-paragraph-md.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/as-paragraph-md.R b/R/as-paragraph-md.R index 1a9f6cc..20b9dcb 100644 --- a/R/as-paragraph-md.R +++ b/R/as-paragraph-md.R @@ -45,7 +45,7 @@ organize <- function(md_df, construct_chunk <- function(x, auto_color_link = "blue") { flextable::chunk_dataframe( - txt = x$txt, + txt = x$txt %||% "", # x can be empty list when input is empty string italic = x$Emph %||% NA, bold = x$Strong %||% NA, url = x$Link %||% NA_character_, From 5c5c9df4d28501e11921d7504b5ea22c5471017d Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 16 Jan 2022 07:53:50 +0900 Subject: [PATCH 2/4] update NEWS --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 709ada0..cc73575 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# ftExtra 0.3.0.9999 + +* `as_paragraph_md` supports empty string, `""`, as an input (#68). + # ftExtra 0.3.0 ## New features From 26320d21db2cd5176ac4ba9ad11c520310794f20 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 16 Jan 2022 07:54:19 +0900 Subject: [PATCH 3/4] bump to dev version 0.3.0.9999 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8a0849d..d744d6a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ftExtra Title: Extensions for 'Flextable' -Version: 0.3.0 +Version: 0.3.0.9999 Date: 2022-01-04 Authors@R: c(person(given = "Atsushi", From 57206209eafa23aa46b75b2a7490926e6184ce35 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 16 Jan 2022 07:59:33 +0900 Subject: [PATCH 4/4] add support for input formats without div --- R/as-paragraph-md.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/as-paragraph-md.R b/R/as-paragraph-md.R index 20b9dcb..49bdbb3 100644 --- a/R/as-paragraph-md.R +++ b/R/as-paragraph-md.R @@ -126,6 +126,7 @@ as_paragraph_md <- function(x, organize(md_df, auto_color_link, .footnote_options) } else { lapply(x, function(x) { + if (x == "") return(construct_chunk(list())) y <- x %>% md2df(pandoc_args = pandoc_args, .from = .from, .check = TRUE) %>% solve_footnote(.footnote_options, auto_color_link) %>%