R/paste_kindle.R

Defines functions paste_kindle paste_apple_book

Documented in paste_apple_book paste_kindle

#' Paste Kindle notes in an elegant way
#'
#' @return Character.
#' @author Jiaxiang Li
#'
#' @importFrom stringr str_remove_all
#' @importFrom clipr read_clip
#' @export
#' @examples
#' \donttest{paste_kindle()}
paste_kindle <- function() {
    text <-
        clipr::read_clip() %>%
        .[1] %>%
        stringr::str_remove_all('[:space:]')
    insert_lines(text)
    write_bottom_line(text)
}
#' Paste Apple Book's notes in an elegant way
#'
#' @return Character.
#' @author Jiaxiang Li
#'
#' @importFrom stringr str_remove_all str_subset
#' @importFrom clipr read_clip
#' @export
#' @examples
#' \donttest{paste_apple_book()}
paste_apple_book <- function() {
    text <-
        clipr::read_clip() %>%
        stringr::str_subset("Apple\\sBooks\\.\\s$", negate = TRUE) %>%
        stringr::str_remove("^\u201c") %>%
        stringr::str_remove("\u201d$")
    insert_lines(text)
    write_bottom_line(text)
}
JiaxiangBU/add2md documentation built on Jan. 31, 2020, 7:46 p.m.