From 68f4b5e25c5ecbdc74b8f302c06d089062c9a8c0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 22 Oct 2021 15:24:02 +0200 Subject: [PATCH] Add support for fake browser decoration in images --- src/Templates/default/html/image.html.twig | 3 +++ tests/fixtures/expected/blocks/nodes/figure.html | 13 ++++--------- tests/fixtures/source/blocks/nodes/figure.rst | 7 +++++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Templates/default/html/image.html.twig b/src/Templates/default/html/image.html.twig index 40c4c9b..f7ff3ff 100644 --- a/src/Templates/default/html/image.html.twig +++ b/src/Templates/default/html/image.html.twig @@ -2,4 +2,7 @@ Overridden so we can control the path to the image based on our copying logic. See CopyImagesListener. #} +{% set wrap_image_with_browser = 'with-browser' in imageNode.options.class ?? '' %} +{% if wrap_image_with_browser %}
{% endif %} +{% if wrap_image_with_browser %}
{% endif %} diff --git a/tests/fixtures/expected/blocks/nodes/figure.html b/tests/fixtures/expected/blocks/nodes/figure.html index 32ccfbb..16042ca 100644 --- a/tests/fixtures/expected/blocks/nodes/figure.html +++ b/tests/fixtures/expected/blocks/nodes/figure.html @@ -1,10 +1,3 @@ - - - - - - -
Symfony Logo @@ -18,5 +11,7 @@

But I am a caption for the figure above.

- - +

Some images use a special CSS class to wrap a fake browser around them:

+
+ A typical exception page in the development environment +
diff --git a/tests/fixtures/source/blocks/nodes/figure.rst b/tests/fixtures/source/blocks/nodes/figure.rst index db55b2c..aef414f 100644 --- a/tests/fixtures/source/blocks/nodes/figure.rst +++ b/tests/fixtures/source/blocks/nodes/figure.rst @@ -8,3 +8,10 @@ caption for the above figure. .. figure:: images/logo.png But I am a caption *for* the figure above. + +Some images use a special CSS class to wrap a fake browser around them: + +.. image:: images/exceptions-in-dev-environment.png + :alt: A typical exception page in the development environment + :align: center + :class: some-class with-browser another-class