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

redesign to coordinate with other mf2 plugins and themes #85

Open
dshanske opened this issue Dec 11, 2017 · 12 comments
Open

redesign to coordinate with other mf2 plugins and themes #85

dshanske opened this issue Dec 11, 2017 · 12 comments

Comments

@dshanske
Copy link
Member

Right now, rendering is called directly by the creation process. It should be called by filter. This was originally an option, but was removed in a previous commit.

This code should be less tightly intertwined with the Micropub server code.

@snarfed
Copy link
Member

snarfed commented Jan 21, 2018

i'm repurposing this issue for the big new redesign we want to do for coordinating with other plugins and themes that render mf2 data. (@dshanske, please holler if you think i shouldn't!)

we're going to implement @kraftbj's design sketch in indieweb/wordpress-uf2#30 (comment) . here's an initial draft of the requirements for this plugin and a possible design.

  • first, unit tests. look at all of the existing unit tests for creating and updating posts with different mf2 properties. right now, they check post_content. change that to render the post and look for the same content in the rendered HTML.
  • add new post meta properties that indicate a post was created with the micropub plugin, and which version. we'll use this later.
  • generate_post_content, generate_event, and friends currently convert mf2 data to HTML that's stored in post_content. extract out each individual mf2 property or logical group of properties, e.g. the ones inside an h-event, and move them to their own render_XXX method that prints them out.
  • add a new render_mf2 method that takes a property (mf2) string and a content (HTML) string with . attach it to a hook or filter that runs when rendering the post. (probably after the post content.) its code should be something like:
    1. if the post was created by micropub before this, it will have the mf2 already rendered and baked into post_content, so we want to short circuit. determine this by looking up the post meta mf2_type property, and also the new post meta properties mentioned earlier that store whether this plugin created it, and which version. if mf2_type exists but the new ones, don't, return content unchanged.
    2. if content is non-null, another plugin already rendered this mf2 property, so just return it unchanged.
    3. otherwise, call has_mf2_support and pass the mf2 property. if that returns true, return content unchanged.
    4. otherwise, call the appropriate render_XXX method for the mf2 property.

@snarfed snarfed changed the title Rendering as a Separate Function redesign to coordinate with other mf2 plugins and themes Jan 21, 2018
@snarfed
Copy link
Member

snarfed commented Feb 3, 2018

I'm not actively working on this right now, so it's available if anyone else wants to. otherwise I'll get to it eventually!

@snarfed
Copy link
Member

snarfed commented Apr 22, 2018

i still don't use micropub much myself, so I'm gradually realizing that I'm the wrong person to own this plugin or drive its development.

so, i don't expect to work on this change myself, but it's still probably still the single most important thing we need to do right now, for IndieWeb WordPress authoring overall.

just FYI @dshanske @pfefferle @miklb et al!

(I'm also happy to transfer it to the @indieweb org at some point! that won't let us do anything we can't already do now though, with it here, so probably not high priority yet. coordinating people and time is more important.)

@dshanske
Copy link
Member Author

I wonder if there is a solution that doesn't involve duplication of effort. I would gladly take on the plugin but I have a lot I am maintaining

@pfefferle
Copy link
Member

I can review code and help brainstorming, but I am also not really using the plugin (actively)...

@dshanske
Copy link
Member Author

I am only partially using it, but more than either of you. We need more involvement in everything, to be honest. Recruitment time?

@dshanske
Copy link
Member Author

I am still wondering if we can save development resources by spinning out the mf2 rendering in Post Kinds and Micropub into one single rendering project. One less thing to develop in parallel.

@pfefferle
Copy link
Member

There are central rendering projects called themes... I do not see any advantages in adding a third plugin to the stack that does nothing but rendering... It makes the whole plugin stack even more complex...

@dshanske
Copy link
Member Author

Agreed, but we know that the majority of themes don't support the rendering we need. So what I built was a template engine that can be put into a theme, but has defaults in the plugin. With Gutenberg coming, that may have to switch to block based editing, so I would wait till we see how that goes.

@dshanske
Copy link
Member Author

Maybe that should be our decision. Table solving this problem till we have a proposal that factors in Gutenberg.

@dshanske
Copy link
Member Author

It may even help

@snarfed
Copy link
Member

snarfed commented Nov 9, 2023

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

No branches or pull requests

3 participants