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

[Data Liberation] Refactor Entity Readers class diagram #2096

Open
wants to merge 15 commits into
base: trunk
Choose a base branch
from

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Dec 17, 2024

Sets the stage for the EPub importer. A part of #2080

Refactors and clean up the Data Liberation package. This includes renaming, reorganizing file paths, improving class structure, and removing deprecated/unused code.

Key Changes

Refactor:

Cleanup:

  • Deleted unused and redundant byte reader classes (WP_Byte_Reader, WP_File_Reader, etc.).
  • Removed legacy files such as WXR_Import_Info.

New Additions:

  • Added WP_Directory_Tree_Entity_Reader to improve handling of directory tree imports.
  • Introduced WP_Import_HTML_Processor for better HTML import functionality.

Testing instructions

Confirm the CI tests passed

Adds a basic WP_HTML_To_Blocks class that accepts HTML and outputs block markup.

It only considers the markup and won't consider any visual changes introduced via CSS or JavaScript.

A part of #1894

 ## Example

```html
$html = <<<HTML
<meta name="post_title" content="My first post">
<p>Hello <b>world</b>!</p>
HTML;

$converter = new WP_HTML_To_Blocks( $html );
$converter->convert();

var_dump( $converter->get_all_metadata() );
/*
 * array( 'post_title' => array( 'My first post' ) )
 */

var_dump( $converter->get_block_markup() );
/*
 * <!-- wp:paragraph -->
 * <p>Hello <b>world</b>!</p>
 * <!-- /wp:paragraph -->
 */
```

 ## Testing instructions

This PR mostly adds new code. Just confirm the unit tests pass in CI.
@adamziel adamziel marked this pull request as draft December 17, 2024 13:53
@adamziel adamziel marked this pull request as ready for review December 17, 2024 13:56
Base automatically changed from html-importer to trunk December 19, 2024 13:00
@adamziel adamziel requested a review from a team as a code owner December 19, 2024 13:00
Copy link
Collaborator

@zaerl zaerl left a comment

Choose a reason for hiding this comment

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

This is an excellent refactoring. I like the new consistency in naming classes and interfaces around the "entity" word. Can we resolve the conflicts here? Once solved, I am okay with merging this. 👍

packages/playground/data-liberation/project.json Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Reviewed
Development

Successfully merging this pull request may close these issues.

2 participants