Skip to content
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

Warning messages: In page_globals$meta : partial match of 'meta' to 'metadata' #525

Closed
Bisaloo opened this issue Sep 25, 2023 · 1 comment · Fixed by #526
Closed

Warning messages: In page_globals$meta : partial match of 'meta' to 'metadata' #525

Bisaloo opened this issue Sep 25, 2023 · 1 comment · Fixed by #526

Comments

@Bisaloo
Copy link
Contributor

Bisaloo commented Sep 25, 2023

I enabled warnings on partial matching by default on my computer and got these while running sandpaper::serve():

Warning messages: In page_globals$meta : partial match of 'meta' to 'metadata'

Looking at the code, it seems indeed that there are a couple of occurrence of this:

https://github.com/search?q=repo%3Acarpentries%2Fsandpaper+%2Fpage_globals%5C%24meta%5Cb%2F&type=code

And a look at setup_page_globals() seems to confirm that the object it creates indeed contains a metadata element but no meta element.

sandpaper/R/utils-varnish.R

Lines 110 to 119 in 043bf7d

setup_page_globals <- function() {
instructor_local <- instructor_globals$copy()
learner_local <- learner_globals$copy()
metadata_local <- this_metadata$copy()
return(list(
instructor = instructor_local,
learner = learner_local,
metadata = metadata_local
))
}

I'm opening this issue first to confirm I understood everything correctly and this is indeed what's happening. If so, I'm happy to submit a PR to not rely on partial matching and avoid potential name collisions.

@zkamvar
Copy link
Contributor

zkamvar commented Sep 25, 2023

This is absolutely correct! The set_page_globals() function will make copies of the global cache so that things like the pre-computed metadata and sidebar can be modified to suit a particular page: https://github.com/search?q=repo%3Acarpentries%2Fsandpaper%20setup_page_globals&type=code

My documentation for the global lesson elements of sandpaper is... not great I admit.

I would be really grateful for a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants