Skip to content

Commit

Permalink
fixed links
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalci committed Jun 29, 2024
1 parent 80e4ce1 commit 64739c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ui <- fluidPage(
checkboxInput("diagnosis", "Diagnosis", value = TRUE),
checkboxInput("use_youtube", "Use YouTube", value = FALSE),
textInput("youtube_link", "YouTube Link", value = "youtube_link"),
checkboxInput("end_template", "End Template", value = FALSE),
actionButton("generate", "Generate Code"),
br(),
downloadButton('downloadFile_qmd', 'Download qmd file'),
Expand Down Expand Up @@ -95,7 +96,8 @@ server <- function(input, output) {
stain = stain,
diagnosis = input$diagnosis,
use_youtube = input$use_youtube,
youtube_link = input$youtube_link
youtube_link = input$youtube_link,
end_template = input$end_template
)
})

Expand Down
20 changes: 17 additions & 3 deletions generate_qmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ readme_text <- function(
stain = c("HE1", "HE2"),
diagnosis = FALSE,
use_youtube = FALSE,
youtube_link = "youtube_link"
youtube_link = "youtube_link",
end_template = FALSE
) {


Expand Down Expand Up @@ -530,6 +531,7 @@ update html file heading:

## yaml string ----


yaml_string <- paste0("
```yaml
- stainname: {{template}}-{{stain}}
Expand Down Expand Up @@ -565,7 +567,7 @@ yaml_string <- paste0("
screenshot: https://www.patolojiatlasi.com/screenshots/thumbnail_{{template}}-{{stain}}.png
github: https:///github.com/pathologyatlas/{{template}}
githubpage: https://pathologyatlas.github.io/{{template}}
youtube: https://www.youtube.com/watch?v={{youtube_link}}
youtube:" , ifelse(use_youtube, paste0("https://www.youtube.com/watch?v=", youtube_link), "''"), "
```
"
)
Expand Down Expand Up @@ -797,12 +799,24 @@ for (s in stain) {

}

if (!use_youtube) {
readme_text <- gsub(pattern = "youtube: https://www.youtube.com/watch\\?v=.+", replacement = "youtube: ''", x = readme_text, perl = TRUE)
}




## end render ----

readme_text <- paste(readme_text, end_string, sep = "\n\n")


if (end_template) {

readme_text <- paste(readme_text, end_string, sep = "\n\n")

}




readme_text <- gsub(pattern = "((<", replacement = "{{<", x = readme_text, fixed = TRUE)
Expand Down

0 comments on commit 64739c3

Please sign in to comment.