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).

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
blockdiag foo bar A B C D

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
blockdiag 0efdfda6-03cd-11eb-8803 -0242ac110002 A B C

Name

Description

A

browsers in each client

B

web server

C

database server

Include Diagram

the example
1
2
3
4
5
.. blockdiag:: actdiag/example.diag
   :caption: Style attributes to frames and nodes (Activity Diagram example)
   :align: center
   :scale: 75
   :width: 480
which gives
blockdiag User actdiag Writing reST Convert reST to Image Get diagram IMAGE

Figure 2.48 Style attributes to frames and nodes (Activity Diagram example)

which needs

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

Listing 2.7 Activity Diagram example file (actdiag/example.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"];
    }
}