Yanyg - Software Engineer

在Emacs下绘制UML图

目录

最近想画几个UML图,Emacs配置记录如下:

Download plantuml.jar: https://plantuml.com/. And put it to ~/.emacs.d/external/.

~$ wget https://jaist.dl.sourceforge.net/project/plantuml/plantuml.jar?viasf=1
~$ mv plantuml.jar?viasf=1 ~/.emacs.d/external/plantuml.jar

Config org babel:

(org-babel-do-load-languages
 'org-babel-load-languages
 '(;; other Babel languages
   (plantuml . t)))

(setq org-plantuml-jar-path
      (expand-file-name "~/.emacs.d/external/plantuml.jar"))

Try:

Alice -> Bob: synchronous call
Alice ->> Bob: asynchronous call

Another example

title Example Sequence Diagram
activate Client
Client -> Server: Session Initiation
note right: Client requests new session
activate Server
Client <-- Server: Authorization Request
note left: Server requires authentication
Client -> Server: Authorization Response
note right: Client provides authentication details
Server --> Client: Session Token
note left: Session established
deactivate Server
Client -> Client: Saves token
deactivate Client

Another example:

'http://click.sourceforge.net/images/activity-diagram-small.png
title Servlet Container

(*) --> "ClickServlet.handleRequest()"
--> "new Page"

if "Page.onSecurityCheck" then
  ->[true] "Page.onInit()"

  if "isForward?" then
    ->[no] "Process controls"

    if "continue processing?" then
      -->[yes] ===RENDERING===
    else
      -->[no] ===REDIRECT_CHECK===
    endif

  else
    -->[yes] ===RENDERING===
  endif

  if "is Post?" then
    -->[yes] "Page.onPost()"
    --> "Page.onRender()" as render
    --> ===REDIRECT_CHECK===
  else
    -->[no] "Page.onGet()"
    --> render
  endif

else
  -->[false] ===REDIRECT_CHECK===
endif

if "Do redirect?" then
  ->[yes] "redirect request"
  --> ==BEFORE_DESTORY===
else
  if "Do Forward?" then
    -left->[yes] "Forward request"
    --> ==BEFORE_DESTORY===
  else
    -right->[no] "Render page template"
    --> ==BEFORE_DESTORY===
  endif
endif

--> "Page.onDestory()"
-->(*)

1 References