R/body.R

Defines functions get_body get_body.mwparserfromhell.nodes.tag.Tag

#'@export
get_body.mwparserfromhell.nodes.tag.Tag <- function(node, as_text){
  out <- node$contents
  if(as_text){
    return(reticulate::py_str(out))
  }
  return(out)
}


#'@import methods
#'@export
get_body <- function(nodes, as_text = FALSE){
  out <- lapply(nodes, function(node, as_text){
    UseMethod("get_body", node)
  }, as_text = as_text)
  return(unlist(out))
}
Ironholds/mwparser documentation built on Aug. 2, 2017, 1:24 p.m.