add support and test for box/end box blocks

This commit is contained in:
René Schmelzer 2019-02-15 17:19:55 +01:00
parent fb427db400
commit 1e761fbd04
2 changed files with 19 additions and 1 deletions

View File

@ -357,13 +357,15 @@ might follow).")
Two variants for groups: keyword is either followed by whitespace and some text
or it is followed by line end.")
(defvar plantuml-indent-regexp-activate-start "^\s*activate\s+.+$")
(defvar plantuml-indent-regexp-box-start "^\s*box\s+.+$")
(defvar plantuml-indent-regexp-if-start "^\s*\\(\\(?:.*\\)?\s*\\(?:[<>.*a-z-|]+\\)?\s*\\(?:\\[[a-zA-Z]+\\]\\)?\s+if\s+.*\\)")
(defvar plantuml-indent-regexp-start (list plantuml-indent-regexp-block-start
plantuml-indent-regexp-note-start
plantuml-indent-regexp-group-start
plantuml-indent-regexp-activate-start
plantuml-indent-regexp-box-start
plantuml-indent-regexp-if-start))
(defvar plantuml-indent-regexp-end "^\s*\\(endif\\|else\\|end\\|end\s+note\\|.*}\\|deactivate\s+.+\\)")
(defvar plantuml-indent-regexp-end "^\s*\\(endif\\|else\\|end\\|end\s+note\\|end\s+box\\|.*}\\|deactivate\s+.+\\)")
(setq plantuml-font-lock-keywords
`(

View File

@ -331,6 +331,22 @@ abstract class Foo {
}
"))
(ert-deftest platuml-test-block-indentation/box ()
"Test correct indentation of a box block"
(plantuml-test-indent-block
"
box \"Device with USB connector\"
actor Human
participant UsbDetector
end box
"
"
box \"Device with USB connector\"
actor Human
participant UsbDetector
end box
" ))
(ert-deftest plantuml-test-block-indentation/various-keywords ()
"Test correct indentation of block keywords."
(plantuml-test-indent-block