-
Notifications
You must be signed in to change notification settings - Fork 5
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
Microformats 2 Rendering #30
Comments
thanks for summing this up! |
hey, great! happy to talk wherever. and expanding to also include wordpress element markup sounds fine too. i do still think we need to support priority, though. the micropub plugin, for example, needs to be able to render all mf2 properties that it handles, but it also should defer to any other feature-specific plugin that handles an individual mf2 property, since those plugins will generally be better. i think we also need this coordination to work regardless of which specific plugins are installed. SemPress users, for example, often won't have this uf2 plugin, but should still be able to use micropub and other feature-specific plugins together happily. given all that, the global variable approach seems to have two flaws:
i'm not excited about the feature approach described in pfefferle/SemPress#51 (comment) either. it requires all plugins that use it to check and use the filter return value correctly. still, it may be the least bad option we have so far...? |
@snarfed That's why I suggested this repo as the 'canonical' place for any microformats2 in wordpress discussion. The lack of single place to discuss things. This is really where plugin dependencies would help a great deal, but saying that doesn't help with this. But why can't SemPress users, Micropub users, and Post Kinds users be encouraged to install this plugin, especially if it doesn't activate the extra features if the theme says it already supports them? I'm worried about not only creating confusion for us, but for new people(who already find it confusing). I don't think there is an easy answer, but what we have now isn't working exactly. |
My idea: I agree with @snarfed, every plugin should handle it's properties, the best it can. The main other authority for the rendering is the theme, so I would start defining the If a plugin like indie-post-kinds want to overwrite micropub functionality, it should be done individually be remove actions or filters or with changes done by filters and actions. |
I might not want to. @snarfed's rendering could be nicer than mine. Why 'mf2_photo' as opposed to 'photo' ? |
If the theme is the only authority it is even better. The syntax of the theme support was only a first shot, I would highly recommend to discuss and change the feature flags! |
The theme being the top authority makes sense...as long as the theme knows how to do something. If it doesn't, it needs to fall back on something. |
sure, and that can be handled with more granular theme support flags. |
So, 'microformats2' as a theme_supports flag will have arguments for WordPress properties..For example, author, content, etc. 'microformats2_rendering' would have arguments for properties that don't directly map to WordPress properties? Or do we want to combine them into one single microformats2 flag with the differences set in properties? We still, either way, end up with collision. |
exactly. i would use |
Then prefixing the mf2 properties with mf2_ makes sense, I suppose. |
ah, now I know why I proposed a new rendering flag... Let me think about that... perhaps we should create a section on the wiki, where we collect the different ideas and where we can define the flags. I hope @snarfed is ok with this too. |
Why not have all possible plugins register support, and have the user specify their priority for applying them if both have support for that property? For example, both Post Kinds and Micropub register they support rendering checkins. The user specifies in configuration that they'd prefer rendering in the event of both? |
-1 to putting the onus on the user to specify priority. They aren't going to want that responsibility, they just want an integrated experience. Just sounds like opening up a bad UX with a ton of options and configurations. |
I'm suggesting 1 option...who has priority. Not on a per property basis. |
We can call it, "Specify Default Rendering Plugin." or such. Rather than saying that each plugin sets a priority on a per property basis. It seems like that is too many low level settings. |
https://indieweb.org/WordPress/Data - Is where we've put this stuff on the wiki before. I'll go garden a bit. |
Playing devil's advocate, a user is going to ask why would I need to specify default rendering? We already hear routinely "why not just one plugin". Requiring a user to specify even once what plugin gets priority is just going to exacerbate that. |
Then we're right back at, why not spin rendering out of all plugins into its own? |
I don't begin to have an answer to the how, and as I stated in chat, it's a hard problem you are trying to solve with multiple plugins. But one worth tackling. I'm just trying to provide some perspective from user stand point based on feed back I've seen and read. |
But that is what I meant... the main renderer is the plugin itself but it can be disabled by the theme... if a second plugin thinks it's a better renderer it should handle it individually using hooks and actions... |
do we have cases where a plugin uses data from an other plugin? |
Yes, Post Kinds uses any data stored in mf2_ whether it stored it or not. Micropub also stores there. But as I documented, there are some issues. |
I mentioned that in a comment above and you corrected me:
Perhaps a misunderstanding...but as I said, this can be done individually, like we do with webmentions and semantic linkbacks https://github.com/pfefferle/wordpress-semantic-linkbacks/blob/master/semantic-linkbacks.php#L52 or am I wrong? |
It can. I just want to brainstorm all options before we adopt. It is harder to change later. |
ok, got you, but we shouldn't over engineer the feature on the other hand! plugins working really good together at the moment and we only have a problem to identify if a theme supports render features or not! |
... and we should fix that in time... at least before we start investing time in new |
hey @kraftbj, you've been interested in indieweb recently, any chance you could give us some expert guidance here? no good deed goes unpunished, and all that. :P we're still discussing the exact goals, but broadly, we're trying to figure out how multiple plugins/themes should coordinate and decide, at post render time, which one renders a specific piece of mf2. here are some constraints:
options we've considered:
i'm sure other people have figured this out before, but i haven't had much luck googling for it (e.g. wordpress multiple plugins coordination :/). any ideas? thanks in advance! |
That's a dilly of a pickle. I would venture that this is something that's ripe for a filter--it already has the built-in priority system. With both issues, it requires buy-in from other plugin/theme authors to use a common format/scheme. I think the filter is more akin to WordPress thinking. Let me read through this issue, the core ticket that was attempted for mf2 support, etc with more thought some. |
another thought: is there any way to get the full list of callbacks registered for a given filter, along with their priority? if so, we could use that and just call the first one. kind of goes against the philosophy, i know, but still. i didn't find anything like that in the docs, so i'm guessing not, but figured it was worth checking. |
My intention was to kill all plugin processing if the theme already supports this type of rendering.
I don't like the What a theme could provide is something like |
I can't speak to how it fits core philosophy, but from someone who would be a consumer of that filter, it makes sense. |
It makes sense for you that a bunch of plugins have to init the exact same filter and one single theme is setting it? I think this might cause some serious race condition problems, because you do not have a priority on the If you switch it around, so that the theme applies the filter, the theme has all the knowledge, that the plugins need. |
Trying to give theme authors a master kill switch. It was an afterthought to avoid a theme author needing to declare everything if they wanted total control...trying to meet you in the middle on our philosophical divide on if the theme should be the end-all of markup :)
Right, but if there's another plugin that extends upon wordpress-uf2, it can't redeclare
I think this is basically my idea, but the plugin would have a helper function to deal with it. For example, a theme author could do the full declarative array (like your example, but would need a callable since the array can't be declared directly there), but could easily just do
It all depends on where it is hooked. All of the |
Well, when you put it that way, no 😄 I'd guess there would be priority on the filter, which would help, I think @snarfed said he'd want micropub to only output if no other plugin was using the data for instance. I was looking as a consumer of the code |
I am not sure we are talking about the same things (sorry I am German) ;) With the add_theme_support I, as a theme developer, want to have a way to disable some renderings of plugins! The add_theme_support should not be extended or changed by any plugin and it should not be a global registry where plugins should hook in, to register themselves for a specific use case. If two or more plugins are fighting for the same output, this should be their way to find a solution (for example with remove filters and/or priorities) and I am not sure if there should/can be a generic way, because the data for these specific renderings might differ so much between the different use cases. |
Ok, perhaps it makes sense to try to have a generic way also for plugins, put I am not sure if we should mix both. |
@kraftbj who should provide the apply_filter wrapper? And don't forget that the content is not the only place where data is changed. |
I apologize for the delay. Headed out of town for a vacation next week so trying to get everything at work packaged up. I meant to draw a diagram of how this all fits together. If I'm not making sense after this comment, I'll do that for when I'm back :) The indieweb/wordpress-uf2 plugin (wherever, the "plugin"):
Any theme that wants to declare support:
As far as loading:
The theme could disable the plugin by passing the features you support. If there is some specific setups where a feature needs to be disabled in specific contexts, a plugin/theme can add a filter later, e.g.
In other words, it can wait until the query is parsed and the conditional functions are available, then declare support if there is only support in certain contexts. Hooking on |
I would prefer a solution that can be implemented without relying on a third party plugin! If someone have not installed the |
As a follow up, per a conversation in #indieweb-wordpress with pfefferle:
I hadn't caught that in the thread, and think it helps clarify the discussion. I thought the idea was to move to the mf2 plugin playing a larger role in the ecosystem, and with the ability to have themes "turn off" certain features, there would be encouragement to run it along side a microformats2 theme. |
I don't understand the comment about the third-party plugin. This solution would mean the theme would 100% work stand alone OR alongside any plugin that uses this framework. I mean, sure, use theme-supports instead. Same idea just most limited with less flexibility. If any plugin wanted to go along with this idea, it can include the same function wrapped in a function_exists call to avoid double-declaration. Another alternative is just straight up say a theme works with a third-party plugin or say it doesn't period. At the end of the day, I don't understand. We want a functionality that works with third-party plugins but using a third-party plugin is a non-starter? |
When I'm back from vacation, I'll put together a basic suite showing the interaction in code. |
thanks so much for talking and working through this, everyone! sounds like you may actually all be agreeing on the same general idea, and disagreeing at most on terminology and semantics. good sign! you're all closer to wordpress than i am, so i trust you and i'll happily follow (in the micropub plugin) whatever you all settle on. especially hoping it satisfies these three goals of mine, but even if not, i'm flexible.
thanks again all! |
checking back in here. is there a conclusion on the common design we all want to implement in our plugins and themes? i'm ready to implement it in the micropub plugin! |
friendly ping! |
Sorry, but I off for vacation for the next two weeks... |
no worries at all. enjoy! |
friendly nudge! @dshanske @kraftbj @miklb @pfefferle do we have a conclusion here on a design we all agree on yet? |
not that I know... |
It just occurred to me. If we want to surface this to a user, that means shouldn't we be using the options table? It is a user option. So, in the event an option isn't set, there are now 2 ways to set the default.
What about:
No matter what, every plugin and theme would have to implement code the logic regarding it, although we could have a repo with the code in question and include it as a dependency. If we write it correctly, then it shouldn't need to be changed. |
Just so I understand: I write a theme and I set an option saying "This theme handles all mf2 output." Someone installs and activates this plugin (wordpress uf2). They get an admin notice telling theme "hey your theme is already configured to output mf2 data, you do not need to activate this plugin." User then activates hot new IndieWeb plugin. Hot new plugin sees that the theme is handling output and doesn't display anything on the front end? That's then assuming the theme author is familiar with hot new plugin and the user will still get the desired result? Or does that just signal to the plugin, "hey this theme is mf2 ready, fire output at will." Or something entirely different? |
All really good points. So...
No matter what, new things will break old things. This has to be a change we'll all support some form of as soon as possible, no matter which one we go with. So, with that in mind, anyone who doesn't support this new option, however we implement it, what should we do? The safest thing is to back off if they didn't declare more. |
I guess from a theme maker standpoint, as long the plugins have a way for the theme to override a plugin output, default to outputting by the plugin would make sense. So if Hot New plugin displays something my theme doesn't, in a future theme update I could override the plugin and display it differently if necessary. |
woo! we all met today and agreed to try out this proposal: #30 (comment) . we also discussed the broader plan for indieweb wordpress plugins and themes in general. we settled on doing more in the official indieweb plugin, ideally focusing on a wizard style UX. @dshanske and @miklb let me twist their arms into eventually drafting a design doc for how that should look. thanks everyone! |
so that the plugin can handle the theme-support. see #30
@snarfed, @pfefferle and I were discussing the problem of various plugin interoperability in pfefferle/SemPress#51
It occurred to me, if we are going to set this up, this repo is probably the better place to keep the discussion and possibly any functionality or such we want to support it.
Right now, Micropub takes over rendering if add_theme_support( 'microformats2' ) is not set. This plugin loads microformats2 compatibility functions(add h-entry, etc) if the same flag is set.
So, the add theme support flag should, in future, be used solely to discuss a theme's support for marking up standard WordPress elements, as opposed to properties stored solely in meta. We can be more granular in future if needed.
Rendering microformats2 properties from Post Meta probably requires a global variable(the same way that add_theme_support, register_post_type, etc are in reality global variables).
The issue that was being discussed was priority on any given feature. WordPress registration does this with the last one to register, as registration is done by hook. Same can apply here.
While I still think we can combine our rendering efforts, for now, I want to try to build this as a class here in Microformats 2, which could then be included in the other plugins. Thoughts?
The text was updated successfully, but these errors were encountered: