Skip to content

[Data Liberation] Refactor Entity Readers class diagram - #2096

Merged
zaerl merged 17 commits into
trunkfrom
refactor-readers
Jan 8, 2025
Merged

zaerl merged 17 commits into
trunkfrom
refactor-readers

Conversation

@adamziel

@adamziel adamziel commented Dec 17, 2024 •

Copy link
Copy Markdown
Collaborator

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

@zaerl zaerl left a comment

Copy link
Copy Markdown
Contributor

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. 👍

@zaerl zaerl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All good!

@zaerl
zaerl merged commit d400031 into trunk Jan 8, 2025
@zaerl
zaerl deleted the refactor-readers branch January 8, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants