Skip to content

Commit

Permalink
#184 Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
manciniedoardo committed Sep 12, 2024
1 parent 10012d6 commit c5cc6b7
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 125 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Thank you for your Pull Request! We have developed this task checklist to help w
Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `main` branch until you have checked off each task.

- [ ] Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update), and make sure the corresponding issue is linked in the Development section on the right hand side
- [ ] Ensure your new post folder is of the form `"posts/zzz_DO_NOT_EDIT_<your post title>"`. This is so that the post date can be auto-updated upon the merge into `main`.
- [ ] Run the script from `CICD.R` line by line to first check the spelling in your post and then to make sure your code is compatible with our code-style. Address any incongruences by following the instructions in the file!
- [ ] Choose (possibly several) `tag(s)` or categories from the current list: ` c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical")` for your blog post. If you cannot find anything that fits your blog post, propose a new tag to the maintainers! Note: if you use a tag not from this list, the "Check Post Tags" CICD pipeline will error. We occasionally tidy up all `tags` for consistency.
- [ ] Add a short description for your blog post in the `description` field at the top of the markdown document.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_post_dates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Update post dates
on:
push:
branches:
- 'cicd_testing'
- 'main'

jobs:
Update-post-dates:
Expand Down
2 changes: 1 addition & 1 deletion R/create_blogpost.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ print(allowed_tags)
# Fill in the info, e.g.:
create_post(
post_name = "My Blog", # needs to be character vector (length 1)
post_date = "2024-12-01", # needs to be character vector (length 1)
post_date = "2024-12-01", # needs to be length 1character vector and will be auto-updated when your post is merged
description = "", # you can fill the description in later as well
author = c("My Name"), # one or more authors are permitted
cover_image = "pharmaverse", # chose one of the above (see line 8)
Expand Down
2 changes: 1 addition & 1 deletion R/help_create_blogpost.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ create_post <- function(post_name,

# Prepare values
snake_name <- gsub(" ", "_", tolower(gsub("(.)([A-Z])", "\\1 \\2", post_name)))
short_name <- paste(post_date, snake_name, sep = "_")
short_name <- paste("zzz_DO_NOT_EDIT", snake_name, sep = "_")

if (short_name != short_name %>% stringr::str_trunc(30)) {
message("For the folder creation:")
Expand Down
1 change: 1 addition & 0 deletions R/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Some of these files help in creating/developing blog-posts, others are used by o
- `help_create_blogpost.R`: script containing the function(s) used by `create_blogpost.R`
- `switch.R`: Used by CICD spellcheck workflow.
- `check_post_tags.R`: Used by Check-Post-Tags CICD workflow
- `update_post_dates.R`: Used by Update-Post_Dates CICD workflow
4 changes: 2 additions & 2 deletions R/update_post_dates.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Get list of post folders where date has to be edited ----
post_folders <- list.files("posts", recursive = FALSE, pattern = "new_post")
post_folders <- list.files("posts", recursive = FALSE, pattern = "zzz_DO_NOT_EDIT")

# Prepare date to replace in a blog post and folder ----
formatted_date <- format(Sys.Date(), "%Y-%m-%d")
Expand Down Expand Up @@ -47,7 +47,7 @@ for (folder in post_folders){
writeLines(new_lines, blog_post_path)

# Update date in folder ----
new_folder_name <- stringr::str_replace(folder, "new_post", formatted_date)
new_folder_name <- stringr::str_replace(folder, "zzz_DO_NOT_EDIT", formatted_date)
file.rename(file.path("posts", folder),file.path("posts", new_folder_name))

cli::cli_inform(paste("Folder renamed for post:", yaml_list$title))
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ After that you can go wild, but we do ask that it is kept short!

- Source the script `help_create_blogpost.R` from within the `create_blogpost.R` file.

- Enter your information into the `create_post` function.
Please note that we do not currently allow users to specify their own categories (or `tags`), so you must choose (possibly several) from this list: `c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical")`.
- Enter your information into the `create_post` function. For the post date, feel free to put a placeholder date as it will be automatically replaced once the post is merged onto `main`.
Please note that we do not currently allow users to specify their own categories (or `tags`), so you must choose (possibly several) from this list: `c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical")`.

- Running that function will create a subfolder with a quarto file (`*.qmd`) in the `posts/` folder.
Both should be named based on the supplied `post_date` and `post_name` information.
The folder will be named `zzz_DO_NOT_EDIT_<your post name>`, and the `zzz_DO_NOT_EDIT` portion of the folder name
will also be automatically replaced once the post is merged onto `main`.

- Open the newly created folder and start working within the `*.qmd` file.

Expand Down
5 changes: 3 additions & 2 deletions inst/template/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ title: [TITLE]
author:
[AUTHOR]
description: [DESCR]
# Note that the date below will be auto-updated when the post is merged.
date: [DATE]
# please do not use any non-default categories.
# Please do not use any non-default categories.
# You can find the default categories in the repository README.md
categories: [[TAG]]
# feel free to change the image
# Feel free to change the image
image: [IMG]

---
Expand Down
73 changes: 0 additions & 73 deletions posts/new_post_my_blog/appendix.R

This file was deleted.

42 changes: 0 additions & 42 deletions posts/new_post_my_blog/my_blog.qmd

This file was deleted.

0 comments on commit c5cc6b7

Please sign in to comment.