| Package: ermoji | Package: ermoji | ||||
| Title: RStudio Addin to Search and Copy Emoji | Title: RStudio Addin to Search and Copy Emoji | ||||
| Version: 0.1.3 | |||||
| Version: 0.1.4 | |||||
| Authors@R: "Garrrick Aden-Buie <garrick@adenbuie.com> [aut, cre]" | Authors@R: "Garrrick Aden-Buie <garrick@adenbuie.com> [aut, cre]" | ||||
| Description: RStudio addin to search through emoji and copy the | Description: RStudio addin to search through emoji and copy the | ||||
| emoji name, unicode string or glyph to the clipboard. | emoji name, unicode string or glyph to the clipboard. | ||||
| License: MIT + file LICENSE | License: MIT + file LICENSE | ||||
| URL: https://github.com/gadenbuie/ermoji | URL: https://github.com/gadenbuie/ermoji | ||||
| BugReports: https://github.com/gadenbuie/ermoji/issues | BugReports: https://github.com/gadenbuie/ermoji/issues | ||||
| Depends: | |||||
| miniUI, | |||||
| shiny | |||||
| Imports: | Imports: | ||||
| clipr, | clipr, | ||||
| DT, | DT, | ||||
| emo | |||||
| emo, | |||||
| miniUI, | |||||
| shiny | |||||
| Remotes: | Remotes: | ||||
| hadley/emo | hadley/emo | ||||
| ByteCompile: true | ByteCompile: true | ||||
| Encoding: UTF-8 | Encoding: UTF-8 | ||||
| LazyData: true | LazyData: true | ||||
| Roxygen: list(markdown = TRUE) | Roxygen: list(markdown = TRUE) | ||||
| RoxygenNote: 6.1.0 | |||||
| RoxygenNote: 7.0.2 |
| # Generated by roxygen2: do not edit by hand | # Generated by roxygen2: do not edit by hand | ||||
| export(emoji2html) | |||||
| export(ermoji_gadget) | export(ermoji_gadget) | ||||
| export(ermoji_shiny) | export(ermoji_shiny) | ||||
| import(miniUI) | import(miniUI) |
| x | x | ||||
| } | } | ||||
| #' Convert Emoji to HTML | |||||
| #' | |||||
| #' Uses [emo::ji()] to look up emoji, but return the escaped HTML. | |||||
| #' | |||||
| #' @param x A search term passed to [emo::ji()] or the result of [emo::ji()]. | |||||
| #' @param copy Should the result be copied to the clipboard? | |||||
| #' @export | |||||
| emoji2html <- function(x, copy = clipr::clipr_available()) { | |||||
| emojis <- emo::jis$runes | |||||
| names(emojis) <- emo::jis$emoji | |||||
| if (!inherits(x, "emoji")) { | |||||
| x <- emo::ji(x) | |||||
| } | |||||
| emoji <- emojis[x] | |||||
| emoji_html <- rune2html(unname(emoji)) | |||||
| if (copy) { | |||||
| clipr::write_clip(emoji_html) | |||||
| message(emoji_html, " copied to clipboard") | |||||
| return(invisible(emoji_html)) | |||||
| } | |||||
| emoji_html | |||||
| } | |||||
| rune2html <- function(runes) { | rune2html <- function(runes) { | ||||
| gsub("([0-9A-F]{4,8}) ?", "&#x\\1;", runes) | gsub("([0-9A-F]{4,8}) ?", "&#x\\1;", runes) | ||||
| } | } |
| % Generated by roxygen2: do not edit by hand | |||||
| % Please edit documentation in R/ermoji_gadget.R | |||||
| \name{emoji2html} | |||||
| \alias{emoji2html} | |||||
| \title{Convert Emoji to HTML} | |||||
| \usage{ | |||||
| emoji2html(x, copy = clipr::clipr_available()) | |||||
| } | |||||
| \arguments{ | |||||
| \item{x}{A search term passed to \code{\link[emo:ji]{emo::ji()}} or the result of \code{\link[emo:ji]{emo::ji()}}.} | |||||
| \item{copy}{Should the result be copied to the clipboard?} | |||||
| } | |||||
| \description{ | |||||
| Uses \code{\link[emo:ji]{emo::ji()}} to look up emoji, but return the escaped HTML. | |||||
| } |