Skip to content

Commit 95b11a3

Browse files
committed
feature #126 Add support for fake browser decoration in images (javiereguiluz)
This PR was merged into the main branch. Discussion ---------- Add support for fake browser decoration in images Commits ------- 68f4b5e Add support for fake browser decoration in images
2 parents 22d0822 + 68f4b5e commit 95b11a3

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/Templates/default/html/image.html.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
Overridden so we can control the path to the image based on our copying logic.
33
See CopyImagesListener.
44
#}
5+
{% set wrap_image_with_browser = 'with-browser' in imageNode.options.class ?? '' %}
6+
{% if wrap_image_with_browser %}<div class="with-browser">{% endif %}
57
<img src="{{ imageNode.value }}" {% for key, value in imageNode.options %}{{ key }}="{{ value }}" {% endfor %}/>
8+
{% if wrap_image_with_browser %}</div>{% endif %}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
<!DOCTYPE html>
2-
<html>
3-
<head>
4-
<meta charset="utf-8" />
5-
</head>
6-
<body>
7-
81
<figure>
92
<!-- REMOVE: src is empty just because the test doesn't utilize the full stack, with CopyImagesListener -->
103
<img src="" alt="Symfony Logo" width="200px" />
@@ -18,5 +11,7 @@
1811
<figcaption><p>But I am a caption <em>for</em> the figure above.</p></figcaption>
1912
</figure>
2013

21-
</body>
22-
</html>
14+
<p>Some images use a special CSS class to wrap a fake browser around them:</p>
15+
<div class="with-browser">
16+
<img src="" alt="A typical exception page in the development environment" align="center" class="some-class with-browser another-class">
17+
</div>

tests/fixtures/source/blocks/nodes/figure.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@ caption for the above figure.
88
.. figure:: images/logo.png
99

1010
But I am a caption *for* the figure above.
11+
12+
Some images use a special CSS class to wrap a fake browser around them:
13+
14+
.. image:: images/exceptions-in-dev-environment.png
15+
:alt: A typical exception page in the development environment
16+
:align: center
17+
:class: some-class with-browser another-class

0 commit comments

Comments
 (0)