1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-29 23:22:34 +01:00

ZIP Exports: Reorganised files, added page md parsing

This commit is contained in:
Dan Brown 2024-10-23 10:48:26 +01:00
parent 4fb4fe0931
commit f732ef05d5
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
10 changed files with 26 additions and 23 deletions

View File

@ -6,7 +6,7 @@ use BookStack\Entities\Queries\PageQueries;
use BookStack\Entities\Tools\PageContent;
use BookStack\Exceptions\NotFoundException;
use BookStack\Exports\ExportFormatter;
use BookStack\Exports\ZipExportBuilder;
use BookStack\Exports\ZipExports\ZipExportBuilder;
use BookStack\Http\Controller;
use Throwable;

View File

@ -1,8 +1,8 @@
<?php
namespace BookStack\Exports\ZipExportModels;
namespace BookStack\Exports\ZipExports\Models;
use BookStack\Exports\ZipExportFiles;
use BookStack\Exports\ZipExports\ZipExportFiles;
use BookStack\Uploads\Attachment;
class ZipExportAttachment extends ZipExportModel

View File

@ -1,8 +1,8 @@
<?php
namespace BookStack\Exports\ZipExportModels;
namespace BookStack\Exports\ZipExports\Models;
use BookStack\Exports\ZipExportFiles;
use BookStack\Exports\ZipExports\ZipExportFiles;
use BookStack\Uploads\Image;
class ZipExportImage extends ZipExportModel

View File

@ -1,6 +1,6 @@
<?php
namespace BookStack\Exports\ZipExportModels;
namespace BookStack\Exports\ZipExports\Models;
use JsonSerializable;

View File

@ -1,10 +1,10 @@
<?php
namespace BookStack\Exports\ZipExportModels;
namespace BookStack\Exports\ZipExports\Models;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Tools\PageContent;
use BookStack\Exports\ZipExportFiles;
use BookStack\Exports\ZipExports\ZipExportFiles;
class ZipExportPage extends ZipExportModel
{

View File

@ -1,6 +1,6 @@
<?php
namespace BookStack\Exports\ZipExportModels;
namespace BookStack\Exports\ZipExports\Models;
use BookStack\Activity\Models\Tag;

View File

@ -1,10 +1,10 @@
<?php
namespace BookStack\Exports;
namespace BookStack\Exports\ZipExports;
use BookStack\Entities\Models\Page;
use BookStack\Exceptions\ZipExportException;
use BookStack\Exports\ZipExportModels\ZipExportPage;
use BookStack\Exports\ZipExports\Models\ZipExportPage;
use ZipArchive;
class ZipExportBuilder

View File

@ -1,6 +1,6 @@
<?php
namespace BookStack\Exports;
namespace BookStack\Exports\ZipExports;
use BookStack\Uploads\Attachment;
use BookStack\Uploads\AttachmentService;

View File

@ -1,13 +1,12 @@
<?php
namespace BookStack\Exports;
namespace BookStack\Exports\ZipExports;
use BookStack\App\Model;
use BookStack\Entities\Models\Page;
use BookStack\Exports\ZipExportModels\ZipExportAttachment;
use BookStack\Exports\ZipExportModels\ZipExportImage;
use BookStack\Exports\ZipExportModels\ZipExportModel;
use BookStack\Exports\ZipExportModels\ZipExportPage;
use BookStack\Exports\ZipExports\Models\ZipExportAttachment;
use BookStack\Exports\ZipExports\Models\ZipExportImage;
use BookStack\Exports\ZipExports\Models\ZipExportModel;
use BookStack\Exports\ZipExports\Models\ZipExportPage;
use BookStack\Uploads\Attachment;
use BookStack\Uploads\Image;
@ -44,12 +43,16 @@ class ZipExportReferences
public function buildReferences(ZipExportFiles $files): void
{
// TODO - Parse page MD & HTML
// Parse page content first
foreach ($this->pages as $page) {
$page->html = $this->parser->parse($page->html ?? '', function (Model $model) use ($files, $page) {
$handler = function (Model $model) use ($files, $page) {
return $this->handleModelReference($model, $page, $files);
});
// TODO - markdown
};
$page->html = $this->parser->parse($page->html ?? '', $handler);
if ($page->markdown) {
$page->markdown = $this->parser->parse($page->markdown, $handler);
}
}
// dd('end');

View File

@ -1,6 +1,6 @@
<?php
namespace BookStack\Exports;
namespace BookStack\Exports\ZipExports;
use BookStack\App\Model;
use BookStack\Entities\Queries\EntityQueries;