Skip to content

Commit

Permalink
Delete manuscript folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jhudsl-robot committed Mar 25, 2024
1 parent 7c88706 commit 5761df9
Show file tree
Hide file tree
Showing 38 changed files with 74 additions and 96 deletions.
74 changes: 74 additions & 0 deletions make_screenshots.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env Rscript
# Written by Candace Savonen Jan 2022

if (!('devtools' %in% installed.packages())) {
# install.packages("remotes", repos = "http://cran.us.r-project.org")
}

if (!('optparse' %in% installed.packages())) {
# install.packages("optparse", repos = "http://cran.us.r-project.org")
}

webshot::install_phantomjs()

library(optparse)
library(magrittr)

option_list <- list(
optparse::make_option(
c("--repo"),
type = "character",
default = NULL,
help = "GitHub repository name, e.g. jhudsl/OTTR_Template",
),
optparse::make_option(
c("--git_pat"),
type = "character",
default = NULL,
help = "GitHub personal access token",
),
optparse::make_option(
c("--output_dir"),
type = "character",
default = "resources/chapt_screen_images",
help = "Output directory where the chapter's screen images should be stored",
),
optparse::make_option(
c("--base_url"),
type = "character",
default = NULL,
help = "Output directory where the chapter's screen images should be stored",
)
)

# Read the arguments passed
opt_parser <- optparse::OptionParser(option_list = option_list)
opt <- optparse::parse_args(opt_parser)

output_folder <- file.path(opt$output_dir)
if (!dir.exists(output_folder)) {
dir.create(output_folder, recursive = TRUE)
}

if (is.null(opt$base_url)) {
base_url <- cow::get_pages_url(repo_name = opt$repo, git_pat = opt$git_pat)
base_url <- gsub("/$", "", base_url)
}

chapt_df <- ottrpal::get_chapters(base_url = file.path(base_url, "no_toc/"))

file_names <- lapply(chapt_df$url, function(url) {
file_name <- gsub(".html", ".png", file.path(output_folder, basename(url)))
# Get rid of special characters
webshot::webshot(url, file_name)
file_name <- gsub(":|?|!|\\'", "", file_name)
message(paste("Screenshot saved:", file_name))
return(file_name)
})

# Save file of chapter urls and file_names
chapt_df %>%
dplyr::mutate(img_path = unlist(file_names)) %>%
readr::write_tsv(file.path(output_folder, "chapter_urls.tsv"))

message(paste("Image Chapter key written to: ", file.path(output_folder, "chapter_urls.tsv")))
7 changes: 0 additions & 7 deletions manuscript/1-Introduction.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/2-Defining-reproducibility.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/3-Organizing-your-project.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/4-Making-your-project-open-source-with-GitHub.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/5-Using-Notebooks.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/6-Managing-package-versions.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/7-Writing-durable-code.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/8-Documenting-analyses.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/9-Code-review.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/About-the-Authors.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/About-this-Course.md

This file was deleted.

12 changes: 0 additions & 12 deletions manuscript/Book.txt

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/References.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified resources/chapt_screen_images/about-the-authors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/code-review.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/defining-reproducibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/documenting-analyses.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/introduction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/managing-package-versions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/organizing-your-project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/references.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/using-notebooks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/chapt_screen_images/writing-durable-code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5761df9

Please sign in to comment.