-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect and Load child documents to include in validation #137
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This pre-processes the build parents argument so that we don't have to constantly check for the parents of a child when it appears.
This is a bit more clever about detecting files in sub sub folders by splitting the path and searching for the presence of the known subfolders
I really really really like how simple this part is. I add the collection and the machinery just works ^_^
we actually need to handle this a bit better in sandpaper as well.
zkamvar
added a commit
to carpentries-incubator/managing-computational-projects
that referenced
this pull request
Sep 15, 2023
I am testing out carpentries/sandpaper#513 and carpentries/pegboard#137 to help with validation and building, which will fix carpentries/workbench#68 There was an error because the div fences were too close to the text, so I added spaces.
I get a feeling that this really needs to be an option instead, but because this is a Lesson-specific thing, I'm going to leave it as is.
These links should act as if they come from the parent files
I plan to release this on Wednesday, so I will merge now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will detect and load child files declared in R Markdown files. This is important because with overview lessons, and the HPC carpentry transition plan, and other community lessons, child files are heavily relied on for content, but they are not currently validated. This PR will fix #135
This is paired with carpentries/sandpaper#513
Testing
You can test this by checking out the branch and running the tests inside your local clone of {pegboard} using The usethis pull request helpers:
Background
Child documents are defined in R Markdown documents like so:
where
files/the-child.md
would be relative to the parent markdown file. It is possible for a child document to haveWe implemented detecting first-order children for build purposes in carpentries/sandpaper#499, but they are not loaded for validation, which leads to issues like carpentries/workbench#68.
Implementation
This implements the strategy to detect direct children by searching the code blocks for the
@child
attribute and extracting the file names from there when loading the Episodes.Then, in the Lesson object, for all the episodes, each of the child files are passed through a recursive function that will load the file, gather the children (if any) and then load and append the children to the child list, recording the parents and the build parents (the source Episodes that will run the child file). With the build parents, we can query a child file and know exactly what source files it builds.
There is a method in the Lesson object that will get the entire child lineage by recursively searching the
$children
element until it is empty. The purpose of this is to gather the files necessary to generate the hash for the file.