2.7.3. Activity Diagram

sphinxcontrib-actdiag is a Sphinx extension for embedding activity diagrams. You can embed activity diagrams with the .. actdiag::` directive.

PyPI Package

https://pypi.org/project/sphinxcontrib-actdiag/

Documentation

http://blockdiag.com/en/actdiag/sphinxcontrib.html

Git Repository

https://github.com/blockdiag/sphinxcontrib-actdiag

Sphinx extension for embedding activity diagrams using actdiag.

Features
  1. Generate activity-diagram from dot like text (basic feature).

  2. Multilingualism for node-label (utf-8 only).

Todo

activate “Activity Diagram” extension.

Directive Body Diagram

.. actdiag::

For more details, see sphinxcontrib-actdiag in the extension demonstration and the README.rst in the extension Git repository.

The example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
.. actdiag::
   :align: center
   :scale: 75

   actdiag {
        A -> B -> C -> D;

        lane foo {
             A; B;
        }
        lane bar {
             C; D;
        }
   }
:which gives:

   .. include:: actdiag-directive-body-example.rsti

Description Table

the example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
.. actdiag::
   :align: center
   :scale: 75
   :desctable:

   actdiag {
        A -> B -> C;
        A [description = "browsers in each client"];
        B [description = "web server"];
        C [description = "database server"];
   }
:which gives:

   .. include:: actdiag-description-table-example.rsti

Include Diagram

the example
1
2
3
4
5
.. blockdiag:: act.diag
   :caption: Style attributes to frames and nodes (Activity Diagram example)
   :align: center
   :scale: 75
   :width: 640
:which gives:

   .. actdiag:: act.diag
      :caption: Style attributes to frames and nodes (Activity Diagram example)
      :align: center
      :scale: 75
      :width: 640
which needs

The example above comes from the original Sample diagrams web page and processed the following file content:

Listing 2.4 Activity Diagram example file (act.diag)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
actdiag {
    write -> convert -> image;

    lane user {
         label = "User";
         write [label = "Writing reST"];
         image [label = "Get diagram IMAGE"];
    }
    lane actdiag {
         convert [label = "Convert reST to Image"];
    }
}