Unable to replicate blastula examples

Hi!

I am trying to replicate the Blastula email example here.

However, when I print message, this is what I get:

Hi Jim, The fiscal quarter closes next week. Here are the \ the sales rep numbers.\ {formatted_table} <br /> Cheers,<br /> EVP of Sales

It appears to be rending the compose_email object as a simple string. This is the case when I actually send the email in addition to just printing it.

This is happening for everything I try to do in blastula. Here's a simple example:

library(blastula)
print_this <- "Substitute this text"
compose_email(body = "{print_this}")

I am using R 3.6.3, Blastula 0.3.1 and Windows 10.

library(blastula)
library(glue)
print_this <- "Substitute this text"
compose_email(body = md(glue("{print_this} and also *this*")))

So the RStudio docs are wrong because they were supposed to use glue?

I don't think that captures my problem. For example, html tags are not being read for me:

library(blastula)
message <- compose_email(body="first line <br /> next line")
message

try using md() on your body text

Same result (still not recognizing the html tags).

my code:

library(blastula)
sessionInfo()
message <- compose_email(body=md("first line <br /> next line"))
message

sessionInfo() results


R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] blastula_0.3.2

loaded via a namespace (and not attached):
[1] compiler_4.0.2  magrittr_1.5    htmltools_0.5.0 tools_4.0.2     digest_0.6.25  
[6] rlang_0.4.7    

blastulaexample2

what version of blastula are you using ?

Same as you, 0.3.2

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] glue_1.3.1     blastula_0.3.2

loaded via a namespace (and not attached):
[1] compiler_3.6.3  magrittr_1.5    htmltools_0.4.0
[4] tools_3.6.3     Rcpp_1.0.2      digest_0.6.20  
[7] commonmark_1.7  rlang_0.4.7 

I didnt load glue for my example... but my version of glue is glue_1.4.2
perhaps its related somehow ?

Upgrading glue to 1.4.2 yields the same results. I also delete + reinstalled blastula with the same results. :face_with_raised_eyebrow:

what happens when you do the following in the console?

md("first line <br /> next line")
md("first line <br /> second line")
[1] "first line <br /> second line"
attr(,"class")
[1] "from_markdown"

Thats good.


md("first line <br /> next line") %>% compose_email

?

Amazingly, that yields the expected result!

Also this now yields the expected result as well:

compose_email(body=md("first line <br /> second line"))

Not sure if I was moving too fast earlier or if closing + reopening + reinstalling a couple of times fixed it.

I can now replicate the RStudio example with the following tweaks:

message <- compose_email(
     body =md(glue( "
   Hi Jim,
 
   The fiscal quarter closes next week. Here are the \\
   the sales rep numbers.\\
 
 
   {formatted_table}
   <br />
   Cheers,<br /> EVP of Sales"
 )))

Do you where I can leave feedback on those docs?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.