Readme.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. PlantUML plugin for Pelican rst documents
  2. =========================================
  3. This plugin allows you to define UML diagrams directly into rst documents using the great
  4. PlantUML_ tool.
  5. This plugin gets the content of ``uml`` directive, passes it to the external
  6. program PlantUML_ and then links the generated image to the document.
  7. Installation
  8. ------------
  9. You need to install PlantUML_ (see the site for details) and Graphviz_ 2.26.3 or later.
  10. The plugin expects a program ``plantuml`` in the classpath. If not installed by your package
  11. manager, you can create a shell script and place it somewhere in the classpath. For example,
  12. save te following into ``/usr/local/bin/plantuml`` (supposing PlantUML_ installed into
  13. ``/opt/plantuml``):
  14. .. code-block:: bash
  15. #!/bin/bash
  16. java -jar /opt/plantuml/plantuml.jar ${@}
  17. For Gentoo_ there is an ebuild at http://gpo.zugaina.org/dev-util/plantuml/RDep: you can download
  18. the ebuild and the ``files`` subfolder or you can add the ``zugaina`` repository with _layman
  19. (raccomended).
  20. Usage
  21. -----
  22. Add ``plantuml`` to plugin list in ``pelicanconf.py``. For example:
  23. .. code-block:: ptyhon
  24. PLUGINS = [ "sitemap", "plantuml" ]
  25. Use the ``uml`` directive to start UML diagram description. It is not necessary to enclose
  26. diagram body between ``@startuml`` and ``@enduml`` directives: they are added automatically
  27. before calling ``plantuml``.
  28. In addition to ``class`` and
  29. ``alt`` options common to all images, you can use the ``format`` option to select what kind
  30. of image must be produced. At the moment only ``png`` and ``svg`` are supported; the default
  31. is ``png``.
  32. Please note that the ``format`` option in not recognized by the ``plantuml`` extension of
  33. ``rst2pdf`` utility (call it with ``-e plantuml.py``) so if you use it you can get errors from
  34. that program.
  35. Examples
  36. --------
  37. Sequence diagram (from PlantUML_ site):
  38. .. code-block:: rst
  39. .. uml::
  40. participant User
  41. User -> A: DoWork
  42. activate A #FFBBBB
  43. A -> A: Internal call
  44. activate A #DarkSalmon
  45. A -> B: << createRequest >>
  46. activate B
  47. B --> A: RequestCreated
  48. deactivate B
  49. deactivate A
  50. A -> User: Done
  51. deactivate A
  52. Output:
  53. .. image:: http://plantuml.sourceforge.net/imgp/sequence_022.png
  54. Another example from PlantUML_ site (activity diagram):
  55. .. code-block:: rst
  56. .. uml::
  57. start
  58. :ClickServlet.handleRequest();
  59. :new page;
  60. if (Page.onSecurityCheck) then (true)
  61. :Page.onInit();
  62. if (isForward?) then (no)
  63. :Process controls;
  64. if (continue processing?) then (no)
  65. stop
  66. endif
  67. if (isPost?) then (yes)
  68. :Page.onPost();
  69. else (no)
  70. :Page.onGet();
  71. endif
  72. :Page.onRender();
  73. endif
  74. else (false)
  75. endif
  76. if (do redirect?) then (yes)
  77. :redirect process;
  78. else
  79. if (do forward?) then (yes)
  80. :Forward request;
  81. else (no)
  82. :Render page template;
  83. endif
  84. endif
  85. stop
  86. Generated image:
  87. .. image:: http://plantuml.sourceforge.net/imgp/activity2_009.png
  88. .. _PlantUML: http://plantuml.sourceforge.net
  89. .. _Sabayon: http://www.sabayon.org
  90. .. _Gentoo: http://www.gentoo.org
  91. .. _layman: http://wiki.gentoo.org/wiki/Layman
  92. .. _Graphviz: http://www.graphviz.org