Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support empty string in as_paragraph_md (solves #67) #68

Merged
merged 4 commits into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion R/as-paragraph-md.R
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down Expand Up @@ -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) %>%
Expand Down