Skip to content

Commit

Permalink
Delete manuscript folder
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 17, 2024
1 parent 4e30ad8 commit 004076a
Show file tree
Hide file tree
Showing 45 changed files with 101 additions and 126 deletions.
87 changes: 87 additions & 0 deletions make_screenshots.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/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")
}

# Find .git root directory
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))


Sys.setenv("CHROMOTE_CHROME" = "/usr/bin/vivaldi")

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)
}

# Collect all the chapter pages for the url given
chapt_df <- ottrpal::get_chapters(html_page = file.path(root_dir, "docs", "index.html"),
base_url = base_url)

# Now take screenshots for each
file_names <- lapply(chapt_df$url, function(url) {
file_name <- gsub(".html", ".png", file.path(output_folder, basename(url)))

# Get rid of special characters because leanpub no like
file_name <- gsub(":|?|!|\\'", "", file_name)

# Take the screenshot
webshot2::webshot(url, file = file_name)

return(file_name)

})

# Save file of chapter urls and file_names
chapt_df <- chapt_df %>%
dplyr::mutate(img_path = unlist(file_names))

chapt_df %>%
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/10-Other-helpful-features.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/11-How-to-keep-your-documentation-up-to-date.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/2-Documentation:-Why-it’s-worth-the-effort!.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/3-Lessons-we-should-borrow-from-user-designers.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/4-What-does-good-documentation-look-like?.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/5-Creating-a-smooth-getting-started-section.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/6-Creating-helpful-how-to-examples.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/7-Creating-handy-reference-guides.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/8-Creating-clarifying-code-comments.md

This file was deleted.

7 changes: 0 additions & 7 deletions manuscript/9-Obtaining-user-feedback.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.

14 changes: 0 additions & 14 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 removed manuscript/resources/chapt_screen_images/index.png
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.
28 changes: 14 additions & 14 deletions resources/chapt_screen_images/chapter_urls.tsv
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
url chapt_title img_path
https://jhudatascience.org/Documentation_and_Usability/no_toc/index.html About this course resources/chapt_screen_images/index.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/introduction.html 1 Introduction resources/chapt_screen_images/introduction.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/documentation-why-its-worth-the-effort.html 2 Documentation: Why it’s worth the effort! resources/chapt_screen_images/documentation-why-its-worth-the-effort.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/lessons-we-should-borrow-from-user-designers.html 3 Lessons we should borrow from user designers resources/chapt_screen_images/lessons-we-should-borrow-from-user-designers.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/what-does-good-documentation-look-like.html 4 What does good documentation look like? resources/chapt_screen_images/what-does-good-documentation-look-like.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/creating-a-smooth-getting-started-section.html 5 Creating a smooth getting started section resources/chapt_screen_images/creating-a-smooth-getting-started-section.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/creating-helpful-how-to-examples.html 6 Creating helpful how-to examples resources/chapt_screen_images/creating-helpful-how-to-examples.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/creating-handy-reference-guides.html 7 Creating handy reference guides resources/chapt_screen_images/creating-handy-reference-guides.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/creating-clarifying-code-comments.html 8 Creating clarifying code comments resources/chapt_screen_images/creating-clarifying-code-comments.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/obtaining-user-feedback.html 9 Obtaining user feedback resources/chapt_screen_images/obtaining-user-feedback.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/other-helpful-features.html 10 Other helpful features resources/chapt_screen_images/other-helpful-features.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/how-to-keep-your-documentation-up-to-date.html 11 How to keep your documentation up to date resources/chapt_screen_images/how-to-keep-your-documentation-up-to-date.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/about-the-authors.html About the Authors resources/chapt_screen_images/about-the-authors.png
https://jhudatascience.org/Documentation_and_Usability/no_toc/references.html References resources/chapt_screen_images/references.png
https://jhudatascience.org/Documentation_and_Usability/index.html About this course resources/chapt_screen_images/index.png
https://jhudatascience.org/Documentation_and_Usability/introduction.html 1 Introduction resources/chapt_screen_images/introduction.png
https://jhudatascience.org/Documentation_and_Usability/documentation-why-its-worth-the-effort.html 2 Documentation: Why it’s worth the effort! resources/chapt_screen_images/documentation-why-its-worth-the-effort.png
https://jhudatascience.org/Documentation_and_Usability/lessons-we-should-borrow-from-user-designers.html 3 Lessons we should borrow from user designers resources/chapt_screen_images/lessons-we-should-borrow-from-user-designers.png
https://jhudatascience.org/Documentation_and_Usability/what-does-good-documentation-look-like.html 4 What does good documentation look like? resources/chapt_screen_images/what-does-good-documentation-look-like.png
https://jhudatascience.org/Documentation_and_Usability/creating-a-smooth-getting-started-section.html 5 Creating a smooth getting started section resources/chapt_screen_images/creating-a-smooth-getting-started-section.png
https://jhudatascience.org/Documentation_and_Usability/creating-helpful-how-to-examples.html 6 Creating helpful how-to examples resources/chapt_screen_images/creating-helpful-how-to-examples.png
https://jhudatascience.org/Documentation_and_Usability/creating-handy-reference-guides.html 7 Creating handy reference guides resources/chapt_screen_images/creating-handy-reference-guides.png
https://jhudatascience.org/Documentation_and_Usability/creating-clarifying-code-comments.html 8 Creating clarifying code comments resources/chapt_screen_images/creating-clarifying-code-comments.png
https://jhudatascience.org/Documentation_and_Usability/obtaining-user-feedback.html 9 Obtaining user feedback resources/chapt_screen_images/obtaining-user-feedback.png
https://jhudatascience.org/Documentation_and_Usability/other-helpful-features.html 10 Other helpful features resources/chapt_screen_images/other-helpful-features.png
https://jhudatascience.org/Documentation_and_Usability/how-to-keep-your-documentation-up-to-date.html 11 How to keep your documentation up to date resources/chapt_screen_images/how-to-keep-your-documentation-up-to-date.png
https://jhudatascience.org/Documentation_and_Usability/about-the-authors.html About the Authors resources/chapt_screen_images/about-the-authors.png
https://jhudatascience.org/Documentation_and_Usability/references.html References 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.
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.
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.
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/obtaining-user-feedback.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/other-helpful-features.png
Binary file modified resources/chapt_screen_images/references.png

0 comments on commit 004076a

Please sign in to comment.