diff --git a/plantuml-mode.el b/plantuml-mode.el index bb95c4e..12d0c9a 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -588,7 +588,7 @@ or it is followed by line end.") (defvar plantuml-indent-regexp-oldif-start "^.*if\s+\".*\"\s+then\s*\\('.*\\)?$" "used in current activity diagram, sometimes already mentioned as deprecated") (defvar plantuml-indent-regexp-newif-start "^\s*\\(?:else\\)?if\s+(.*)\s+then\s*.*$") (defvar plantuml-indent-regexp-loop-start "^\s*\\(?:repeat\s*\\|while\s+(.*).*\\)$") - (defvar plantuml-indent-regexp-fork-start "^\s*fork\\(?:\s+again\\)?\s*$") + (defvar plantuml-indent-regexp-fork-start "^\s*\\(?:fork\\|split\\)\\(?:\s+again\\)?\s*$") (defvar plantuml-indent-regexp-macro-start "^\s*!definelong.*$") (defvar plantuml-indent-regexp-user-control-start "^.*'.*\s*PLANTUML_MODE_INDENT_INCREASE\s*.*$") (defvar plantuml-indent-regexp-start (list plantuml-indent-regexp-block-start @@ -620,7 +620,7 @@ or it is followed by line end.") (defvar plantuml-indent-regexp-oldif-end "^\s*\\(endif\\|else\\)\s*\\('.*\\)?$") (defvar plantuml-indent-regexp-newif-end "^\s*\\(endif\\|elseif\\|else\\)\s*.*$") (defvar plantuml-indent-regexp-loop-end "^\s*\\(repeat\s*while\\|endwhile\\)\s*.*$") - (defvar plantuml-indent-regexp-fork-end "^\s*\\(fork\s+again\\|end\s+fork\\)\s*$") + (defvar plantuml-indent-regexp-fork-end "^\s*\\(\\(fork\\|split\\)\s+again\\|end\s+\\(fork\\|split\\)\\)\s*$") (defvar plantuml-indent-regexp-macro-end "^\s*!enddefinelong\s*\\('.*\\)?$") (defvar plantuml-indent-regexp-user-control-end "^.*'.*\s*PLANTUML_MODE_INDENT_DECREASE\s*.*$") (defvar plantuml-indent-regexp-end (list plantuml-indent-regexp-block-end diff --git a/test/plantuml-indentation-activity-new-test.el b/test/plantuml-indentation-activity-new-test.el index e4f67ec..250f913 100644 --- a/test/plantuml-indentation-activity-new-test.el +++ b/test/plantuml-indentation-activity-new-test.el @@ -220,9 +220,91 @@ stop @enduml")) +(ert-deftest plantuml-test-indentation/activity-new/grouping () + "Test correct indentation of plantuml activity-new grouping +These code examples are taken from www.plantuml.com" + (plantuml-test-indent-block +"@startuml +start +partition Initialization { +:read config file; +:init internal variable; +} +partition Running { +:wait for user interaction; +:print information; +} +stop +@enduml" +"@startuml +start +partition Initialization { + :read config file; + :init internal variable; +} +partition Running { + :wait for user interaction; + :print information; +} +stop +@enduml")) + +(ert-deftest plantuml-test-indentation/activity-new/sdl+splits () + "Test correct indentation of plantuml activity-new sdl rendering and splits +These code examples are taken from www.plantuml.com" + (plantuml-test-indent-block +"@startuml +:Ready; +:next(o)| +:Receiving; +split +:nak(i)< +:ack(o)> +split again +:ack(i)< +:next(o) +on several lines| +:i := i + 1] +:ack(o)> +split again +:err(i)< +:nak(o)> +split again +:foo/ +split again +:i > 5} +stop +end split +:finish; +@enduml" + +"@startuml +:Ready; +:next(o)| +:Receiving; +split + :nak(i)< + :ack(o)> +split again + :ack(i)< + :next(o) + on several lines| + :i := i + 1] + :ack(o)> +split again + :err(i)< + :nak(o)> +split again + :foo/ +split again + :i > 5} + stop +end split +:finish; +@enduml")) (provide 'plantuml-indentation-activity-new-test)