Skip to content

Instantly share code, notes, and snippets.

@rkrug
Last active June 17, 2020 09:17
Show Gist options
  • Save rkrug/7cf45882afe70439bf3bb0d907416cb6 to your computer and use it in GitHub Desktop.
Save rkrug/7cf45882afe70439bf3bb0d907416cb6 to your computer and use it in GitHub Desktop.
---
title: "plantuml test"
author: "Rainer M Krug"
date: "6/17/2020"
output: html_document
---
```{r setup, include=FALSE}
library(plantuml)
knitr::knit_engines$set(
plantuml = function(options) {
code <- paste(options$code, collapse = "\n")
if (options$eval) {
#
puml <- plantuml(code)
if (is.null( options$plantuml.format )) {
fig_type <- "png"
} else {
fig_type <- options$plantuml.format
}
fig <- paste0(options$label, ".", fig_type)
#
tmp_fig <- tempfile(fileext = fig)
plot(
x = puml,
file = fig
)
file.copy(tmp_fig, fig)
out <- list(knitr::include_graphics(fig))
knitr::engine_output(
options = options,
out = out
)
} else {
out <- NULL
knitr::engine_output(
options = options,
code = code,
out = out
)
}
}
)
```
## R Markdown
```{plantuml tut, eval = FALSE, plantuml.format = "svg"}
@startuml
start
''''''''''''
:= Install and load the `dmdScheme` package in R
..R..
""install.packages("dmdScheme")""
""library("dmdScheme")""|
:= Start the included shiny app
..R..
""run_app()""|
''''''''''''
:= Select scheme
..BROWSER..
""Availabe dmdSchemes"";
''''''''''''
:= Download New Scheme
..BROWSER..;
''''''''''''
repeat
:= Enter / Edit metadata in downloaded xlsx
..Excel, Pages, Libre Office, Google Docs, etc..;
:= Upload Spreadsheet containig Metadata
..BROWSER..|
:= Upload Datafiles
..BROWSER..|
:= Validate metadata and create report
..BROWSER..;
repeat while (errors or warnings?) is (yes)
-> no;
''''''''''''
:= Export Uploaded Spreadsheet to xml
..BROWSER..;
''''''''''''
stop
@enduml
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment