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

Unifying compiler extensions #1864

Closed
wants to merge 7 commits into from
Closed

Conversation

felixfontein
Copy link
Contributor

In c65be6e Kwpolska added a new plugin class, CompilerExtension, and made MarkdownExtension and RestExtension subclasses of this new plugin class. This PR moves the plugin loading code from the Rest and Markdown plugins into a common place in PageCompiler, which can be used by all page compiler plugins.

Review on Reviewable

…iding simple accessing functions for compiler extensions for a given page compiler.
@felixfontein felixfontein added this to the v7.6.1 milestone Jul 5, 2015
@Kwpolska
Copy link
Member

Kwpolska commented Jul 5, 2015

Broken: https://ci.appveyor.com/project/Kwpolska/nikola/build/1.0.1865#L1681
Yapsy probably does not think of them as CompilerExtensions, it looks like we have to activate all three names in nikola/nikola.py.

@felixfontein
Copy link
Contributor Author

Yapsy does find them. There's another problem, and I'm currently working on it.

…ion and MarkdownExtension class definitions as plugins and ignore the real plugin defined in the same file.
@felixfontein
Copy link
Contributor Author

We have to activate all three names, but not because yapsy won't identify derived classes of RestExtension and MarkdownExtension as CompilerExtension plugins, but because yapsy would identify the imported RestExtension or MarkdownExtension class definition as a plugin and would often ignore the real plugin defined in the file.

@felixfontein
Copy link
Contributor Author

Part of the problem is I think that many plugins in Nikola ignore the advice here: http://yapsy.sourceforge.net/Advices.html#plugin-class-detection-caveat

@Kwpolska
Copy link
Member

Kwpolska commented Jul 5, 2015

We can’t fix it now, there would be so many things to change.

@felixfontein
Copy link
Contributor Author

I assume that the failed invariance test is part of another PR. The rest seems to work fine now.

@@ -239,5 +242,17 @@ def __init__(self):
self.template_system = self
self.name = 'mako'

def _activate_plugins_of_category(self, category):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is code duplication, is it possible to import nikola.nikola and do FakeSite._activate_plugins_of_category = nikola.nikola.Nikola._activate_plugins_of_category instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work locally for me, now let's see what Travis and AppVeyor say :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to work. What about moving the method to nikola.utils and calling it explicitly with a site instance?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, let’s just keep it duplicated. Reverting and merging.

(Invariance failures are caused by this being branched out before rst.css and aria fixes.)

@Kwpolska Kwpolska self-assigned this Jul 5, 2015
@Kwpolska Kwpolska closed this Jul 5, 2015
@felixfontein
Copy link
Contributor Author

Thanks!

@Kwpolska Kwpolska deleted the unifying-compiler-extensions branch July 6, 2015 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants