From 3317851a813e30dfd9b569bc8288edecd8ec553d Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 22 Sep 2022 09:24:45 +0100 Subject: [PATCH 1/6] Added Makefile target to output built test assets to build --- Dockerfile | 10 ++++++++++ Makefile | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/Dockerfile b/Dockerfile index 795f36f8..56b7cb01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -123,6 +123,16 @@ RUN \ --mount=type=cache,target=/root/.composer,id=composer \ composer install +FROM development AS test-output-builder + +COPY --link ./test/fixture/templates /docs-src/templates +COPY --link ./test/fixture/docbook /docs-src/book +COPY --link ./test/fixture/feature /docs-src/features +RUN bin/docbook-tool --html --pdf + +FROM scratch AS test-output + +COPY --from=test-output-builder /docs-package / FROM development AS tested diff --git a/Makefile b/Makefile index 6f96a068..434e4c47 100644 --- a/Makefile +++ b/Makefile @@ -21,5 +21,10 @@ cs: build ## Run coding standards checks static-analysis: build ## Run the static analysis checks docker run --rm --entrypoint=php ghcr.io/roave/docbooktool:test-image vendor/bin/psalm +test-output: ## Write the test fixture outputs to build/ directory - useful for manual visual inspection + rm -Rf build + mkdir -p build + docker buildx build --output=build --target=test-output --tag=ghcr.io/roave/docbooktool:test-image . + production: ## Build and tag a production image docker buildx build --load --target=production --tag=ghcr.io/roave/docbooktool:latest . From 48a3d35b40af1e9a0e46812c9171dcdbac220550 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 22 Sep 2022 09:54:43 +0100 Subject: [PATCH 2/6] Added failing test to set expectations for inline rendering of external images --- test/fixture/docbook/smile.png | Bin 0 -> 2698 bytes test/fixture/docbook/test.md | 8 ++++++++ test/fixture/expectations/out.html | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 test/fixture/docbook/smile.png diff --git a/test/fixture/docbook/smile.png b/test/fixture/docbook/smile.png new file mode 100644 index 0000000000000000000000000000000000000000..01063d4324c214c57895ee0b80111b47ab7bde14 GIT binary patch literal 2698 zcmV;53U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TL_&0nq1T z_0QYl5`^^%a%yTyT9hKrVH=;p!UBwhgfWqWjhgad8WH-(xVSe3WA(U1yTL46Y~W2? z$2PoWs3wmbZsQha@Po+9>V<23koQ{$zco(^g#vFj!dT=!$&(4e^-+3P6?&Ce>= zjwkj?y$_)&8>Sn4)M0rKYDY+AfI5y##qz*fD3gZtUbueUV43Bcjxr*Xt)*Y#HX04+ zx;J^J(+Ty!c$9ej_%U)h`a>^s(nAr8`TI}1zhQ-U_o2vsn}m*5MXULo6Tkey@m3941=~X z?TXWA$gd=wMuIjz=3O5@lC4*>*=(RFnx>JtxjC}8w--efVufelU)}|kBN4=PT`o%* zba%$P8@9;q5s_}+ZCMsqg$GfXN~J>G6@k|M7g=sRmJRMjh3Ovod_ENd1;q!y`irjp z9*ZDd_V)J3+}s@3ot32J$O_Q4h%n=Mu?o_q(P&6nOq9Y{mL)AhZ~ek0y~w&V z+L6oU$n5Ma+1lDV$UAH!^BksWremj1mBiI}Dvu~EHZ_9uqtbFz9Wp^$l++5+B}rl8 z5TKvb3(_SHmzIWZ_P_`d#MagpnVp>_xm+%FjV!|d0WW~7RXe|ZzW@LL07*qoM6N<$ Eg3aX=s{jB1 literal 0 HcmV?d00001 diff --git a/test/fixture/docbook/test.md b/test/fixture/docbook/test.md index 5b4586bd..7378c9d1 100644 --- a/test/fixture/docbook/test.md +++ b/test/fixture/docbook/test.md @@ -36,3 +36,11 @@ Bob->Alice : hello hexagon TestingHexagon @enduml ``` + +## An image + +Here is an image: + +![A smiley face](./smile.png) + +It was hand drawn, that's why it looks rubbish. diff --git a/test/fixture/expectations/out.html b/test/fixture/expectations/out.html index d5dbbf47..e6ac993e 100644 --- a/test/fixture/expectations/out.html +++ b/test/fixture/expectations/out.html @@ -51,6 +51,14 @@

A diagram

Diagram

+

An image

+ +

Here is an image:

+ +

A smiley face

+ +

It was hand drawn, that's why it looks rubbish.

+
From c1e3796a79d631c62a870890e413a0d1af5571d2 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 22 Sep 2022 10:08:24 +0100 Subject: [PATCH 3/6] Added formatter to inline external images --- bin/docbook-tool.php | 2 + src/Formatter/InlineExternalImages.php | 44 +++++++++++++++ test/integration/DocbookToolGeneratorTest.php | 2 + .../Formatter/InlineExternalImagesTest.php | 55 +++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 src/Formatter/InlineExternalImages.php create mode 100644 test/unit/Formatter/InlineExternalImagesTest.php diff --git a/bin/docbook-tool.php b/bin/docbook-tool.php index 493020e4..e942d085 100644 --- a/bin/docbook-tool.php +++ b/bin/docbook-tool.php @@ -11,6 +11,7 @@ use Monolog\Logger; use Roave\DocbookTool\Formatter\AggregatePageFormatter; use Roave\DocbookTool\Formatter\ExtractFrontMatter; +use Roave\DocbookTool\Formatter\InlineExternalImages; use Roave\DocbookTool\Formatter\InlineFeatureFile; use Roave\DocbookTool\Formatter\MarkdownToHtml; use Roave\DocbookTool\Formatter\RenderPlantUmlDiagramInline; @@ -40,6 +41,7 @@ $pageFormatters = [ new ExtractFrontMatter(), + new InlineExternalImages($contentPath), new RenderPlantUmlDiagramInline(), new MarkdownToHtml(), ]; diff --git a/src/Formatter/InlineExternalImages.php b/src/Formatter/InlineExternalImages.php new file mode 100644 index 00000000..140daf1a --- /dev/null +++ b/src/Formatter/InlineExternalImages.php @@ -0,0 +1,44 @@ +withReplacedContent( + preg_replace_callback( + '/!\[([\w\W]+)]\(([\w\W]*?)\)/', + function (array $m) { + /** @var array{1: string, 2: string} $m */ + $altText = $m[1]; + $imagePath = $m[2]; + + $imageContent = file_get_contents($this->docbookPath . '/' . $imagePath); + + return sprintf( + '![%s](data:image/png;base64,%s)', + $altText, + base64_encode($imageContent), + ); + }, + $page->content(), + ), + ); + } +} diff --git a/test/integration/DocbookToolGeneratorTest.php b/test/integration/DocbookToolGeneratorTest.php index 2e81269b..82b45f4d 100644 --- a/test/integration/DocbookToolGeneratorTest.php +++ b/test/integration/DocbookToolGeneratorTest.php @@ -8,6 +8,7 @@ use Psr\Log\NullLogger; use Roave\DocbookTool\Formatter\AggregatePageFormatter; use Roave\DocbookTool\Formatter\ExtractFrontMatter; +use Roave\DocbookTool\Formatter\InlineExternalImages; use Roave\DocbookTool\Formatter\InlineFeatureFile; use Roave\DocbookTool\Formatter\MarkdownToHtml; use Roave\DocbookTool\Formatter\RenderPlantUmlDiagramInline; @@ -47,6 +48,7 @@ public function testGeneration(): void [ new AggregatePageFormatter([ new ExtractFrontMatter(), + new InlineExternalImages(self::CONTENT_PATH), new RenderPlantUmlDiagramInline(), new MarkdownToHtml(), new InlineFeatureFile(self::FEATURES_PATH), diff --git a/test/unit/Formatter/InlineExternalImagesTest.php b/test/unit/Formatter/InlineExternalImagesTest.php new file mode 100644 index 00000000..c570e3c4 --- /dev/null +++ b/test/unit/Formatter/InlineExternalImagesTest.php @@ -0,0 +1,55 @@ + */ + public function contentAndImagePathProvider(): array + { + return [ + [__DIR__ . '/../../fixture/docbook', 'smile.png'], + [__DIR__ . '/../../fixture/docbook', './smile.png'], + [__DIR__ . '/../../fixture/docbook/', 'smile.png'], + [__DIR__ . '/../../fixture/docbook/', './smile.png'], + [__DIR__ . '/../../fixture', './docbook/smile.png'], + [__DIR__ . '/../../fixture', 'docbook/smile.png'], + [__DIR__ . '/../../fixture/', './docbook/smile.png'], + [__DIR__ . '/../../fixture/', 'docbook/smile.png'], + ]; + } + + /** + * @param non-empty-string $contentPath + * @param non-empty-string $imagePath + * + * @dataProvider contentAndImagePathProvider + */ + public function testExternalImagesAreInlined(string $contentPath, string $imagePath): void + { + $markdown = <<content()); + } +} From 4c2ab7ff3e92b43db73980bb9ead90820bae4465 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 22 Sep 2022 10:08:44 +0100 Subject: [PATCH 4/6] Enusre test/unit is included in CS/static analysis checks --- phpcs.xml.dist | 1 + psalm.xml.dist | 1 + test/unit/Formatter/ExtractFrontMatterTest.php | 12 +++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 510ddb1d..76c63bee 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -6,6 +6,7 @@ bin src + test/unit test/integration diff --git a/psalm.xml.dist b/psalm.xml.dist index 45260c76..96ed3470 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -8,6 +8,7 @@ + diff --git a/test/unit/Formatter/ExtractFrontMatterTest.php b/test/unit/Formatter/ExtractFrontMatterTest.php index 0fcef26c..d455ae8f 100644 --- a/test/unit/Formatter/ExtractFrontMatterTest.php +++ b/test/unit/Formatter/ExtractFrontMatterTest.php @@ -4,15 +4,16 @@ namespace Roave\DocbookToolUnitTest\Formatter; +use PHPUnit\Framework\TestCase; use Roave\DocbookTool\DocbookPage; use Roave\DocbookTool\Formatter\AggregatePageFormatter; use Roave\DocbookTool\Formatter\ExtractFrontMatter; -use PHPUnit\Framework\TestCase; use Roave\DocbookTool\Formatter\MarkdownToHtml; /** @covers \Roave\DocbookTool\Formatter\ExtractFrontMatter */ final class ExtractFrontMatterTest extends TestCase { + /** @return array */ public function titleProvider(): array { return [ @@ -70,7 +71,12 @@ public function titleProvider(): array ]; } - /** @dataProvider titleProvider */ + /** + * @param non-empty-string $content + * @param non-empty-string $expectedTitle + * + * @dataProvider titleProvider + */ public function testTitleCanBeSetInFrontMatter(string $content, string $expectedTitle): void { self::assertSame( @@ -78,7 +84,7 @@ public function testTitleCanBeSetInFrontMatter(string $content, string $expected (new AggregatePageFormatter([ new ExtractFrontMatter(), new MarkdownToHtml(), - ]))(DocbookPage::fromSlugAndContent('slug', $content))->title() + ]))(DocbookPage::fromSlugAndContent('slug', $content))->title(), ); } } From ff6a16677dc98f108eeefccd6248731f57fe28d7 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 22 Sep 2022 11:25:33 +0100 Subject: [PATCH 5/6] Add detection of mime type to image inlining --- Dockerfile | 1 + composer.json | 1 + composer.lock | 195 ++++++++++++------ src/Formatter/InlineExternalImages.php | 19 +- test/fixture/docbook/smile.gif | Bin 0 -> 2219 bytes test/fixture/docbook/smile.jpg | Bin 0 -> 3476 bytes test/fixture/docbook/smile.png | Bin 2698 -> 2547 bytes test/fixture/docbook/test.md | 10 +- test/fixture/expectations/out.html | 10 +- .../Formatter/InlineExternalImagesTest.php | 59 ++++-- 10 files changed, 205 insertions(+), 90 deletions(-) create mode 100644 test/fixture/docbook/smile.gif create mode 100644 test/fixture/docbook/smile.jpg diff --git a/Dockerfile b/Dockerfile index 56b7cb01..c81b9500 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,7 @@ RUN \ php8.1-mbstring \ php8.1-xml \ php8.1-curl \ + php8.1-gd \ nodejs \ openjdk-18-jre \ xfonts-75dpi \ diff --git a/composer.json b/composer.json index 137a876e..8add405f 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ ], "require": { "php": "~8.1.3", + "ext-gd": "*", "guzzlehttp/guzzle": "^7.5", "guzzlehttp/psr7": "^2.4", "jasny/twig-extensions": "^1.3", diff --git a/composer.lock b/composer.lock index 5d9ad403..fb7f9f96 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e4a7c8eb6435cba8ee82b12ce1869402", + "content-hash": "97217b6656b41dc2a50cc091cb94de84", "packages": [ { "name": "guzzlehttp/guzzle", @@ -3255,19 +3255,21 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "86b842d48cdaaab1bf3dc24fdc830bf7b58cfcab" + "reference": "7756fea7a811a23d92009e03fdad3b91352f9b4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/86b842d48cdaaab1bf3dc24fdc830bf7b58cfcab", - "reference": "86b842d48cdaaab1bf3dc24fdc830bf7b58cfcab", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/7756fea7a811a23d92009e03fdad3b91352f9b4f", + "reference": "7756fea7a811a23d92009e03fdad3b91352f9b4f", "shasum": "" }, "conflict": { "3f/pygmentize": "<1.2", + "admidio/admidio": "<4.1.9", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", + "aheinze/cockpit": "<=2.2.1", "akaunting/akaunting": "<2.1.13", - "alextselegidis/easyappointments": "<1.4.3", + "alextselegidis/easyappointments": "<=1.4.3", "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", "amazing/media2click": ">=1,<1.3.3", "amphp/artax": "<1.0.6|>=2,<2.0.6", @@ -3283,18 +3285,23 @@ "bagisto/bagisto": "<0.1.5", "barrelstrength/sprout-base-email": "<1.2.7", "barrelstrength/sprout-forms": "<3.9", + "barryvdh/laravel-translation-manager": "<0.6.2", "baserproject/basercms": "<4.5.4", "billz/raspap-webgui": "<=2.6.6", "bk2k/bootstrap-package": ">=7.1,<7.1.2|>=8,<8.0.8|>=9,<9.0.4|>=9.1,<9.1.3|>=10,<10.0.10|>=11,<11.0.3", + "bmarshall511/wordpress_zero_spam": "<5.2.13", "bolt/bolt": "<3.7.2", - "bolt/core": "<4.1.13", + "bolt/core": "<=4.2", "bottelet/flarepoint": "<2.2.1", "brightlocal/phpwhois": "<=4.2.5", + "brotkrueml/codehighlight": "<2.7", + "brotkrueml/schema": "<1.13.1|>=2,<2.5.1", + "brotkrueml/typo3-matomo-integration": "<1.3.2", "buddypress/buddypress": "<7.2.1", "bugsnag/bugsnag-laravel": ">=2,<2.0.2", "bytefury/crater": "<6.0.2", "cachethq/cachet": "<2.5.1", - "cakephp/cakephp": "<4.0.6", + "cakephp/cakephp": "<3.10.3|>=4,<4.0.6", "cardgate/magento2": "<2.0.33", "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", "cartalyst/sentry": "<=2.1.6", @@ -3304,16 +3311,22 @@ "codeception/codeception": "<3.1.3|>=4,<4.1.22", "codeigniter/framework": "<=3.0.6", "codeigniter4/framework": "<4.1.9", + "codeigniter4/shield": "= 1.0.0-beta", "codiad/codiad": "<=2.8.4", - "composer/composer": "<1.10.23|>=2-alpha.1,<2.1.9", + "composer/composer": "<1.10.26|>=2-alpha.1,<2.2.12|>=2.3,<2.3.5", "concrete5/concrete5": "<9", - "concrete5/core": "<8.5.7", + "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", + "contao/contao": ">=4,<4.4.56|>=4.5,<4.9.18|>=4.10,<4.11.7|>=4.13,<4.13.3", "contao/core": ">=2,<3.5.39", - "contao/core-bundle": "<4.9.18|>=4.10,<4.11.7|= 4.10.0", + "contao/core-bundle": "<4.9.18|>=4.10,<4.11.7|>=4.13,<4.13.3|= 4.10.0", "contao/listing-bundle": ">=4,<4.4.8", - "craftcms/cms": "<3.7.14", + "contao/managed-edition": "<=1.5", + "craftcms/cms": ">= 4.0.0-RC1, < 4.2.1|<4.2.1", "croogo/croogo": "<3.0.7", + "cuyz/valinor": "<0.12", + "czproject/git-php": "<4.0.3", + "darylldoyle/safe-svg": "<1.9.10", "datadog/dd-trace": ">=0.30,<0.30.2", "david-garcia/phpwhois": "<=4.3.1", "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1", @@ -3327,57 +3340,67 @@ "doctrine/mongodb-odm": ">=1,<1.0.2", "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", - "dolibarr/dolibarr": "<16|>= 3.3.beta1, < 13.0.2", - "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.88|>=8,<9.2.13|>=9.3,<9.3.6", + "dolibarr/dolibarr": "<16|= 12.0.5|>= 3.3.beta1, < 13.0.2", + "dompdf/dompdf": "<2", + "drupal/core": ">=7,<7.91|>=8,<9.3.19|>=9.4,<9.4.3", "drupal/drupal": ">=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", "dweeves/magmi": "<=0.7.24", "ecodev/newsletter": "<=4", "ectouch/ectouch": "<=2.7.2", + "elefant/cms": "<1.3.13", "elgg/elgg": "<3.3.24|>=4,<4.0.5", "endroid/qr-code-bundle": "<3.4.2", "enshrined/svg-sanitize": "<0.15", "erusev/parsedown": "<1.7.2", "ether/logs": "<3.0.4", + "exceedone/exment": "<4.4.3|>=5,<5.0.3", + "exceedone/laravel-admin": "= 3.0.0|<2.2.3", "ezsystems/demobundle": ">=5.4,<5.4.6.1", "ezsystems/ez-support-tools": ">=2.2,<2.2.3", "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1", "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", "ezsystems/ezplatform": "<=1.13.6|>=2,<=2.5.24", - "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<=1.5.25", + "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6|>=1.5,<1.5.27", "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1", - "ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<1.3.12", + "ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<1.3.19", "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<1.3.8", "ezsystems/ezplatform-richtext": ">=2.3,<=2.3.7", "ezsystems/ezplatform-user": ">=1,<1.0.1", - "ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<7.5.26", + "ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<7.5.29", "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.3.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1", "ezyang/htmlpurifier": "<4.1.1", "facade/ignition": "<1.16.15|>=2,<2.4.2|>=2.5,<2.5.2", + "facturascripts/facturascripts": "<=2022.8", "feehi/cms": "<=2.1.1", "feehi/feehicms": "<=0.1.3", + "fenom/fenom": "<=2.12.1", + "filegator/filegator": "<7.8", "firebase/php-jwt": "<2", "flarum/core": ">=1,<=1.0.1", "flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15", "flarum/tags": "<=0.1-beta.13", "fluidtypo3/vhs": "<5.1.1", + "fof/byobu": ">=0.3-beta.2,<1.1.7", + "fof/upload": "<1.2.3", "fooman/tcpdf": "<6.2.22", - "forkcms/forkcms": "<=5.9.2", + "forkcms/forkcms": "<5.11.1", "fossar/tcpdf-parser": "<6.2.22", - "francoisjacquet/rosariosis": "<8.1.1", + "francoisjacquet/rosariosis": "<10.1", "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "froala/wysiwyg-editor": "<3.2.7", + "froxlor/froxlor": "<0.10.38", "fuel/core": "<1.8.1", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", - "getgrav/grav": "<1.7.31", - "getkirby/cms": "<3.5.8", + "getgrav/grav": "<1.7.34", + "getkirby/cms": "<3.5.8.1|>=3.6,<3.6.6.1|>=3.7,<3.7.4", "getkirby/panel": "<2.5.14", + "getkirby/starterkit": "<=3.7.0.2", "gilacms/gila": "<=1.11.4", "globalpayments/php-sdk": "<2", "google/protobuf": "<3.15", @@ -3385,25 +3408,34 @@ "gree/jose": "<=2.2", "gregwar/rst": "<1.0.3", "grumpydictator/firefly-iii": "<5.6.5", - "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", - "helloxz/imgurl": "<=2.31", + "guzzlehttp/guzzle": "<6.5.8|>=7,<7.4.5", + "guzzlehttp/psr7": "<1.8.4|>=2,<2.1.1", + "helloxz/imgurl": "= 2.31|<=2.31", "hillelcoren/invoice-ninja": "<5.3.35", "hjue/justwriting": "<=1", "hov/jobfair": "<1.0.13|>=2,<2.0.2", + "hyn/multi-tenant": ">=5.6,<5.7.2", + "ibexa/core": ">=4,<4.0.7|>=4.1,<4.1.4", "ibexa/post-install": "<=1.0.4", "icecoder/icecoder": "<=8.1", + "idno/known": "<=1.3.1", "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", "illuminate/database": "<6.20.26|>=7,<7.30.5|>=8,<8.40", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", - "impresscms/impresscms": "<=1.4.2", + "impresscms/impresscms": "<=1.4.3", "in2code/femanager": "<5.5.1|>=6,<6.3.1", + "in2code/lux": "<17.6.1|>=18,<24.0.2", "intelliants/subrion": "<=4.2.1", + "islandora/islandora": ">=2,<2.4.1", "ivankristianto/phpwhois": "<=4.3", "jackalope/jackalope-doctrine-dbal": "<1.7.4", "james-heinrich/getid3": "<1.9.21", - "joomla/archive": "<1.1.10", + "joomla/archive": "<1.1.12|>=2,<2.0.1", + "joomla/filesystem": "<1.6.2|>=2,<2.0.1", + "joomla/filter": "<1.4.4|>=2,<2.0.1", + "joomla/input": ">=2,<2.0.2", "joomla/session": "<1.3.1", "jsdecena/laracom": "<2.0.9", "jsmitty12/phpwhois": "<5.1", @@ -3411,8 +3443,10 @@ "kevinpapst/kimai2": "<1.16.7", "kitodo/presentation": "<3.1.2", "klaviyo/magento2-extension": ">=1,<3", + "krayin/laravel-crm": "<1.2.2", "kreait/firebase-php": ">=3.2,<3.8.1", "la-haute-societe/tcpdf": "<6.2.22", + "laminas/laminas-diactoros": "<2.11.1", "laminas/laminas-form": "<2.17.1|>=3,<3.0.2|>=3.1,<3.1.1", "laminas/laminas-http": "<2.14.2", "laravel/fortify": "<1.11.1", @@ -3424,53 +3458,62 @@ "league/commonmark": "<0.18.3", "league/flysystem": "<1.1.4|>=2,<2.1.1", "lexik/jwt-authentication-bundle": "<2.10.7|>=2.11,<2.11.3", - "librenms/librenms": "<22.2.2", + "librenms/librenms": "<=22.8", "limesurvey/limesurvey": "<3.27.19", "livehelperchat/livehelperchat": "<=3.91", "livewire/livewire": ">2.2.4,<2.2.6", "lms/routes": "<2.1.1", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", + "luyadev/yii-helpers": "<1.2.1", "magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3", "magento/magento1ce": "<1.9.4.3", "magento/magento1ee": ">=1,<1.14.4.3", "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", "marcwillmann/turn": "<0.3.3", - "matyhtf/framework": "<=3.0.5", - "mautic/core": "<4.2|= 2.13.1", + "matyhtf/framework": "<3.0.6", + "mautic/core": "<4.3|= 2.13.1", "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", - "microweber/microweber": "<1.3", + "mezzio/mezzio-swoole": "<3.7|>=4,<4.3", + "microweber/microweber": "<=1.3.1", "miniorange/miniorange-saml": "<1.4.3", "mittwald/typo3_forum": "<1.2.1", "modx/revolution": "<= 2.8.3-pl|<2.8", + "mojo42/jirafeau": "<4.4", "monolog/monolog": ">=1.8,<1.12", - "moodle/moodle": "<3.9.11|>=3.10-beta,<3.10.8|>=3.11,<3.11.5", + "moodle/moodle": "<4.0.1", "mustache/mustache": ">=2,<2.14.1", "namshi/jose": "<2.2", "neoan3-apps/template": "<1.1.1", + "neorazorx/facturascripts": "<2022.4", "neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", "neos/form": ">=1.2,<4.3.3|>=5,<5.0.9|>=5.1,<5.1.3", - "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", + "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<5.3.10|>=7,<7.0.9|>=7.1,<7.1.7|>=7.2,<7.2.6|>=7.3,<7.3.4|>=8,<8.0.2", "neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", "netgen/tagsbundle": ">=3.4,<3.4.11|>=4,<4.0.15", "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", "nilsteampassnet/teampass": "<=2.1.27.36", - "nukeviet/nukeviet": "<4.3.4", - "nystudio107/craft-seomatic": "<3.3", + "notrinos/notrinos-erp": "<=0.7", + "noumo/easyii": "<=0.9", + "nukeviet/nukeviet": "<4.5.2", + "nystudio107/craft-seomatic": "<3.4.12", "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", "october/backend": "<1.1.2", "october/cms": "= 1.1.1|= 1.0.471|= 1.0.469|>=1.0.319,<1.0.469", "october/october": ">=1.0.319,<1.0.466|>=2.1,<2.1.12", "october/rain": "<1.0.472|>=1.1,<1.1.2", - "october/system": "<1.0.475|>=1.1,<1.1.11|>=2,<2.1.27", + "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.15", "onelogin/php-saml": "<2.10.4", "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", + "open-web-analytics/open-web-analytics": "<1.7.4", "opencart/opencart": "<=3.0.3.2", "openid/php-openid": "<2.3", "openmage/magento-lts": "<19.4.15|>=20,<20.0.13", "orchid/platform": ">=9,<9.4.4", + "oro/commerce": ">=5,<5.0.4", "oro/crm": ">=1.7,<1.7.4|>=3.1,<4.1.17|>=4.2,<4.2.7", "oro/platform": ">=1.7,<1.7.4|>=3.1,<3.1.29|>=4.1,<4.1.17|>=4.2,<4.2.8", + "packbackbooks/lti-1-3-php-library": "<5", "padraic/humbug_get_contents": "<1.1.2", "pagarme/pagarme-php": ">=0,<3", "pagekit/pagekit": "<=1.0.18", @@ -3485,26 +3528,29 @@ "phpfastcache/phpfastcache": "<6.1.5|>=7,<7.1.2|>=8,<8.0.7", "phpmailer/phpmailer": "<6.5", "phpmussel/phpmussel": ">=1,<1.6", - "phpmyadmin/phpmyadmin": "<4.9.8|>=5,<5.0.3|>=5.1,<5.1.2", - "phpoffice/phpexcel": "<1.8.2", + "phpmyadmin/phpmyadmin": "<5.1.3", + "phpoffice/phpexcel": "<1.8", "phpoffice/phpspreadsheet": "<1.16", "phpseclib/phpseclib": "<2.0.31|>=3,<3.0.7", "phpservermon/phpservermon": "<=3.5.2", - "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", + "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", - "pimcore/pimcore": "<=10.3.2", - "pocketmine/pocketmine-mp": "<4.0.7", + "pimcore/data-hub": "<1.2.4", + "pimcore/pimcore": "<10.5.6", + "pocketmine/bedrock-protocol": "<8.0.2", + "pocketmine/pocketmine-mp": "<4.7.2|>= 4.0.0-BETA5, < 4.4.2", "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", + "prestashop/blockwishlist": ">=2,<2.1.1", "prestashop/contactform": ">1.0.1,<4.3", "prestashop/gamification": "<2.3.2", - "prestashop/prestashop": ">=1.7,<=1.7.8.2", - "prestashop/productcomments": ">=4,<4.2.1", + "prestashop/prestashop": ">=1.6.0.10,<1.7.8.7", + "prestashop/productcomments": "<5.0.2", "prestashop/ps_emailsubscription": "<2.6.1", "prestashop/ps_facetedsearch": "<3.4.1", "prestashop/ps_linklist": "<3.1", - "privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2", + "privatebin/privatebin": "<1.4", "propel/propel": ">=2-alpha.1,<=2-alpha.7", "propel/propel1": ">=1,<=1.7.1", "pterodactyl/panel": "<1.7", @@ -3512,31 +3558,37 @@ "pusher/pusher-php-server": "<2.2.1", "pwweb/laravel-core": "<=0.3.6-beta", "rainlab/debugbar-plugin": "<3.1", - "remdex/livehelperchat": "<3.93", + "rankmath/seo-by-rank-math": "<=1.0.95", + "react/http": ">=0.7,<1.7", + "remdex/livehelperchat": "<3.99", "rmccue/requests": ">=1.6,<1.8", "robrichards/xmlseclibs": "<3.0.4", "rudloff/alltube": "<3.0.3", - "s-cart/s-cart": "<6.7.2", + "s-cart/core": "<6.9", + "s-cart/s-cart": "<6.9", "sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1", "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", - "shopware/core": "<=6.4.8.1", - "shopware/platform": "<=6.4.8.1", + "shopware/core": "<=6.4.9", + "shopware/platform": "<=6.4.9", "shopware/production": "<=6.3.5.2", - "shopware/shopware": "<5.7.7", + "shopware/shopware": "<=5.7.14", "shopware/storefront": "<=6.4.8.1", - "showdoc/showdoc": "<=2.10.2", + "shopxo/shopxo": "<2.2.6", + "showdoc/showdoc": "<2.10.4", "silverstripe/admin": ">=1,<1.8.1", - "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", + "silverstripe/assets": ">=1,<1.10.1", "silverstripe/cms": "<4.3.6|>=4.4,<4.4.4", "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", - "silverstripe/framework": "<4.10.1", + "silverstripe/framework": "<4.10.9", "silverstripe/graphql": "<3.5.2|>=4-alpha.1,<4-alpha.2|= 4.0.0-alpha1", + "silverstripe/hybridsessions": ">=1,<2.4.1|>=2.5,<2.5.1", "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", + "silverstripe/silverstripe-omnipay": "<2.5.2|>=3,<3.0.2|>=3.1,<3.1.4|>=3.2,<3.2.1", "silverstripe/subsites": ">=2,<2.1.1", "silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1", "silverstripe/userforms": "<3", @@ -3546,14 +3598,15 @@ "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "simplito/elliptic-php": "<1.0.6", "slim/slim": "<2.6", - "smarty/smarty": "<3.1.43|>=4,<4.0.3", - "snipe/snipe-it": "<5.3.11", + "smarty/smarty": "<3.1.47|>=4,<4.2.1", + "snipe/snipe-it": "<6.0.11|>= 6.0.0-RC-1, <= 6.0.0-RC-5", "socalnick/scn-social-auth": "<1.15.2", "socialiteproviders/steam": "<1.1", "spipu/html2pdf": "<5.2.4", "spoonity/tcpdf": "<6.2.22", "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", "ssddanbrown/bookstack": "<22.2.3", + "statamic/cms": "<3.2.39|>=3.3,<3.3.2", "stormpath/sdk": ">=0,<9.9.99", "studio-42/elfinder": "<2.1.59", "subrion/cms": "<=4.2.1", @@ -3561,10 +3614,10 @@ "swiftmailer/swiftmailer": ">=4,<5.4.5", "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", - "sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", + "sylius/grid-bundle": "<1.10.1", "sylius/paypal-plugin": ">=1,<1.2.4|>=1.3,<1.3.1", "sylius/resource-bundle": "<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", - "sylius/sylius": "<1.6.9|>=1.7,<1.7.9|>=1.8,<1.8.3|>=1.9,<1.9.5", + "sylius/sylius": "<1.9.10|>=1.10,<1.10.11|>=1.11,<1.11.2", "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", "symbiote/silverstripe-versionedfiles": "<=2.0.3", @@ -3599,43 +3652,52 @@ "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", "t3/dce": ">=2.2,<2.6.2", "t3g/svg-sanitizer": "<1.0.3", + "tastyigniter/tastyigniter": "<3.3", "tecnickcom/tcpdf": "<6.2.22", "terminal42/contao-tablelookupwizard": "<3.3.5", "thelia/backoffice-default-template": ">=2.1,<2.1.2", "thelia/thelia": ">=2.1-beta.1,<2.1.3", "theonedemon/phpwhois": "<=4.2.5", + "thinkcmf/thinkcmf": "<=5.1.7", "tinymce/tinymce": "<5.10", "titon/framework": ">=0,<9.9.99", - "topthink/framework": "<6.0.9", + "topthink/framework": "<=6.0.13", "topthink/think": "<=6.0.9", "topthink/thinkphp": "<=3.2.3", "tribalsystems/zenario": "<9.2.55826", "truckersmp/phpwhois": "<=4.3.1", "twig/twig": "<1.38|>=2,<2.14.11|>=3,<3.3.8", - "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.29|>=10,<10.4.19|>=11,<11.5", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.29|>=10,<10.4.32|>=11,<11.5.16", "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", - "typo3/cms-core": ">=6.2,<=6.2.56|>=7,<=7.6.52|>=8,<=8.7.41|>=9,<9.5.29|>=10,<10.4.19|>=11,<11.5", + "typo3/cms-core": ">=6.2,<=6.2.56|>=7,<7.6.58|>=8,<8.7.48|>=9,<9.5.37|>=10,<10.4.32|>=11,<11.5.16", "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", + "typo3/html-sanitizer": ">=1,<1.0.7|>=2,<2.0.16", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.3.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", "typo3/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", "ua-parser/uap-php": "<3.8", - "unisharp/laravel-filemanager": "<=2.3", + "unisharp/laravel-filemanager": "<=2.5.1", "userfrosting/userfrosting": ">=0.3.1,<4.6.3", "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", "vanilla/safecurl": "<0.9.2", "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", - "vrana/adminer": "<4.7.9", + "vrana/adminer": "<4.8.1", "wallabag/tcpdf": "<6.2.22", "wanglelecc/laracms": "<=1.0.3", "web-auth/webauthn-framework": ">=3.3,<3.3.4", "webcoast/deferred-image-processing": "<1.0.2", "wikimedia/parsoid": "<0.12.2", "willdurand/js-translation-bundle": "<2.1.1", + "wintercms/winter": "<1.0.475|>=1.1,<1.1.9", + "woocommerce/woocommerce": "<6.6", "wp-cli/wp-cli": "<2.5", - "yetiforce/yetiforce-crm": "<=6.3", + "wp-graphql/wp-graphql": "<0.3.5", + "wpanel/wpanel4-cms": "<=4.3.1", + "wwbn/avideo": "<=11.6", + "yeswiki/yeswiki": "<4.1", + "yetiforce/yetiforce-crm": "<=6.4", "yidashi/yii2cmf": "<=2", "yii2mod/yii2-cms": "<1.9.2", "yiisoft/yii": ">=1.1.14,<1.1.15", @@ -3654,10 +3716,10 @@ "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", "zendframework/zend-developer-tools": ">=1.2.2,<1.2.3", - "zendframework/zend-diactoros": ">=1,<1.8.4", - "zendframework/zend-feed": ">=1,<2.10.3", + "zendframework/zend-diactoros": "<1.8.4", + "zendframework/zend-feed": "<2.10.3", "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", - "zendframework/zend-http": ">=1,<2.8.1", + "zendframework/zend-http": "<2.8.1", "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", @@ -3709,7 +3771,7 @@ "type": "tidelift" } ], - "time": "2022-03-14T19:04:00+00:00" + "time": "2022-09-21T22:04:29+00:00" }, { "name": "sebastian/cli-parser", @@ -5523,8 +5585,9 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~8.1.3" + "php": "~8.1.3", + "ext-gd": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Formatter/InlineExternalImages.php b/src/Formatter/InlineExternalImages.php index 140daf1a..c7c14e64 100644 --- a/src/Formatter/InlineExternalImages.php +++ b/src/Formatter/InlineExternalImages.php @@ -7,7 +7,11 @@ use Roave\DocbookTool\DocbookPage; use RuntimeException; +use function array_key_exists; use function base64_encode; +use function getimagesize; +use function is_array; +use function is_string; use function preg_replace_callback; use function Safe\file_get_contents; use function sprintf; @@ -23,17 +27,26 @@ public function __invoke(DocbookPage $page): DocbookPage { return $page->withReplacedContent( preg_replace_callback( - '/!\[([\w\W]+)]\(([\w\W]*?)\)/', + '/!\[([^]]+)]\(([^)]*?)\)/', function (array $m) { /** @var array{1: string, 2: string} $m */ $altText = $m[1]; $imagePath = $m[2]; - $imageContent = file_get_contents($this->docbookPath . '/' . $imagePath); + $fullImagePath = $this->docbookPath . '/' . $imagePath; + + $imageContent = file_get_contents($fullImagePath); + + $imageInfo = getimagesize($fullImagePath); + + if (! is_array($imageInfo) || ! array_key_exists('mime', $imageInfo) || ! is_string($imageInfo['mime'])) { + throw new RuntimeException('Unable to determine mime type of ' . $fullImagePath); + } return sprintf( - '![%s](data:image/png;base64,%s)', + '![%s](data:%s;base64,%s)', $altText, + $imageInfo['mime'], base64_encode($imageContent), ); }, diff --git a/test/fixture/docbook/smile.gif b/test/fixture/docbook/smile.gif new file mode 100644 index 0000000000000000000000000000000000000000..9b787db3db9e789d9cc6324b6ece93c6ba6a3faa GIT binary patch literal 2219 zcmeH``8(A60>{7K8DsWEyq@<@@1Nf9=k4p~*l1L;nnM|Qj^!4?R967>>kK%AR zd_F%bD+@r-8Vs!_^L0+=9yDH>Q{02Ko)iNJ;gY{=_uqX1i| zB>`%WhuV11bw0X11sY%?20{r_3^%}Z2cZ{B9pg8a;?2I{Oc$}He?qo@BF$G|^EJp~ z4KfFi1%NF8L|uWXtB~a?WVM2z0)!<%{)H7l+W?FWz}W(5`!~pL5!$|pvjccLK-dn5 z+W~0@Aln0I&vQ8N1$1Bt4jFO}2T*<`oPQN66GNpEs3sed36M28P;ONM$j)k4pD6j7y-ov^J;JLp9#$8mCaT>1C0!js8g19o4$9wOyUxDfQ7 z2EBg3c_4dqooTdRmIZJ9*uQkGvI{%aGuqnmb^I39=x?qiBfm}$MmQ(rRb8%{`}M5H zb^ghd9&nfVCNJRr-S+ooO%v_%@Ow+<3`(GG_A5@)rztTGGq@Vu-aj>Tm>hYe)ggZF z_f@L<_(EOM{7~6dzFqwcM2sAcL&_FeV#6O}AteFF=S(9I`*jR` z(^y*5CE?K>wYetAj*|S;6U(&%FIq_7WxbJ2V}4{tscsq~W zniT{R{W%fL<2u6?-&dpOwDa9?q36kc{OTH^&y~1KscxzJw`BXNM{C4u-E&ZqOKK@w z#-lf|&(J_>xlbeSLql~ml^>RlkH0Np6F*{w!C|BiF%gM04F&s`kA737>Fj;uNDIr| zv+TWS#o2RqDc{-?OF57BH5fm*-x{4@AVN{j=X3WyU^gbd%f9~a>^p*+36%)K%an7p)3KA4r^F{- zQbg>`fw4~1)@+#cu7Eb3_TKhqNU$J_x?7J;F4f#*2I0CI|Jvb)&QnQqHmNJ zkjBazq+{;QN9an-aO~Z3{%aE5jum#B<+x_yD=CnXcY zp=WKcd!wLjhO^=sMdzaembj0?(AMS|iP~DnANyV&b~f>%VfRd6w9nf&n!~j_w5;2G z%P+)f1jcx2{nHd%k=;BbiIMrI%4-=&>OSY-4KC?&RIyL^Y@kQ9Xz+&9EOZ~y7ZEdp zK1J(Ep>4MCx2nP>`o}_Wbf4!^{i8zTZx%V1vF8>HFTD$L{O05PrrE*QT)gXd bpZ5=zT3K9KYoi|6h)4AlhV*J^KtKNnW5{S? literal 0 HcmV?d00001 diff --git a/test/fixture/docbook/smile.jpg b/test/fixture/docbook/smile.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6181f9052ebca818e6c00d632e4657a14f41c1b8 GIT binary patch literal 3476 zcmbW&c{J4D{|E5*7>r$mu_Q)D5s^@`8yXBUS%)IovSrKCAVy>jV@Z8bO+>ab_I+Qn ze2Qclp~8?Y%h(#ieD(c)&+m86@2}tY`?}|O|GD?vb07EKb1r?HJ`J2O)I;k5AP@k6 zjvGLq1atv*78W)Z2s;}q8z%=lC-f8#l$#qWE_9Ob)Hw+mX($FiJpbFz5(jbA|MVOU@e8vtbioB?MrNE~2* zg1}G^y$gUJ?~@7i&jS8kAO(h6&BbHmBm<&LYHyN7>3V9PGqaSr`5z05OUu;Ft?ixNU$njb zKQ0ge{uk@G{}=54xS+=_21Z6OBjk?@#Bl#OU??Ng>5I%fNK=S|AFsH=Ll!=r)SU8m zR)nJ22F&r^5F5XQ(##p^AKE`<|36sdeyxA|qgM!qz^b|~HJ9DQuQqGOSj8|tb(kNX4I6_U8Zw5Pa)C~VIk;ErNoBVoUkv(sT17{{-<<4pXFz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35EroWP(dJ#><||=&o&pM+2aR39KQAC7Aw`zJ&+Vf zyj>HgRF-!+HRAh

aL%594rHo#>aGTSkR6{IzDHsMp80W-UVx>r;3MT|-#07&SLU zB%}3gypFh3n~ZZoURfP2Ew0Qg<~HOhVwmEZivLj1?*Og zO!I0R+*UwZiLfAY=EzSx=>YTkTm0t-DnVqFEiBRuk*Z(#AObV5Ejoz8!AM=)f;2sB z`G~GDB`+jRQDJN3G7>>Wd~R&!rEtZD`p^MhhqKwL$$DcM!iyHJTk!Z-+&a1SC78IE zux2^&u~&9cep^wfJs+?Z(z12Nji!4PNeA|1mFWOfTO<&+5YqbIj;&W=scgza;r0pb z&DWZ*&nx38)x93}LOXwxRMmuyjIPWH>UE;UL)Us4=|Gzsc(}=xB7A|}U9pwOyL`rv zsb<=`d_b_&zsf0nHTg|bgo^A%sVpG&P25c!L|W|yIk@b-OAcD zPZF)vwPnmTt6znA#xLLv+C@WiNsJ;gSfhArG{>!`MRaI&ds6J1F?-U7d)Db`n0kp% z%zu7TrhkXyC5!hfoVPeS*Dod+#qm~yMZ+_8MDqmBV}GfDuo~ph(Cs7rXt0o@0B-Wc zR9n=A%H3h5$ulDRZhOyL0)4$w=nHzV1}N?9B(hd%*msTz{1Uhk`M2MRAZYJHq-Lfr ziVxK6v=P;@oA@5LM$+YC>Y}l4j|=R43>-VDnVs)_G*DJu^$l=hl#VVRmf&*BjgT`% L@d3vH(ZBoyi+Y06 literal 0 HcmV?d00001 diff --git a/test/fixture/docbook/smile.png b/test/fixture/docbook/smile.png index 01063d4324c214c57895ee0b80111b47ab7bde14..d4c763fdb06ed03e3df9198299130d677208362e 100644 GIT binary patch delta 2522 zcmV<02_^Q574s92Gk*!HNkl&2JmW8Hb;x4C{m3C4KfODq6rrWAs$#6j6c> zL4hj1G_ak(DC7_LP@ql^YEjezk{+Z>T_rbHUd29`j9njGt0<5{rFPpxtsZC?ryt}7hJ5kSjg z+qQ6BSESb2qsqgF55>ic7sb%fkdhE#r7w~pzV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uqtbFz9Wp^$l++5+B}rl85TKvb3(_SHmzIWZ_P_`d#MagpnVp>_ gxm+%FjV!|d0WW~7RXe|ZzW@LL07*qoM6N<$f)3jlmH+?% diff --git a/test/fixture/docbook/test.md b/test/fixture/docbook/test.md index 7378c9d1..c49e4590 100644 --- a/test/fixture/docbook/test.md +++ b/test/fixture/docbook/test.md @@ -37,10 +37,12 @@ hexagon TestingHexagon @enduml ``` -## An image +## Some images -Here is an image: +Here are some images: -![A smiley face](./smile.png) +![A smiley face in PNG](./smile.png) +![A smiley face in JPG](./smile.jpg) +![A smiley face in GIF](./smile.gif) -It was hand drawn, that's why it looks rubbish. +They are hand drawn, that's why they look rubbish. diff --git a/test/fixture/expectations/out.html b/test/fixture/expectations/out.html index e6ac993e..28f17872 100644 --- a/test/fixture/expectations/out.html +++ b/test/fixture/expectations/out.html @@ -51,13 +51,15 @@

A diagram

Diagram

-

An image

+

Some images

-

Here is an image:

+

Here are some images:

-

A smiley face

+

A smiley face in PNG +A smiley face in JPG +A smiley face in GIF

-

It was hand drawn, that's why it looks rubbish.

+

They are hand drawn, that's why they look rubbish.


diff --git a/test/unit/Formatter/InlineExternalImagesTest.php b/test/unit/Formatter/InlineExternalImagesTest.php index c570e3c4..fcac3198 100644 --- a/test/unit/Formatter/InlineExternalImagesTest.php +++ b/test/unit/Formatter/InlineExternalImagesTest.php @@ -8,31 +8,60 @@ use Roave\DocbookTool\DocbookPage; use Roave\DocbookTool\Formatter\InlineExternalImages; +use function sprintf; + /** @covers \Roave\DocbookTool\Formatter\InlineExternalImages */ final class InlineExternalImagesTest extends TestCase { - /** @return list */ + private const MIME_JPG = 'image/jpeg'; + private const MIME_PNG = 'image/png'; + private const MIME_GIF = 'image/gif'; + + private const EXPECTED_BASE64_CONTENT_TYPES = [ + self::MIME_JPG => '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAsICAoIBwsKCQoNDAsNERwSEQ8PESIZGhQcKSQrKigkJyctMkA3LTA9MCcnOEw5PUNFS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96nMiSL0J4KZCT9hBk+ciSWjRNmoewYqF4n5pAJC8Qh2LNqX0gykD+yhaBVjSpSIuhQAIE0pBSKxiZxGpYgmdalPf0rU8cjzpgsZalHlYlOkOkSpS5VKU50qJ5r+tChUFQsFxolVyAQEADs=', + ]; + + /** @return list */ public function contentAndImagePathProvider(): array { return [ - [__DIR__ . '/../../fixture/docbook', 'smile.png'], - [__DIR__ . '/../../fixture/docbook', './smile.png'], - [__DIR__ . '/../../fixture/docbook/', 'smile.png'], - [__DIR__ . '/../../fixture/docbook/', './smile.png'], - [__DIR__ . '/../../fixture', './docbook/smile.png'], - [__DIR__ . '/../../fixture', 'docbook/smile.png'], - [__DIR__ . '/../../fixture/', './docbook/smile.png'], - [__DIR__ . '/../../fixture/', 'docbook/smile.png'], + [__DIR__ . '/../../fixture/docbook', 'smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture/docbook', './smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture/docbook/', 'smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture/docbook/', './smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture', './docbook/smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture', 'docbook/smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture/', './docbook/smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture/', 'docbook/smile.jpg', self::MIME_JPG], + [__DIR__ . '/../../fixture/docbook', 'smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture/docbook', './smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture/docbook/', 'smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture/docbook/', './smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture', './docbook/smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture', 'docbook/smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture/', './docbook/smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture/', 'docbook/smile.png', self::MIME_PNG], + [__DIR__ . '/../../fixture/docbook', 'smile.gif', self::MIME_GIF], + [__DIR__ . '/../../fixture/docbook', './smile.gif', self::MIME_GIF], + [__DIR__ . '/../../fixture/docbook/', 'smile.gif', self::MIME_GIF], + [__DIR__ . '/../../fixture/docbook/', './smile.gif', self::MIME_GIF], + [__DIR__ . '/../../fixture', './docbook/smile.gif', self::MIME_GIF], + [__DIR__ . '/../../fixture', 'docbook/smile.gif', self::MIME_GIF], + [__DIR__ . '/../../fixture/', './docbook/smile.gif', self::MIME_GIF], + [__DIR__ . '/../../fixture/', 'docbook/smile.gif', self::MIME_GIF], ]; } /** * @param non-empty-string $contentPath * @param non-empty-string $imagePath + * @param non-empty-string $expectedMimeType * * @dataProvider contentAndImagePathProvider */ - public function testExternalImagesAreInlined(string $contentPath, string $imagePath): void + public function testExternalImagesAreInlined(string $contentPath, string $imagePath, string $expectedMimeType): void { $markdown = <<content()); } From 903832cd7a1ae4b43d613d8326cd81b6f402fb81 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 22 Sep 2022 11:34:53 +0100 Subject: [PATCH 6/6] Added test cases when image does not exist or MIME type cannot be detected --- .../Formatter/InlineExternalImagesTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/unit/Formatter/InlineExternalImagesTest.php b/test/unit/Formatter/InlineExternalImagesTest.php index fcac3198..be005db1 100644 --- a/test/unit/Formatter/InlineExternalImagesTest.php +++ b/test/unit/Formatter/InlineExternalImagesTest.php @@ -7,6 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\DocbookTool\DocbookPage; use Roave\DocbookTool\Formatter\InlineExternalImages; +use RuntimeException; use function sprintf; @@ -85,4 +86,22 @@ public function testExternalImagesAreInlined(string $contentPath, string $imageP self::assertSame($expectedOutput, $formattedPage->content()); } + + public function testImageNotExisting(): void + { + $this->expectError(); + $this->expectErrorMessage('Failed to open stream: No such file or directory'); + (new InlineExternalImages(__DIR__ . '/../../fixture/docbook'))( + DocbookPage::fromSlugAndContent('slug', '![the alt text](something-that-should-not-exist.jpg)'), + ); + } + + public function testImageMimeTypeNotDetected(): void + { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('Unable to determine mime type'); + (new InlineExternalImages(__DIR__ . '/../../fixture/docbook'))( + DocbookPage::fromSlugAndContent('slug', '![the alt text](test.md)'), + ); + } }