Skip to content

New compose_email implementation based on htmltools#178

Merged
rich-iannone merged 40 commits into
masterfrom
joe/misc/base-template
Apr 23, 2020
Merged

New compose_email implementation based on htmltools#178
rich-iannone merged 40 commits into
masterfrom
joe/misc/base-template

Conversation

@jcheng5
Copy link
Copy Markdown
Member

@jcheng5 jcheng5 commented Apr 21, 2020

Testing notes

There are a bunch of examples in tests/manual_tests you can use.

You can preview in your local email client (e.g. outlook) using a function like this:

local_preview <- function(eml) {
  blastula:::generate_rfc2822(eml, subject = "Test", con = "test.eml")
  browseURL("test.eml")
}

Call local_preview(eml), where eml is the return value from compose_email or render_email. (You can continue to just print(eml) to view it in a web browser)

rich-iannone and others added 19 commits March 23, 2020 15:08
This also adds in the `content_width` variable.
Also:

- reimplement default styles
- change default width to 85% instead of ~600px
- allow customization of font and content width
- allow base template to be replaced with your own function
- detect any <img src="file/data"> regardless of how it was
  generated, and use cid-style attachment (does not apply
  to web URLs)
Also `Content-Disposition: inline` fixes broken images on
Gmail mobile app *when using non-gmail accounts*
- block_text() now defaults to align="left"
- md() goes back to performing markdown rendering later, not
  at the time md() is called. I don't like this as much but
  it's necessary because blastula::md and gt::md need to stay
  compatible with each other due to masking.
- Update test snapshots
@jcheng5 jcheng5 force-pushed the joe/misc/base-template branch from 0136397 to c553f3b Compare April 21, 2020 18:57
jcheng5 added 9 commits April 21, 2020 13:35
- Image widths are now fluid in Outlook
- No restriction on number/type of blocks
- Bump up content area's padding from 8px to 12px
- The first and last articles in a block_articles now sit flush
  with the left and right edges of regular content
jcheng5 added 4 commits April 22, 2020 13:00
The new_releases_email.R test case was failing with a stack
overflow. It was due to backtracking across the contents of
a tag body, which in this case was dozens of megabytes (the
image was 24MB(!!) to start with, then base64-encoded!).

Dropping the (/?) from the pattern allows us to change the
preceding *? to *+ (possessive quantifier, TIL!), which
avoids backtracking.
Seems to be a bug in PCRE-based regex engine. Could not
switch to stringi/stringr, as there isn't a function that
can return positions of capturing groups.

By simplifying the pattern in replace_attr I was able to
switch to perl=FALSE, seems to be OK.
@rich-iannone rich-iannone self-requested a review April 22, 2020 23:19
Copy link
Copy Markdown
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the large amount of work done here. I have only small editorial comments, nothing that important but you can commit directly if you agree.

Comment thread R/add_cta_button.R Outdated
Comment thread R/utils-html_manipulation.R Outdated
Comment thread tests/manual_tests/newsletter_email.R Outdated
Comment on lines +59 to +74
article(
image = "https://i.imgur.com/5aJawp2.jpg",
title = "Hyperreal",
content =
"By utilizing a combination of the Hyperreal headset (and
additional measures), one can have the sensation of being
truly immersed in the VR world."
),
article(
image = "https://i.imgur.com/5aJawp2.jpg",
title = "Hyperreal",
content =
"By utilizing a combination of the Hyperreal headset (and
additional measures), one can have the sensation of being
truly immersed in the VR world."
),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are duplicated articles.

@jcheng5 jcheng5 mentioned this pull request Apr 23, 2020
@rich-iannone rich-iannone self-requested a review April 23, 2020 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants