support indentation for activity diagrams - current/old style
This commit is contained in:
parent
153860bacb
commit
ef19d71ca3
|
@ -363,7 +363,7 @@ or it is followed by line end.")
|
|||
(defvar plantuml-indent-regexp-header-start "^\s*\\(?:\\(?:center\\|left\\|right\\)\s+header\\|header\\)$")
|
||||
(defvar plantuml-indent-regexp-footer-start "^\s*\\(?:\\(?:center\\|left\\|right\\)\s+footer\\|footer\\)$")
|
||||
(defvar plantuml-indent-regexp-legend-start "^\s*\\(?:legend\\|legend\s+\\(?:bottom\\|top\\)\\|legend\s+\\(?:center\\|left\\|right\\)\\|legend\s+\\(?:bottom\\|top\\)\s+\\(?:center\\|left\\|right\\)\\)$")
|
||||
(defvar plantuml-indent-regexp-if-start "^\s*\\(\\(?:.*\\)?\s*\\(?:[<>.*a-z-|]+\\)?\s*\\(?:\\[[a-zA-Z]+\\]\\)?\s+if\s+.*\\)")
|
||||
(defvar plantuml-indent-regexp-oldif-start "^.*if\s+\".*\"\s+then$")
|
||||
(defvar plantuml-indent-regexp-start (list plantuml-indent-regexp-block-start
|
||||
plantuml-indent-regexp-note-start
|
||||
plantuml-indent-regexp-group-start
|
||||
|
@ -374,7 +374,7 @@ or it is followed by line end.")
|
|||
plantuml-indent-regexp-header-start
|
||||
plantuml-indent-regexp-footer-start
|
||||
plantuml-indent-regexp-legend-start
|
||||
plantuml-indent-regexp-if-start))
|
||||
plantuml-indent-regexp-oldif-start))
|
||||
(defvar plantuml-indent-regexp-end "^\s*\\(?:}\\|endif\\|else\s*.*\\|end\\|end\s+note\\|end\s+box\\|end\s+ref\\|deactivate\s+.+\\|end\s+title\\|endheader\\|endfooter\\|endlegend\\)$")
|
||||
(setq plantuml-font-lock-keywords
|
||||
`(
|
||||
|
|
|
@ -0,0 +1,281 @@
|
|||
;;; plantuml-indentation-activity-old-test.el --- PlantUML Mode indentation tests -*- lexical-binding: t; -*-
|
||||
|
||||
;; Author: René Schmelzer
|
||||
;; Maintainer: Carlo Sciolla (skuro)
|
||||
;; URL: https://github.com/skuro/plantuml-mode
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Test indentation for activity (old version) diagrams.
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
||||
(ert-deftest plantuml-test-indentation/activity-old-diagram/branches ()
|
||||
"Test correct indentation of plantuml activity-old diagram elements: branches.
|
||||
These code examples are taken from www.plantuml.com"
|
||||
(plantuml-test-indent-block
|
||||
"
|
||||
if \"Some Test\" then
|
||||
-->[true] \"Some Activity\"
|
||||
--> \"Another activity\"
|
||||
-right-> (*)
|
||||
else
|
||||
->[false] \"Something else\"
|
||||
-->[Ending process] (*)
|
||||
endif
|
||||
|
||||
(*) --> \"check input\"
|
||||
If \"input is verbose\" then
|
||||
--> [Yes] \"turn on verbosity\"
|
||||
--> \"run command\"
|
||||
else
|
||||
--> \"run command\"
|
||||
Endif
|
||||
-->(*)
|
||||
"
|
||||
"
|
||||
if \"Some Test\" then
|
||||
-->[true] \"Some Activity\"
|
||||
--> \"Another activity\"
|
||||
-right-> (*)
|
||||
else
|
||||
->[false] \"Something else\"
|
||||
-->[Ending process] (*)
|
||||
endif
|
||||
|
||||
(*) --> \"check input\"
|
||||
If \"input is verbose\" then
|
||||
--> [Yes] \"turn on verbosity\"
|
||||
--> \"run command\"
|
||||
else
|
||||
--> \"run command\"
|
||||
Endif
|
||||
-->(*)
|
||||
"
|
||||
))
|
||||
|
||||
(ert-deftest plantuml-test-indentation/activity-old-diagram/more-on-branches ()
|
||||
"Test correct indentation of plantuml activity-old diagram elements: more on branches.
|
||||
These code examples are taken from www.plantuml.com"
|
||||
(plantuml-test-indent-block
|
||||
|
||||
"
|
||||
(*) --> if \"Some Test\" then
|
||||
|
||||
-->[true] \"activity 1\"
|
||||
|
||||
if \"\" then
|
||||
-> \"activity 3\" as a3
|
||||
else
|
||||
if \"Other test\" then
|
||||
-left-> \"activity 5\"
|
||||
else
|
||||
--> \"activity 6\"
|
||||
endif
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
->[false] \"activity 2\"
|
||||
|
||||
endif
|
||||
|
||||
a3 --> if \"last test\" then
|
||||
--> \"activity 7\"
|
||||
else
|
||||
-> \"activity 8\"
|
||||
endif
|
||||
"
|
||||
"
|
||||
(*) --> if \"Some Test\" then
|
||||
|
||||
-->[true] \"activity 1\"
|
||||
|
||||
if \"\" then
|
||||
-> \"activity 3\" as a3
|
||||
else
|
||||
if \"Other test\" then
|
||||
-left-> \"activity 5\"
|
||||
else
|
||||
--> \"activity 6\"
|
||||
endif
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
->[false] \"activity 2\"
|
||||
|
||||
endif
|
||||
|
||||
a3 --> if \"last test\" then
|
||||
--> \"activity 7\"
|
||||
else
|
||||
-> \"activity 8\"
|
||||
endif
|
||||
"
|
||||
))
|
||||
|
||||
(ert-deftest plantuml-test-indentation/activity-old-diagram/partitions ()
|
||||
"Test correct indentation of plantuml activity-old diagram elements: partitions.
|
||||
These code examples are taken from www.plantuml.com"
|
||||
(plantuml-test-indent-block
|
||||
|
||||
"
|
||||
partition Conductor {
|
||||
(*) --> \"Climbs on Platform\"
|
||||
--> === S1 ===
|
||||
--> Bows
|
||||
}
|
||||
|
||||
partition Audience #LightSkyBlue {
|
||||
=== S1 === --> Applauds
|
||||
}
|
||||
|
||||
partition Conductor {
|
||||
Bows --> === S2 ===
|
||||
--> WavesArmes
|
||||
Applauds --> === S2 ===
|
||||
}
|
||||
|
||||
partition Orchestra #CCCCEE {
|
||||
WavesArmes --> Introduction
|
||||
--> \"Play music\"
|
||||
}
|
||||
"
|
||||
"
|
||||
partition Conductor {
|
||||
(*) --> \"Climbs on Platform\"
|
||||
--> === S1 ===
|
||||
--> Bows
|
||||
}
|
||||
|
||||
partition Audience #LightSkyBlue {
|
||||
=== S1 === --> Applauds
|
||||
}
|
||||
|
||||
partition Conductor {
|
||||
Bows --> === S2 ===
|
||||
--> WavesArmes
|
||||
Applauds --> === S2 ===
|
||||
}
|
||||
|
||||
partition Orchestra #CCCCEE {
|
||||
WavesArmes --> Introduction
|
||||
--> \"Play music\"
|
||||
}
|
||||
"))
|
||||
|
||||
(ert-deftest plantuml-test-indentation/activity-old-diagram/complete-example ()
|
||||
"Test correct indentation of plantuml activity-old diagram elements: complete example.
|
||||
These code examples are taken from www.plantuml.com"
|
||||
(plantuml-test-indent-block
|
||||
|
||||
"
|
||||
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_DESTROY===
|
||||
else
|
||||
if \"Do Forward?\" then
|
||||
-left->[yes] \"Forward request\"
|
||||
--> ==BEFORE_DESTROY===
|
||||
else
|
||||
-right->[no] \"Render page template\"
|
||||
--> ==BEFORE_DESTROY===
|
||||
endif
|
||||
endif
|
||||
|
||||
--> \"Page.onDestroy()\"
|
||||
-->(*)
|
||||
"
|
||||
"
|
||||
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_DESTROY===
|
||||
else
|
||||
if \"Do Forward?\" then
|
||||
-left->[yes] \"Forward request\"
|
||||
--> ==BEFORE_DESTROY===
|
||||
else
|
||||
-right->[no] \"Render page template\"
|
||||
--> ==BEFORE_DESTROY===
|
||||
endif
|
||||
endif
|
||||
|
||||
--> \"Page.onDestroy()\"
|
||||
-->(*)
|
||||
"
|
||||
))
|
||||
|
||||
|
||||
(provide 'plantuml-indentation-activity-old-test)
|
||||
|
||||
;;; plantuml-indentation-activity-old-test.el ends here
|
Loading…
Reference in New Issue