R/plantuml.R

Defines functions plantuml

Documented in plantuml

#' Convert a character to a \code{plantuml} object
#'
#' Convert a \code{character} to a \code{plantuml} object.
#' This can be plotted.
#'
#' @param x character sting containing plantuml code.
#'
#' @return object of class \code{plantuml} which can be plotted.
#' @export
#'
#' @examples
#' \dontrun{
#' x <- '
#' (*) --> "Initialization"
#'
#' if "Some Test" then
#' -->[true] "Some Activity"
#' --> "Another activity"
#' -right-> (*)
#' else
#'   ->[false] "Something else"
#' -->[Ending process] (*)
#' endif
#' '
#' x <- plantuml( x )
#' plot( x )
#' }
#'
plantuml <- function(
  x = NULL
  ) {
  x <- trimws(x)
  puml <- list(
    code = x,
    x = x,
    evaluated = FALSE,
    complete = TRUE
  )
  attr(puml, "class") <- "plantuml"
  return(puml)
}
rkrug/plantuml documentation built on June 3, 2023, 6:24 a.m.