emayili/ 0000755 0001762 0000144 00000000000 14751316262 011712 5 ustar ligges users emayili/MD5 0000644 0001762 0000144 00000010602 14751316262 012221 0 ustar ligges users 89be0fd0973ad9e4d4011b1fd7494928 *DESCRIPTION e9482534aa9c3cc1164f481529fa63e1 *NAMESPACE e188cf7765d4b01e3ce0f7743c570a58 *NEWS.md 5152cb2e9ce01ac1ac8f92d99a200a62 *R/address.R 309fe70f605b534cf7132b86e546a5d0 *R/attachment.R 3d55bf72f7e474477a5c03fcf95f7b78 *R/body.R 6c8754903b6f5606cb0ac7a1fe66c4a9 *R/const.R 60cb22d4539f83ca178cdee9c91d0f79 *R/css.R ff3a477c1c27653b37e67da05c7ad99f *R/emayili.R bcdf693daa96f37a53a403dd97acff77 *R/encodable.R d5ab75957f411310508b559026335497 *R/encoding.R 47a949608296c9d1185be9ae6f45444a *R/encrypt.R 1fda44149ebc55d057186c503f066cf2 *R/envelope.R a9eeda0b64a5e672c795a8e2667bad6f *R/generics.R f6e44c584e6dddda27c9b171413fb364 *R/header-expires.R cd6dcf59803908c93acc7df3f3592f70 *R/header-language.R b7d4b25b6353653d65aa887ac78470c1 *R/header-mail.R b5b592444574088686cf1b4a8a9c840d *R/header-mime.R 1de0daf892a7152f991e2db11d3d40b1 *R/header-precedence.R f542b177f611b90f57a77cb0634f8208 *R/header-receipt.R 20e63031ff4318e3fc98c59356dde44b *R/header-sensitivity.R b0a492f950f5929f1eb17a74b843552f *R/header.R 00040cdf71af5440dda8495084a386d2 *R/mime.R 0973fa57cb2eed2693a0f0cbcd20fb36 *R/options.R 78c7c7405209698839c4d6ab64d09a09 *R/parties.R af5ec887a18bc5ed997eff592210ef8a *R/render.R 1cf171dd50732dd5e62063f7e1ced4df *R/server.R 9a8c70d94ca165775ffbb2671a882941 *R/template.R 230df445eadf826f8be16f0e15c2aa38 *R/utils.R 746211587f69c8cb73cf54023b92ed77 *README.md 4811f57962b5ecd587244eaf324e2f43 *inst/WORDLIST d0a4e3d1b9e14560942b837b2e7bcd98 *inst/cats.jpg 0f3efe007ff68a56276d9118c67b9291 *inst/github-card.R ccc848c512061f087440a4c1ddbd50d4 *inst/hex/emayili-hex.R 8ce92391eec996d11268f623d45142e3 *inst/hex/envelope-regular.png 2662ce9e3373cb0873542bef65bcd3cd *inst/shiny/send-message/app.R d43d10d3e5b019a34a0c53485545dfb1 *inst/template/newsletter/template.html 8287d69d8a95e7db3c1197cc910d032d *inst/tiny-test-image.png cbf3c24fb86c2c1e9d7db9faf5512ccc *man/address.Rd 29d9ca76e7930e9de17f1bcbbfea50b9 *man/addresses.Rd c63df40cd848f4c6e2a9c7c947a51907 *man/after.envelope.Rd 82fb4023f009dec9489fa81516c45ea7 *man/as.address.Rd 5748feedece87c6c1dce17f5362791c9 *man/as.character.MIME.Rd 2bc6d97a8da452be3874cc57d02760a6 *man/as.character.address.Rd d1bca0239bdc7be6f531945698364092 *man/as.character.envelope.Rd b29fe588090b0cdb4ee24c0c7f2fa2c2 *man/as.character.header.Rd cedb673b93838feb71f37dbe968d14ec *man/attachment.Rd ec5288ddd73365ed9c2b5a595d920d56 *man/c.address.Rd d5ac4aae0199bc22b53bc6af0d026ec6 *man/cleave.Rd 26a8c820d023327ed33d97a970c7abbb *man/comments.Rd 0e7a53ee5377737df29460f2118588c7 *man/compare.Rd e680986987b55d3743b9818a8c5ef202 *man/compliant.Rd f886ac9c9ba7c316259d2ea77d45e51f *man/cutoff.Rd bf21cf5c2923605655bd8ccaab85f7a5 *man/display.Rd 8de08165e196bab369e60986c9816788 *man/domain.Rd 950893dbeb037f2265d0d8b58ee92b3c *man/encrypt.Rd 1fdd63a76101e9216541076dfc141c25 *man/envelope.Rd e4beb641d2a678081dc33f215f9b932d *man/figures/emayili-github-card.png 826eee4cad3710d493fa0462e5d473b9 *man/figures/emayili-hex.png 09e6522ed5ce2b6ed0892d259465daed *man/figures/screenshot-email-rendered.png 3ca1263c4b64026389769d6cab242f5b *man/format.address.Rd c1572da53ed8df44c23577995e2d50ca *man/html.Rd 3b21c526f62c0cb5ed96eedae99ab6f9 *man/id.Rd 128d33ca4acaa491e34d1e9531153cc0 *man/keywords.Rd 0854d7ed1efdea83401b5c01971f251e *man/length.address.Rd c0b86388f87ba0e1e668de3b71f4eb71 *man/local.Rd 9a97fdf484ab576ea8bc54a785200000 *man/message_id.Rd 596f80d468308458b3c08ae34b5bdafe *man/mime-parameters.Rd 74e73f6a50060ce7e13d66e5ce29dd8c *man/normalise.Rd 2572ed5d1f600ea841d6af4a3bcb95ed *man/parties.Rd 07097c63c93f20bbd4d0a537e6684dc4 *man/pipe.Rd 22d55d4fd740d58b38be511da68f48bf *man/precedence.Rd f72a38568f255c606a5b85bf16e299ce *man/print.address.Rd 9178592f5c3c818417e9e913bf151113 *man/print.envelope.Rd 9f39f44dc351935844355731bf1f10bb *man/qp.Rd 425ba683c8295264c69829e0f59555bd *man/raw.Rd d39198e3734ea21736fe4b79b1a50038 *man/receipt.Rd 6787ad1f0462a5e54672563f9dc4cae4 *man/render.Rd 9832fc04d5ff6231df20f20a8aa30807 *man/response.Rd 304f0a5e546b8f8c0d8d82a84a3c71d2 *man/sensitivity.Rd 6aec0391a9724d2af1ffcfd8daef2899 *man/server.Rd 7abeb5f36d31f1b47889f540d070d033 *man/subject.Rd 3fb9a64bec1c685ecb7d6123f5fa3aa5 *man/template.Rd fe2f365a7b973924131f4da469b86ed8 *man/text.Rd 86b433dd45954b567fd10f55bff72184 *man/validate.Rd 31af74948dba8a5c9e23b82f47e15e8c *tools/check.R 29559943ae06e20f7f2770b7d705db68 *tools/coverage.R 863114db451b9d9369d3cfe98dabf764 *tools/lint.R emayili/R/ 0000755 0001762 0000144 00000000000 14751307772 012121 5 ustar ligges users emayili/R/envelope.R 0000644 0001762 0000144 00000012554 14751307772 014070 0 ustar ligges users is.envelope <- function(x) { "envelope" %in% class(x) } #' Create a message. #' #' @param to See [to()]. #' @param from See [from()]. #' @param cc See [cc()]. #' @param bcc See [bcc()]. #' @param reply See [reply()]. #' @param subject See [subject()]. #' @param id See [id()]. #' @param importance See [importance()]. #' @param priority See [priority()]. #' @param text See [text()]. #' @param html See [html()]. #' @param encrypt Whether to encrypt the message. If \code{TRUE} then the entire #' message will be encrypted using the private key of the sender. #' @param sign Whether to sign the message. If \code{TRUE} then the entire #' message will be signed using the private key of the sender. #' @param public_key Whether to attach a public key. If \code{TRUE} then the #' public key of the sender will be attached. #' #' @return A message object. #' @seealso [subject()], [from()], [to()], [cc()], [bcc()], [reply()] and #' [encrypt()]. #' @export #' @examples #' # Create an (empty) message object. #' # #' msg <- envelope() #' #' # Create a complete message object, specifying all available fields. #' # #' envelope( #' to = "bob@gmail.com", #' from = "craig@gmail.com", #' cc = "alex@gmail.com", #' bcc = "shannon@gmail.com", #' reply = "craig@yahoo.com", #' importance = "high", #' priority = "urgent", #' subject = "Hiya!", #' text = "Hi Bob, how are you?" #' ) envelope <- function(to = NULL, from = NULL, cc = NULL, bcc = NULL, reply = NULL, subject = NULL, id = NULL, importance = NULL, priority = NULL, text = NULL, html = NULL, encrypt = FALSE, sign = FALSE, public_key = FALSE) { koevert <- structure( list( headers = list(), encrypt = encrypt, sign = sign, public_key = public_key, parts = NULL ), class = "envelope" ) %>% header_set("Date", http_date(Sys.time()), append = FALSE) %>% header_set("X-Mailer", paste("{emayili}", packageVersion("emayili"), sep = "-"), append = FALSE) %>% header_set("MIME-Version", "1.0", append = FALSE) if (!is.null(to)) koevert <- to(koevert, to) if (!is.null(from)) koevert <- from(koevert, from) if (!is.null(cc)) koevert <- cc(koevert, cc) if (!is.null(bcc)) koevert <- bcc(koevert, bcc) if (!is.null(reply)) koevert <- reply(koevert, reply) if (!is.null(subject)) koevert <- subject(koevert, subject) if (!is.null(id)) koevert <- id(koevert, id) if (!is.null(importance)) koevert <- importance(koevert, importance) if (!is.null(priority)) koevert <- priority(koevert, priority) if (!is.null(text)) koevert <- text(koevert, text) if (!is.null(html)) koevert <- html(koevert, html) koevert } headers <- function(x, encode = FALSE) { headers <- x$headers # Drop the Bcc header. headers <- headers[names(headers) != "Bcc"] paste(map_chr(headers, as.character, encode = encode), collapse = "\r\n") } #' Print a message object #' #' The message body will be printed if `details` is `TRUE` or if the `envelope_details` #' option is `TRUE`. #' #' @param x A message object. #' @param details Whether or not to display full message content. #' @param ... Further arguments passed to or from other methods. #' #' @export #' @examples #' msg <- envelope() %>% text("Hello, World!") #' #' print(msg) #' print(msg, details = TRUE) #' #' options(envelope_details = TRUE) #' print(msg) print.envelope <- function(x, details = NA, ...) { if (is.na(details)) { details <- get_option_details(default = FALSE) } stopifnot(is.logical(details)) # as.character(x, details = details) %>% cat("\n", sep = "") } #' Create formatted message. #' #' Accepts a message object and formats it as a MIME document. #' #' @inheritParams print.envelope #' @param encode Whether to encode headers. #' @export #' #' @return A formatted message object. as.character.envelope <- function(x, ..., details = TRUE, encode = FALSE) { message <- list( headers(x, encode = encode) ) # Extract HTML and/or text. body <- discard(x$parts, ~ identical(.x$disposition, "attachment")) # Extract attachments. attachments <- keep(x$parts, ~ identical(.x$disposition, "attachment")) if (length(body) > 0) { if (length(body) > 1) { # Both HTML and text. body <- multipart_alternative(children = body) } else { # Either HTML or text (but not both). body <- body[[1]] } } else { body <- NULL } if (length(attachments) > 0) { children <- c(list(body), attachments) # Drop any NULL items. children <- compact(children) content <- multipart_mixed(children = children) } else { content <- body } body <- encrypt_body( content, parties(x), encrypt = x$encrypt, sign = x$sign, public_key = x$public_key ) if (details) { message <- c(message, as.character(body)) } do.call(paste0, c(list(message), collapse = "\r\n")) } #' Append children to message #' #' @param x Message object #' @param child A child to be appended after.envelope <- function(x, child) { if (is.null(x$parts)) { log_debug("Adding first child.") x$parts <- list(child) } else { log_debug("Adding subsequent child.") x$parts <- c(x$parts, list(child)) } x } emayili/R/render.R 0000644 0001762 0000144 00000017555 14611676075 013540 0 ustar ligges users manifest <- function(msg, markdown, params = NULL, squish = TRUE, css, include_css, language) { stopifnot(is.null(params) || is.list(params)) if (plain <- attr(markdown, "plain")) { output <- markdown_html(markdown) %>% read_html() } else { # Create temporary Rmd file. # # This needs to be in the current directory in case the Rmd is accessing # files (like CSV) using a relative path. # input <- tempfile(fileext = ".Rmd", tmpdir = getwd()) output <- sub("\\.Rmd", ".html", input) # Clean up rendered artefacts. # on.exit(unlink(sub("\\.Rmd", "*", input), recursive = TRUE)) # Write input to file. stri_write_lines(markdown, input) output_format <- html_document( self_contained = TRUE, # Silence pandoc warnings (mostly due to missing document title). pandoc_args = "--quiet" ) output_format$knitr$knit_hooks <- list( plot = function(x, options) { caption <- options$fig.cap alt <- options$fig.alt if (is.null(alt)) alt <- caption class <- options$fig.class width <- options$out.width as.character( tags$figure( tags$img( src = x, alt = alt, width = width ), if (is.null(caption)) NULL else tags$figcaption(caption), class = class ) ) } ) # Render from file to file. rmarkdown::render( input, output_format = output_format, output_file = output, params = params, quiet = TRUE, # Pass a clean environment. This makes it possible to use params name in # this scope. envir = new.env() ) # Read output from file. output <- read_html(output) } # Decide what sources of CSS to retain. # # * Inline CSS in tags. if (any("rmd" == include_css)) { log_debug("- Retain CSS from inline tags.") } else { log_debug("- Remove CSS from inline tags.") xml_remove(xml_find_all(output, "//link[starts-with(@href,'data:text/css')]")) } # # * External CSS in tags. # - Doesn't apply to Plain Markdown. log_debug("- Remove CSS from external tags.") xml_remove(xml_find_all(output, "//link[not(starts-with(@href,'data:text/css'))]")) # # * Inline CSS in
{{ jumbo_text }}
{% endif %}{{ card.text }}
{{ about }}