Plug-in for Sphinx to render "scruffy" diagrams.
pip install sphinx-scruffy
To use scruffy diagrams you need several external dependencies installed:
- The Scruffy Python module. This module will be installed automatically when
you use
pip install sphinx-scruffy
.
- You need
dot
(Graphviz),rsvg-convert
(librsvg) andpic2plot
(plotutils). You can install all three with one command on Ubuntu:
sudo apt-get install graphviz librsvg2-bin plotutils
.
- You need
- 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
.
An example of your shpinx's conf.py:
extensions = ['sphinx_scruffy']
This section shows a few examples of "scruffy" diagrams done using shpinx-scruffy plugin.
The following reStructuredText:
.. scruffy::
[User|+Forename;+Surname;+HashedPassword;-Salt|+Login();+Logout()]
Results in this image:
[User+Login();+Logout()]
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:
[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]
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:
[Node A]->[Node B] [Node B]->[Node C] [Group [Node A][Node B]]
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:
[Patron]order food>[Waiter] [Waiter]order food>[Cook] [Waiter]serve wine>[Patron] [Cook]pickup>[Waiter] [Waiter]serve food>[Patron] [Patron]pay>[Cashier]
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
If you have questions, bug reports, suggestions, etc. please create an issue on the GitHub project page.
This software is licensed under the MIT license
See LICENSE.txt
© 2013 Paylogic International.