Skip to content

Commit

Permalink
Merge pull request #1036 from sphinx-contrib/add-sample-set-for-images
Browse files Browse the repository at this point in the history
tests-sample-image: adding sample set
  • Loading branch information
jdknight authored Aug 24, 2024
2 parents 14c2565 + 6f9509a commit f4d6e7c
Show file tree
Hide file tree
Showing 8 changed files with 319 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/sample-sets/image/assets/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pdf binary
*.png binary
Binary file added tests/sample-sets/image/assets/confluence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/sample-sets/image/assets/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions tests/sample-sets/image/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/sample-sets/image/assets/sphinx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions tests/sample-sets/image/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extensions = [
'sphinxcontrib.confluencebuilder',
]
190 changes: 190 additions & 0 deletions tests/sample-sets/image/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
image
=====

.. _output_section:

Image directive
^^^^^^^^^^^^^^^

.. image:: assets/sphinx.png
:align: right
:width: 300px

The `image directive`_ can be used to add images into a document. Images from
the local documentation directory can be used, as well as embedded images (via
the data uri schema) or even externally referenced images. This extension takes
advantage of image formatting capabilities in Confluence. This page should
render an image floating in the top-right of the page. Adding a paragraph to
help visualize the floating image element.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris in gravida dui,
at finibus sem. Donec at convallis purus, quis pellentesque dolor. Praesent
sollicitudin eleifend diam, nec iaculis ante semper eu. Cras luctus dolor
malesuada, vulputate augue tristique, sodales dolor. Fusce vehicula ipsum urna,
vel ultricies purus tristique non. Nunc placerat ipsum sit amet molestie
efficitur. Etiam at euismod lectus. Mauris posuere tortor vitae arcu rhoncus, eu
dapibus ipsum imperdiet. Donec libero metus, interdum quis pretium eu, mattis a
magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
cubilia Curae; Pellentesque condimentum finibus elit, eu tincidunt urna faucibus
ut. Phasellus vehicula aliquam dolor vel sodales.

Images are typically included inline as follows:

.. raw:: confluence_storage
<p>
.. image:: assets/confluence.png
:align: center
:alt: alternate text

.. raw:: confluence_storage
</p>
Embedded images should be translated by Sphinx and this extension should handle
these images as well. One of these images is embedded and also one of these
images links to a target:

.. raw:: confluence_storage
<p style="text-align: center">
.. image:: assets/github.png

.. image::
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAAGXRFWH
RTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAA
AAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+ID
x4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3
JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZj
pSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbn
MjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYW
RvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS
4wL21tLyIgeG1sbnM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Tikj4Su9fk392fY2OdLxrXqm6Fnyf/xanVueK
wQ2EZeArYGN0Zk3IMRw10ntjeqgPEGcXmQ9xv6OTjOpnVCmvS24HGacc4wrXb1M9vki0lO0XgX0G
XQn0Rk4MoI4bKbulJG874ka08D8Y5cYPw5kf0ShXzI5KGgvtw52h/RoCrlyqBWE5388pZJn+hnNW
kqDDVZdmryTaIoM207JFu4OQEWyC/gMdwnZPajbwDypXkGuDQCuMNh45xcqAJxBpOtxceyeGHolj
PdOL5Euzzm9VU89oQdjzrkUTThjkQdc76RJRGgATh8n5lDq8Blt/Uy3zwg82GWj+GOuXFRJqPrpt
AmEXh0hAU4+eUG4sIcWAhbFghGYFC12SY77/32xrsHSdw34HMZUF0nXV8gEujBbBSMW4vfMY6Hpa
acVIBwabM+QcINHLBApo9UN+ibxopX4cJRt3SrfbECLJB5NoabCo9bdnUKXaN6us8TxR6wQD4E/T
H+eYNxnOOs1BTa5EbYaLisDpq8AuwC/ahxnO5WWKbVQlt0CWIaFDlggcxoevToGG387ykX2iiZ26
O9YJNNYWQYWngjLkxAf28c78TnihAu69wJNpgS5iJN6PGrOJiA0ke6j3G2BAtd6Ld9KesM3Rp25p
EFKENl6cTGTfwfGv/uMPkQkmmD1K0cdX05qkJEGoGOJwahPNLCQ108drnc45/ui6C4Xl2HV0hdzm
bdwvDdziSxuxmlZfMWdA5InrNNtWK1GkYrj6hs9Cztmgb+08Y517w0TvaM7dU3ssF+jXH8v3pIWX
m4+WdaiwIeylSGB0/vX2KcTQG2ONwUeBpl2h9HOyaqqqqMlcIVGwW2wOV/AgwA+MQnGo+UarEAAA
AASUVORK5CYII=

.. image:: assets/github.png
:target: `output_section`_

.. raw:: confluence_storage
</p>
The following is an example of an SVG image:

.. image:: assets/logo.svg
:align: center

The following is an example of an image found on an external server (with a
link target):

.. image:: https://img.shields.io/pypi/v/sphinxcontrib-confluencebuilder.svg
:target: https://pypi.python.org/pypi/sphinxcontrib-confluencebuilder
:alt: pip Version
:align: center

Figure directive
^^^^^^^^^^^^^^^^

The `figure directive`_ can be used to add images with captures and legend data
into a document.

.. figure:: assets/confluence.png
:alt: Confluence Logo
:align: left

This is the caption of the figure (a simple paragraph).

The legend consists of all elements *after* the caption.

Another figure but with a centered image and centered caption:

.. figure:: assets/confluence.png
:alt: Confluence Logo
:align: center

This is the caption of the figure.

Another figure but with a right-aligned image:

.. figure:: assets/confluence.png
:alt: Confluence Logo
:align: right
:width: 100px

This is the caption of the figure.

Another figure but scaled down:

.. figure:: assets/confluence.png
:alt: Confluence Logo
:scale: 50%

This is the caption of the figure.
11 changes: 11 additions & 0 deletions tests/sample-sets/image/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tox]
package_root={toxinidir}{/}..{/}..{/}..

[testenv]
commands =
{envpython} -m tests.test_sample {posargs}
setenv =
PYTHONDONTWRITEBYTECODE=1
TOX_INI_DIR={toxinidir}
passenv = *
use_develop = true

0 comments on commit f4d6e7c

Please sign in to comment.