Skip to content

Commit

Permalink
Make lines shorter than 80 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
csouchet committed Oct 27, 2022
1 parent e31f80b commit 8004f07
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
41 changes: 27 additions & 14 deletions R/bpmnVisualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,29 @@
#' @description Display BPMN diagram based on BPMN definition in XML format
#'
#' @param bpmnXML A file name or xml document or string in BPMN XML format
#' @param overlays An element or a list of elements to be added to the diagram's existing elements.
#' Use overlay function to create an overlay object with content and relative position.
#' @param width Fixed width for widget (in css units). The default is \code{NULL}, which results in intelligent automatic sizing based on the widget's container.
#' @param height Fixed height for widget (in css units). The default is \code{NULL}, which results in intelligent automatic sizing based on the widget's container.
#' @param overlays An element or a list of elements to be added to the diagram's
#' existing elements.
#' Use overlay function to create an overlay object with content and
#' relative position.
#' @param width Fixed width for widget (in css units).
#' The default is \code{NULL}, which results in intelligent automatic
#' sizing based on the widget's container.
#' @param height Fixed height for widget (in css units).
#' The default is \code{NULL}, which results in intelligent automatic
#' sizing based on the widget's container.
#' @param elementId The id of the HTML element to enclose the widget.
#' Use an explicit element ID for the widget (rather than an automatically
#' generated one). Useful if you have other JavaScript that needs to explicitly
#' discover and interact with a specific widget instance.
#' generated one). Useful if you have other JavaScript that needs to
#' explicitly discover and interact with a specific widget instance.
#'
#' @returns A \code{bpmn-visualization} Widget that will intelligently print itself into HTML in a variety of contexts
#' including the R console, within R Markdown documents, and within Shiny output bindings.
#' @returns A \code{bpmn-visualization} Widget that will intelligently print
#' itself into HTML in a variety of contexts including the R console,
#' within R Markdown documents, and within Shiny output bindings.
#'
#' @examples
#' # Load the BPMN file
#' bpmn_file <- system.file("examples/Order_Management.bpmn", package = "bpmnVisualization")
#' bpmn_file <- system.file("examples/Order_Management.bpmn",
#' package = "bpmnVisualization")
#'
#' # Display the BPMN diagram
#' display(bpmn_file, width='auto', height='auto')
Expand Down Expand Up @@ -73,14 +81,16 @@ display <- function(bpmnXML,
#'
#' @name bpmnVisualization-shiny-output
#' @description
#' Helper to create output function for using the \code{bpmn-visualization} HTML widget within Shiny applications and interactive Rmd documents.
#' Helper to create output function for using the \code{bpmn-visualization}
#' HTML widget within Shiny applications and interactive Rmd documents.
#'
#' @param outputId output variable to read from
#' @param width,height Must be a valid CSS unit (like \code{'100\%'},
#' \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a
#' string and have \code{'px'} appended.
#'
#' @returns An output function that enables the use of the \code{bpmn-visualization} widget within Shiny applications.
#' @returns An output function that enables the use of the
#' \code{bpmn-visualization} widget within Shiny applications.
#'
#' @export
bpmnVisualizationOutput <- function(outputId,
Expand All @@ -97,14 +107,17 @@ bpmnVisualizationOutput <- function(outputId,
#'
#' @rdname bpmnVisualization-shiny-render
#' @description
#' Helper to create render function for using the \code{bpmn-visualization} HTML widget within Shiny applications and interactive Rmd documents.
#' Helper to create render function for using the \code{bpmn-visualization}
#' HTML widget within Shiny applications and interactive Rmd documents.
#'
#' @param expr An expression that generates a \code{bpmn-visualization} HTML widget
#' @param expr An expression that generates a \code{bpmn-visualization} HTML
#' widget
#' @param env The environment in which to evaluate \code{expr}.
#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This
#' is useful if you want to save an expression in a variable.
#'
#' @returns A render function that enables the use of the \code{bpmn-visualization} widget within Shiny applications.
#' @returns A render function that enables the use of the
#' \code{bpmn-visualization} widget within Shiny applications.
#'
#' @export
renderBpmnVisualization <- function(expr,
Expand Down
6 changes: 4 additions & 2 deletions R/funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ build_bpmnContent <- function(bpmnXML,
bpmnContent <- as.character(xml)
}
} else {
stop("bpmnXML must be a absolute path of BPMN file or the string of the BPMN content !!")
stop("bpmnXML must be a absolute path of BPMN file or the string of the BPMN
content !!")
}
x <- list(bpmnContent = bpmnContent)

if (length(overlays)) {
# In case the user passes a single parameter as overlays (instead of a list), we wrap it into a list so the js can work
# In case the user passes a single parameter as overlay (instead of a list),
# we wrap it into a list, so the js can work.
x$overlays <- if (is.list(overlays[[1]])) {
overlays
} else {
Expand Down

0 comments on commit 8004f07

Please sign in to comment.