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
Add ALL_PAGE_DEPENDENCIES feature to clean up global context #3043
Conversation
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
nikola/nikola.py
Outdated
@@ -2134,6 +2147,7 @@ def generic_renderer(self, lang, output_name, template_name, filters, file_deps= | |||
deps_dict['OUTPUT_FOLDER'] = self.config['OUTPUT_FOLDER'] | |||
deps_dict['TRANSLATIONS'] = self.config['TRANSLATIONS'] | |||
deps_dict['global'] = self.GLOBAL_CONTEXT | |||
deps_dict["all_page_dependencies"] = self.ALL_PAGE_DEPENDENCIES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use single quotes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I copy-pasted from the Atom renderer and didn’t notice the different quotes. Will fix.
@@ -678,8 +681,10 @@ def __init__(self, **config): | |||
'posts_section_name', | |||
'posts_section_title', | |||
'front_index_header', | |||
'rss_path', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you just moving rss_path
? There should be several more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn’t yet bother to look at the list, any specific suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really (didn't bother either). Except that with updated master, there will be rss_extension
, atom_extension
and rss_filename_base
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too late, you already did that ;)
nikola/nikola.py
Outdated
|
||
for k in self._GLOBAL_CONTEXT_TRANSLATABLE: | ||
deps_context[k] = deps_context['global'][k](lang) | ||
for k in self._ALL_PAGE_DEPENDENCIES_TRANSLATABLE: | ||
deps_dict[k] = deps_dict['all_page_dependencies'][k](lang) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
deps_dict['all_page_dependencies'][k] = deps_dict['all_page_dependencies'][k](lang)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what globals do, so I just copied it. (There are mixed up variable names, I’ll fix that in a while)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For globals, that made sense because you wanted to have the "real" (i.e. for current language) value. Here, I'm not sure whether we want only the current value, or the whole dict. Having both doesn't make sense, though, I think.
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
The following variables from global context are not used by any theme bundled with Nikola or inside the https://github.com/getnikola/nikola-themes repository:
I guess |
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
The section things could stay, some may be useful in themes. (And sections are going the way of the dodo anyway.) I think i_d_p_c isn’t that bad, and template logic using it is a possibility. The slug things are gone now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming it doesn't break a build, it's good to go from my point of view.
Thanks for reviewing! |
Add
ALL_PAGE_DEPENDENCIES
feature to clean up global context. As mentioned in #3042 discussion. (The new settings would go in this dict instead of global.)Or perhaps this should be ALL_TASK_DEPENDENCIES?