Skip to content

Commit

Permalink
Merge pull request #413 from carpentries/provision-references
Browse files Browse the repository at this point in the history
allow references file to be included in dropdown
  • Loading branch information
zkamvar authored Mar 16, 2023
2 parents 22c5d4e + dcc2b64 commit a1d0ad9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
13 changes: 9 additions & 4 deletions R/create_lesson.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ create_lesson <- function(path, name = fs::path_file(path), rmd = TRUE, rstudio
copy_template("setup", fs::path(path, "learners"), "setup.md")
copy_template("index", path, "index.md")
copy_template("links", path, "links.md")
copy_template("placeholder", fs::path(path, "instructors"), "instructor-notes.md")
copy_template("placeholder", fs::path(path, "profiles"), "learner-profiles.md")
copy_template("placeholder", fs::path(path, "learners"), "reference.md",
values = c(title = "Glossary"))
copy_template("placeholder", fs::path(path, "instructors"),
name = "instructor-notes.md",
values = list(title = "Instructor Notes", heading = NULL))
copy_template("placeholder", fs::path(path, "profiles"),
name = "learner-profiles.md",
values = list(title = NULL, heading = NULL))
copy_template("placeholder", fs::path(path, "learners"),
name = "reference.md",
values = c(title = "Reference", heading = "Glossary"))

cli::cli_status_update("{cli::symbol$arrow_right} Generating {.file config.yaml} ...")
account <- tryCatch(gh::gh_whoami()$login, error = function(e) "carpentries")
Expand Down
1 change: 0 additions & 1 deletion R/utils-sidebar.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ page_location <- function(i, abs_md, er) {
#' @return a list with character vectors of HTML list elements.
#' @keywords internal
create_resources_dropdown <- function(files, type = "learners") {
files <- files[!grepl("reference[.]R?md$", fs::path_file(files))]
if (type == "learners") {
files <- files[!grepl("setup[.]R?md$", fs::path_file(files))]
}
Expand Down
8 changes: 4 additions & 4 deletions inst/templates/config-template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ carpentry: {{ carpentry }}
title: {{ title }}

# Date the lesson was created (YYYY-MM-DD, this is empty by default)
created: ~
created: {{ created }}{{ ^created }}~ # FIXME {{ /created }}

# Comma-separated list of keywords for the lesson
keywords: {{keywords}}{{^keywords}}software, data, lesson, The Carpentries{{/keywords}}
keywords: {{keywords}}{{^keywords}}software, data, lesson, The Carpentries # FIXME{{/keywords}}

# Life cycle stage of the lesson
# possible values: pre-alpha, alpha, beta, stable
life_cycle: {{ life_cycle }}

# License of the lesson
# License of the lesson materials (recommended CC-BY 4.0)
license: {{ license }}

# Link to the source repository for this lesson
source: {{ source }}{{ ^source }}https://example.com/template-source{{ /source }}
source: {{ source }}{{ ^source }}https://example.com/FIXME-template-source{{ /source }}

# Default branch of your lesson
branch: {{ branch }}{{ ^branch }}main{{ /branch }}
Expand Down
8 changes: 4 additions & 4 deletions inst/templates/placeholder-template.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: FIXME
title: {{title}}{{^title}}FIXME{{/title}}
---

{{#title}}
## {{title}}
{{#heading}}
## {{heading}}

{{/title}}
{{/heading}}
This is a placeholder file. Please add content here.
2 changes: 2 additions & 0 deletions tests/testthat/_snaps/build_html.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<li>
<a href="profiles.html">Learner Profiles</a>
</li>
<li><a href="reference.html">Reference</a></li>

# [build_home()] instructor index file is index and schedule

Expand Down Expand Up @@ -54,5 +55,6 @@
<a href="key-points.html">Key Points</a>
<a href="reference.html#glossary">Glossary</a>
<a href="profiles.html">Learner Profiles</a>
<a href="reference.html">Reference</a>
<a href="aio.html">See all in one page</a>

1 change: 1 addition & 0 deletions tests/testthat/_snaps/build_lesson.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<a href="key-points.html">Key Points</a>
<a href="reference.html#glossary">Glossary</a>
<a href="profiles.html">Learner Profiles</a>
<a href="reference.html">Reference</a>
<a href="aio.html">See all in one page</a>

0 comments on commit a1d0ad9

Please sign in to comment.