-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprotocol_preview.Rmd
44 lines (39 loc) · 1.74 KB
/
protocol_preview.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
runtime: shiny
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, eval=TRUE, message=FALSE, warning=FALSE)
```
```{r, results = 'asis'}
cat("<h4><center> - ODMAP protocol - </center></h4>", sep = "")
cat("<h2><center>", input$o_authorship_1, "</center></h2>", sep = "")
cat("<p><b>Authors: </b>", paste(authors$df$first_name, authors$df$last_name, collapse = ", "), "</p>", sep = "")
cat("<p><b>Contact: </b>", input$o_authorship_2, "</p>", sep = "")
cat("<p><b>Date: </b>", as.character(Sys.Date()), "</p>", sep = "")
cat("\n", "______________", "\n", sep = "")
section = ""
subsection = ""
odmap_dict_rmd = filter(odmap_dict,! element_id %in% c("o_title_1", "o_authorship_1", "o_authorship_2", elem_hidden))
for(i in 1:nrow(odmap_dict_rmd)){
# Find out if new section header needs to be rendered
section_new = odmap_dict_rmd$section_id[i]
if(section_new != section & !(section_new %in% elem_hide[[input$o_objective_1]])){
section = section_new
knit_section(section)
}
# Find out if new subsection header needs to be rendered
subsection_new = odmap_dict_rmd$subsection_id[i]
if(subsection_new != subsection & !(subsection_new %in% elem_hide[[input$o_objective_1]])){
subsection = subsection_new
knit_subsection(subsection)
}
# Render elements
switch(odmap_dict_rmd$element_type[i],
text = knit_text(odmap_dict_rmd$element_id[i]),
suggestion = knit_suggestion(odmap_dict_rmd$element_id[i]),
objective = knit_suggestion(odmap_dict_rmd$element_id[i]),
extent = knit_extent(odmap_dict_rmd$element_id[i]),
model_algorithm = knit_suggestion(odmap_dict_rmd$element_id[i]),
model_setting = knit_model_settings(odmap_dict_rmd$element_id[i]))
}