Skip to content

Commit

Permalink
Merge pull request #831 from sphinx-contrib/port-over-more-sample-sets
Browse files Browse the repository at this point in the history
Port over more sample sets
  • Loading branch information
jdknight authored Jul 15, 2023
2 parents d0d1381 + 2c6cbfd commit 9815dd0
Show file tree
Hide file tree
Showing 53 changed files with 940 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/sample-sets/confluence-code-block-theme/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extensions = [
'sphinxcontrib.confluencebuilder',
]

confluence_code_block_theme = 'Midnight'
28 changes: 28 additions & 0 deletions tests/sample-sets/confluence-code-block-theme/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
confluence-code-block-theme
===========================

.. code-block:: python
def main():
print 'Hello, world!'
if __name__ == '__main__':
main()
.. code-block:: python
:class: confluence-theme-FadeToGrey
def main():
print 'Hello, world!'
if __name__ == '__main__':
main()
.. code-block:: python
:class: confluence-theme-eclipse
def main():
print 'Hello, world!'
if __name__ == '__main__':
main()
11 changes: 11 additions & 0 deletions tests/sample-sets/confluence-code-block-theme/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
3 changes: 3 additions & 0 deletions tests/sample-sets/confluence-status/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extensions = [
'sphinxcontrib.confluencebuilder',
]
8 changes: 8 additions & 0 deletions tests/sample-sets/confluence-status/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
confluence-status
=================

:confluence_status:`First status`

:confluence_status:`Another status <yellow>`

:confluence_status:`Let's go! [green]`
11 changes: 11 additions & 0 deletions tests/sample-sets/confluence-status/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
1 change: 1 addition & 0 deletions tests/sample-sets/drawio/box.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2021-11-12T04:34:56.282Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.6.13 Chrome/89.0.4389.128 Electron/12.0.7 Safari/537.36" etag="VnDegXizWILD0XYqE30J" version="14.6.13" type="device"><diagram id="GZmhYcr-ncgRq0jOcgJH" name="Page-1">7Zddb9owFIZ/DZebyCfhslDadaJqVzRt3Z2JTWLViSPHKR+/fseJTUgCa7TCdlMJCfv18dfzHtswcKbJ5lagLL7nmLCBPcSbgXM9sG1rGATwpZRtpYx9LUSCYh1UCwu6I6anVguKSd4IlJwzSbOmGPI0JaFsaEgIvm6GrThrzpqhiHSERYhYV/1BsYwrNbBHtf6F0Cg2M1v+uGpJkAnWO8ljhPn6QHJmA2cqOJdVKdlMCVPwDJeq382J1v3CBEllnw6+fRM9JPz7fIaTn27m3v36tv2kR3lFrNAb1ouVW0NA8CLFRA0yHDiTdUwlWWQoVK1r8By0WCYMahYUu4syMxAhyeZA0ou8JTwhUmwhRLcaXttmdV3Tt4wWH5D3tYa04dF+4JoJFDSW44hoUXxdSm88et7hlD0+7YbPt30QgbWZKoZbRoGVcN4Gtayozpd7AYUvUcn6oZAwDNF6Xh0Jy9vT7aA8AvwkXWvYwnuEr38Eb3ApvPbbeGEUOO5EwTCgGS9w32x8Hy+nyctye+bjxYA5/fNRll//gJI9dptZZfWktE/Hs2Ny+2NaMbK5Um8FwCAp1kVIMpTnNFRpJ5GQXbnDkODOY/ImwUNCwz8REoQhSV+bExzDpud45BSmrhM5aCay47XI57wQIdG9Dt+R1kB2ayC7PRDAiojsDFS6uN/43xvrdYyd01x2zV3ThCF1jU5WPJUL3aLesDCmDM/RlheKMZgbvpjaJOaC7iAeGWdL7/XvEttvRCxUTz2mIOqifjR+Wy3pHm0agXOUS7MazhjKcrpk5spPACBNJ1xKnuigc9xkLd+CI0fUPZqA7oWOqN9x8k6SBBSr4yZsW5ZmCP5CppxxAXrKK3spYy0JMRqlUGVkpbopbhR+011pWXJ1BeZwI9I0mpcx126tPOnNK4lD3xUrD35MMSapspBLJNFyn0+ZSvUSjjeBDzCcDj97Aw8WPoW6Vdfho8KFnPIU9oJoaR2BZFgTlRD9fD59LLrmm0Pq9zPbxJ3d69Epr7vX8ofX7/Pas/+z18Epr50Pr8/s9Si4mNdQrf+cVo93/Rffmf0G</diagram></mxfile>
4 changes: 4 additions & 0 deletions tests/sample-sets/drawio/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extensions = [
'sphinxcontrib.confluencebuilder',
'sphinxcontrib.drawio',
]
17 changes: 17 additions & 0 deletions tests/sample-sets/drawio/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
drawio
======

.. drawio-figure:: box.drawio
:align: left

----

.. drawio-image:: box.drawio
:format: png
:align: center

----

.. drawio-figure:: box.drawio
:format: svg
:align: right
13 changes: 13 additions & 0 deletions tests/sample-sets/drawio/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
package_root={toxinidir}{/}..{/}..{/}..

[testenv]
deps =
sphinxcontrib-drawio
commands =
{envpython} -m tests.test_sample {posargs}
setenv =
PYTHONDONTWRITEBYTECODE=1
TOX_INI_DIR={toxinidir}
passenv = *
use_develop = true
4 changes: 4 additions & 0 deletions tests/sample-sets/httpdomain/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extensions = [
'sphinxcontrib.confluencebuilder',
'sphinxcontrib.httpdomain',
]
71 changes: 71 additions & 0 deletions tests/sample-sets/httpdomain/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
httpdomain
==========

.. http:get:: /users/(int:user_id)/posts/(tag)
The posts tagged with `tag` that the user (`user_id`) wrote.

**Example request**:

.. sourcecode:: http

GET /users/123/posts/web HTTP/1.1
Host: example.com
Accept: application/json, text/javascript

**Example response**:

.. sourcecode:: http

HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript

[
{
"post_id": 12345,
"author_id": 123,
"tags": ["server", "web"],
"subject": "I tried Nginx"
},
{
"post_id": 12346,
"author_id": 123,
"tags": ["html5", "standards", "web"],
"subject": "We go to HTML 5"
}
]

:query sort: one of ``hit``, ``created-at``
:query offset: offset number. default is 0
:query limit: limit number. default is 30
:reqheader Accept: the response content type depends on
:mailheader:`Accept` header
:reqheader Authorization: optional OAuth token to authenticate
:resheader Content-Type: this depends on :mailheader:`Accept`
header of request
:statuscode 200: no error
:statuscode 404: there's no user


.. http:post:: /posts/(int:post_id)
Replies a comment to the post.

:param post_id: post's unique id
:type post_id: int
:form email: author email address
:form body: comment body
:reqheader Accept: the response content type depends on
:mailheader:`Accept` header
:reqheader Authorization: optional OAuth token to authenticate
:resheader Content-Type: this depends on :mailheader:`Accept`
header of request
:status 302: and then redirects to :http:get:`/posts/(int:post_id)`
:status 400: when form parameters are missing

.. http:get:: /posts/(int:post_id)
Fetches the post

(...)
13 changes: 13 additions & 0 deletions tests/sample-sets/httpdomain/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
package_root={toxinidir}{/}..{/}..{/}..

[testenv]
deps =
sphinxcontrib-httpdomain
commands =
{envpython} -m tests.test_sample {posargs}
setenv =
PYTHONDONTWRITEBYTECODE=1
TOX_INI_DIR={toxinidir}
passenv = *
use_develop = true
5 changes: 5 additions & 0 deletions tests/sample-sets/ipython/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# IPython

Confluence does not support a means to make text unselectable; however,
users may want to still render the contents inside IPython directive on
Confluence pages.
5 changes: 5 additions & 0 deletions tests/sample-sets/ipython/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extensions = [
'IPython.sphinxext.ipython_console_highlighting',
'IPython.sphinxext.ipython_directive',
'sphinxcontrib.confluencebuilder',
]
91 changes: 91 additions & 0 deletions tests/sample-sets/ipython/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
IPython
=======

.. ipython::

In [136]: x = 2

In [137]: x**3
Out[137]: 8

Another demonstration of multi-line input and output

.. ipython::
:verbatim:

In [106]: print(x)
jdh

In [109]: for i in range(10):
.....: print(i)
.....:
.....:
0
1
2
3
4
5
6
7
8
9

Likewise, you can set ``:doctest:`` or ``:verbatim:`` to apply these
settings to the entire block. For example,

.. ipython::
:verbatim:

In [9]: cd mpl/examples/
/home/jdhunter/mpl/examples

In [10]: pwd
Out[10]: '/home/jdhunter/mpl/examples'


In [14]: cd mpl/examples/<TAB>
mpl/examples/animation/ mpl/examples/misc/
mpl/examples/api/ mpl/examples/mplot3d/
mpl/examples/axes_grid/ mpl/examples/pylab_examples/
mpl/examples/event_handling/ mpl/examples/widgets

In [14]: cd mpl/examples/widgets/
/home/msierig/mpl/examples/widgets

In [15]: !wc *
2 12 77 README.txt
40 97 884 buttons.py
26 90 712 check_buttons.py
19 52 416 cursor.py
180 404 4882 menu.py
16 45 337 multicursor.py
36 106 916 radio_buttons.py
48 226 2082 rectangle_selector.py
43 118 1063 slider_demo.py
40 124 1088 span_selector.py
450 1274 12457 total

You can also have function definitions included in the source.

.. ipython::

In [3]: def square(x):
...: """
...: An overcomplicated square function as an example.
...: """
...: if x < 0:
...: x = abs(x)
...: y = x * x
...: return y
...:

Then call it from a subsequent section.

.. ipython::

In [4]: square(3)
Out [4]: 9

In [5]: square(-2)
Out [5]: 4
13 changes: 13 additions & 0 deletions tests/sample-sets/ipython/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
package_root={toxinidir}{/}..{/}..{/}..

[testenv]
deps =
ipython
commands =
{envpython} -m tests.test_sample {posargs}
setenv =
PYTHONDONTWRITEBYTECODE=1
TOX_INI_DIR={toxinidir}
passenv = *
use_develop = true
24 changes: 24 additions & 0 deletions tests/sample-sets/kroki/assets/diagram.ditaa
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
+--------+
| |
| User |
| |
+--------+
^
request |
v
+-------------+
| |
| Kroki |
| |---+
+-------------+ |
^ ^ | inflate
| | |
v +---------+
+-------------+
| |
| Ditaa |
| |----+
+-------------+ |
^ | process
| |
+-------+
1 change: 1 addition & 0 deletions tests/sample-sets/kroki/assets/diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo -> bar
23 changes: 23 additions & 0 deletions tests/sample-sets/kroki/assets/graph.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
digraph D {
subgraph cluster_p {
label = "Kroki";
subgraph cluster_c1 {
label = "Server";
Filebeat;
subgraph cluster_gc_1 {
label = "Docker/Server";
Java;
}
subgraph cluster_gc_2 {
label = "Docker/Mermaid";
"Node.js";
"Puppeteer";
"Chrome";
}
}
subgraph cluster_c2 {
label = "CLI";
Golang;
}
}
}
4 changes: 4 additions & 0 deletions tests/sample-sets/kroki/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extensions = [
'sphinxcontrib.confluencebuilder',
'sphinxcontrib.kroki',
]
Loading

0 comments on commit 9815dd0

Please sign in to comment.