Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use WordPress\Filesystem\WP_Filesystem;
use WordPress\Filesystem\WP_Local_Filesystem;

class WP_Markdown_Importer extends WP_Stream_Importer {

Expand All @@ -9,13 +9,13 @@ public static function create_for_markdown_directory( $markdown_directory, $opti
function ( $cursor = null ) use ( $markdown_directory ) {
// @TODO: Handle $cursor
return new WP_Directory_Tree_Entity_Reader(
new WP_Filesystem(),
new WP_Local_Filesystem(),
array(
'root_dir' => $markdown_directory,
'first_post_id' => 1,
'allowed_extensions' => array( 'md' ),
'index_file_patterns' => array( '#^index\.md$#' ),
'markup_converter_factory' => function ( $content ) {
'data_consumer_factory' => function ( $content ) {
return new WP_Markdown_Consumer( $content );
},
)
Expand Down
7 changes: 5 additions & 2 deletions packages/playground/data-liberation/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
require_once __DIR__ . '/blueprints-library/src/WordPress/AsyncHttp/Client.php';

require_once __DIR__ . '/blueprints-library/src/WordPress/Filesystem/WP_Abstract_Filesystem.php';
require_once __DIR__ . '/blueprints-library/src/WordPress/Filesystem/WP_Filesystem.php';
require_once __DIR__ . '/blueprints-library/src/WordPress/Filesystem/WP_Local_Filesystem.php';
require_once __DIR__ . '/blueprints-library/src/WordPress/Filesystem/WP_File_Visitor_Event.php';
require_once __DIR__ . '/blueprints-library/src/WordPress/Filesystem/WP_Filesystem_Visitor.php';
require_once __DIR__ . '/blueprints-library/src/WordPress/Filesystem/functions.php';

require_once __DIR__ . '/blueprints-library/src/WordPress/ByteReader/WP_Byte_Reader.php';
require_once __DIR__ . '/blueprints-library/src/WordPress/ByteReader/WP_File_Reader.php';
Expand Down Expand Up @@ -71,7 +72,6 @@
require_once __DIR__ . '/src/entity-readers/WP_HTML_Entity_Reader.php';
require_once __DIR__ . '/src/entity-readers/WP_EPub_Entity_Reader.php';
require_once __DIR__ . '/src/entity-readers/WP_WXR_Entity_Reader.php';
require_once __DIR__ . '/src/entity-readers/WP_Directory_Tree_Entity_Reader.php';

require_once __DIR__ . '/src/xml-api/WP_XML_Decoder.php';
require_once __DIR__ . '/src/xml-api/WP_XML_Processor.php';
Expand All @@ -87,6 +87,9 @@
require_once __DIR__ . '/src/import/WP_Retry_Frontloading_Iterator.php';
require_once __DIR__ . '/src/entity-readers/WP_Entity_Reader.php';
require_once __DIR__ . '/src/entity-readers/WP_HTML_Entity_Reader.php';
require_once __DIR__ . '/src/entity-readers/WP_Filesystem_Entity_Reader.php';

require_once __DIR__ . '/src/WP_Data_Liberation_HTML_Processor.php';

require_once __DIR__ . '/src/utf8_decoder.php';

Expand Down
1 change: 1 addition & 0 deletions packages/playground/data-liberation/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<file>tests/WPMarkupProcessorConsumerTests.php</file>
<file>tests/WPHTMLEntityReaderTests.php</file>
<file>tests/WPURLInTextProcessorTests.php</file>
<file>tests/WPFilesystemEntityReaderTests.php</file>
<file>tests/WPBlockMarkupProcessorTests.php</file>
<file>tests/WPBlockMarkupUrlProcessorTests.php</file>
<file>tests/URLParserWHATWGComplianceTests.php</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ public function skip_to_closer() {

return false;
}

public function get_string_index_after_current_token() {
$name = 'current_token';
$this->set_bookmark( $name );
$bookmark = $this->bookmarks[ '_' . $name ];
$this->release_bookmark( $name );
return $bookmark->start + $bookmark->length;
}
}
Loading
Loading