Skip to main content

Plug-in for Sphinx to render "scruffy" diagrams.

Project description

sphinx-scruffy: Plug-in for Sphinx to render "scruffy" diagrams
===============================================================

Plug-in for Sphinx to render "scruffy" diagrams.

.. image:: https://api.travis-ci.org/paylogic/sphinx-scruffy.png
:target: https://travis-ci.org/paylogic/sphinx-scruffy
.. image:: https://pypip.in/v/sphinx-scruffy/badge.png
:target: https://crate.io/packages/sphinx-scruffy/
.. image:: https://coveralls.io/repos/paylogic/sphinx-scruffy/badge.png?branch=master
:target: https://coveralls.io/r/paylogic/sphinx-scruffy


Installation
------------

.. sourcecode::

pip install sphinx-scruffy

To use scruffy diagrams you need several external dependencies installed:

- The `Scruffy Python module <https://github.com/aivarsk/scruffy>`_. This module will be installed automatically when
you use ``pip install sphinx-scruffy``.
- You need ``dot`` (Graphviz), ``rsvg-convert`` (librsvg) and ``pic2plot`` (plotutils).
You can install all three with one command on Ubuntu: ``sudo apt-get install graphviz librsvg2-bin plotutils``.
- The scruffy font is called Purisa, if you're running Ubuntu you probably have it already but if you don't then
you can install it using ``sudo apt-get install ttf-thai-tlwg``.


Configuration
-------------

An example of your shpinx's conf.py:

.. code-block:: python

extensions = ['sphinx_scruffy']


Usage
-----

This section shows a few examples of "scruffy" diagrams done using shpinx-scruffy plugin.

A simple example
****************

The following reStructuredText::

.. scruffy::

[User|+Forename;+Surname;+HashedPassword;-Salt|+Login();+Logout()]

Results in this image:

.. scruffy::

[User|+Forename;+Surname;+HashedPassword;-Salt|+Login();+Logout()]

More complex example
********************

Here's a more complex example::

.. scruffy::

[note: You can stick notes on diagrams too!{bg:cornsilk}]
[Customer]<>1-orders 0..*>[Order]
[Order]++*->[LineItem]
[Order]-1>[DeliveryMethod]
[Order]-*>[Product]
[Category]<->[Product]
[DeliveryMethod]^[National]
[DeliveryMethod]^[International]

This results in the following image:

.. scruffy::

[note: You can stick notes on diagrams too!{bg:cornsilk}]
[Customer]<>1-orders 0..*>[Order]
[Order]++*->[LineItem]
[Order]-1>[DeliveryMethod]
[Order]-*>[Product]
[Category]<->[Product]
[DeliveryMethod]^[National]
[DeliveryMethod]^[International]

Class diagram extensions
************************

Here's how to create class diagrams::

.. scruffy::

[Node A]->[Node B]
[Node B]->[Node C]
[Group [Node A][Node B]]

This results in the following image:

.. scruffy::

[Node A]->[Node B]
[Node B]->[Node C]
[Group [Node A][Node B]]

Sequence diagrams
*****************

Finally there are sequence diagrams::

.. scruffy::
:sequence:

[Patron]order food>[Waiter]
[Waiter]order food>[Cook]
[Waiter]serve wine>[Patron]
[Cook]pickup>[Waiter]
[Waiter]serve food>[Patron]
[Patron]pay>[Cashier]

This results in the following image:

.. scruffy::
:sequence:

[Patron]order food>[Waiter]
[Waiter]order food>[Cook]
[Waiter]serve wine>[Patron]
[Cook]pickup>[Waiter]
[Waiter]serve food>[Patron]
[Patron]pay>[Cashier]


Python3 support
---------------

Package itself supports python3 out of the box, but it's dependency, scruffy package, doesn't yet have a pypi release
with python 3 support.
use git master for now https://github.com/aivarsk/scruffy.git

or via pip::

.. code-block:: sh

pip install -e git+https://github.com/aivarsk/scruffy.git#egg=scruffy


Contact
-------

If you have questions, bug reports, suggestions, etc. please create an issue on
the `GitHub project page <http://github.com/paylogic/sphinx-scruffy>`_.


License
-------

This software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_

See `<LICENSE.txt>`_


© 2013 Paylogic International.

Changelog
=========


1.0.0
-----

- packaging fixes (bubenkoff)


0.2
---

* Initial public release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-scruffy-1.0.0.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file sphinx-scruffy-1.0.0.tar.gz.

File metadata

File hashes

Hashes for sphinx-scruffy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0cd8d80507cfc4809d38262f283dab3084f0daa8ee61108880f9889cbdb38e19
MD5 9750517e991dfe2a7e5b47328299eb50
BLAKE2b-256 3aa3e8daee0fe03695168c70eb3fd8c19e2b08e00bba955da9f7f4f2918f3e1d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page