Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Conversation

@ockham
Copy link
Collaborator

@ockham ockham commented Mar 6, 2023

WIP. This is basically a copy of @dmsnell's #158 for now, which I've forked per this comment.

I've removed @adamziel's get_outer_html and set_outer_html commit for now since we might not actually need it 😊

@ockham ockham force-pushed the add/directive-processor-and-unit-tests branch from 9f0c237 to bbc790f Compare March 7, 2023 08:28
dmsnell and others added 10 commits March 9, 2023 13:35
The directive processor builds on the HTML Tag Processor to provide additional functionality, assuming
normative markup generated from React, assuming that all tag directives contain a balanced closer.

This will break in practice, and is probably entirely wrong as-is. The purpose of this commit is to
introduce the idea and explore using the code to get a feel for whether it will work.
@ockham ockham force-pushed the add/directive-processor-and-unit-tests branch from 5457d8b to 054c579 Compare March 9, 2023 12:36
@@ -0,0 +1,155 @@
<?php

class WP_Directive_Processor extends WP_HTML_Tag_Processor {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#156 also had some more directive-specific logic (such as a next_directive method) that I removed. The reason is that it’ll need some more work where we’d need to move some of the logic that’s currently in wp_process_directives into this class. This isn’t currently a priority, so I’ve opted to defer it.

As a consequence however, WP_Directive_Processor doesn’t have any directive-specific code at all — it’s really more of a WP_HTML_Tag_Processor-derived class that allows finding a balanced closing tag, and getting/setting inner HTML. It might thus be worth considering renaming that class.

@ockham ockham requested a review from a team March 14, 2023 14:04
@ockham
Copy link
Collaborator Author

ockham commented Mar 14, 2023

Opening this for review. This is a blocker for a number of directives (#141, #166, #170), so it's about time to get the ball rolling 😊

@ockham ockham marked this pull request as ready for review March 14, 2023 14:05
Copy link
Member

@luisherranz luisherranz left a comment

Choose a reason for hiding this comment

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

This looks great to me, Bernie! 🎉

@ockham
Copy link
Collaborator Author

ockham commented Mar 15, 2023

Thanks you very much, Luis! 🎉

@ockham ockham merged commit b08c19e into main-wp-directives-plugin Mar 15, 2023
@ockham ockham deleted the add/directive-processor-and-unit-tests branch March 15, 2023 14:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants