Conversation
|
Seems fine to me. |
|
pinging you, @poire-z: your comment in #7279 (comment) mentions "translator" as a potential usage. How do you envision "extensible" interfaces that are part of core?. I mean the exporter plugin use their "extensions" as targets, the cloud storage/sync could use them as account types. Does make sense to have generic settings as part of this Provider interface? For instance: somebody uses google translate, installs The UI seems generic because it's always "select one among providers of this feature" so it could be something like Anyhow this is all in theory. "translator" isn't a feature this PR is aware yet :) |
Sorry, I don't have the brain bandwidth at the moment to envision anything :) For Translator, I think anybody could just plug their preferred service with just dropping a user-patch that would override some functions in translator.lua. I understand this is quite a bit more needed for exporter plugins, as everybody has its own favorite service - and it's a bit more interacting with everything, so the need for some well thought core infrastructure. |
My bad. I've shall call it "think", which everybody can do even on dial-up brain bandwidth :)
My little better world is almost built :) I just want a to do a little effort that would allow us to remove unsupported/unneeded/unwanted features. Patches are great for features that users want but we don't want to support.
Exporters already inherit a callback for common exporter settings. Those exporters that have no specific settings use the callback directly. Exporters with more configuration override the method and implement their own thing. But you're totally correct. Maybe I'm overthinking and none of the "core" things need to be done now :/ |
75460df to
24556fa
Compare
|
Moved exporter koplugin to providers. |
| local WidgetContainer = require("ui/widget/container/widgetcontainer") | ||
|
|
||
| -- this is a hack, remove me | ||
| package.path = "plugins/exporter.koplugin/?.lua;" .. package.path |
There was a problem hiding this comment.
Not sure how to tackle this.
Is it too bad to include it on our own package.path?
The other way is to move exporter.koplugin/base.lua to frontend/export.lua or something similar.
There was a problem hiding this comment.
Shouldn't it go at the end if done this way?
There was a problem hiding this comment.
Shouldn't it go at the end if done this way?
😄 No idea.
There was a problem hiding this comment.
I mainly mean in the sense that with a path override you want to put things in front, but we're just adding here rather than overriding.
There was a problem hiding this comment.
Yay!
I ended up adding it in setupkoenv.lua.
Moving the base exporter itself to frontend isn't enough, as exporters might also use one of the templates (markdown, html). Moving everything to base sounds a bit crazy.
Conditionally add the path when the exporter plugin is enabled isn't as option. Providers are independent plugins that can be enabled on their own.
|
Issues so far:
It 's workarounded in the exporter plugin by replacing I'm wondering if it makes sense to load |
Probably easier than coming up with a proper dependency resolver ;o). |
0dd2697 to
6ae781d
Compare
It turns it isn't as easier as I thought. The loader iterates lookup paths, fetching each koplugin dir inside and trying to loading it. For providers to take precedence over the rest of plugins we would need to split "plugin discovery" from "plugin load", generate a table of candidates to load, sort providers first, and finally load plugins. TBH too much work for what we get :(. I think current behaviour isn't too bad (at least for exporter and cloud/sync). |
It turns out I was wrong :p |
5761b5c to
e883e98
Compare
f304768 to
3dd5c27
Compare
|
Ready for review, updated OP |
964af99 to
cea7762
Compare
|
@pazos It looks tidy to me. The CI still has some minor whitespace complaints. Btw, did you see my message on Gitter? |
Sorry. I replied now. |
|
koreader/plugins/exporter.koplugin/main.lua Lines 122 to 127 in 09f3041 This chunk is expected to be duplicated in all generic plugins. Can be moved to Provider, receiving name and t as args.
|
|
Waiting a bit for potential reviewers. I'll plan to merge the friday unless somebody says something ;) |
|
It looks sane to me like before. Not much else to add. ^_^ |
* flomo, memos Requires koreader/koreader#12641
Some background in #7279
Providersingleton that plugins can use to extend supported featuresThirdparty plugin developers can use:
where
my-implementationis a table that implements the interface for an exporter target.Makes the exporter plugin compatible with thirdparty providers
Splits plugin loading into two steps: discovery and load. That way we get a list of all candidate plugins to load for the different paths and we sort those starting with "provider" to be load before the rest of them.
This change is