Support block indentation for abstract classes

Fixes #83
This commit is contained in:
Carlo Sciolla 2019-01-08 23:06:58 +01:00
parent de5d9b3dd7
commit 366ecb605a
No known key found for this signature in database
GPG Key ID: BA5D71E6F3C580C1
2 changed files with 27 additions and 2 deletions

View File

@ -342,7 +342,7 @@ Uses prefix (as PREFIX) to choose where to display it:
(defvar plantuml-keywords-regexp (concat "^\\s *" (regexp-opt plantuml-keywords 'words) "\\|\\(<\\|<|\\|\\*\\|o\\)\\(\\.+\\|-+\\)\\|\\(\\.+\\|-+\\)\\(>\\||>\\|\\*\\|o\\)\\|\\.\\{2,\\}\\|-\\{2,\\}"))
(defvar plantuml-builtins-regexp (regexp-opt plantuml-builtins 'words))
(defvar plantuml-preprocessors-regexp (concat "^\\s *" (regexp-opt plantuml-preprocessors 'words)))
(defvar plantuml-indent-regexp-start "^[ \t]*\\(\\(?:.*\\)?\s*\\(?:[<>.*a-z-|]+\\)?\s*\\(?:\\[[a-zA-Z]+\\]\\)?\s+if\s+.*\\|loop\s+.*\\|group\s+.*\\|par\s*$\\|opt\s+.*\\|alt\s+.*\\|else\\|note\s+over\\|note\sas\s.*\\|note\s+\\(\\(?:\\(?:button\\|left\\|right\\|top\\)\\)\\)\\(?:\s+of\\)?\\|\\(?:class\\|enum\\|package\\|database\\|frame\\|cloud\\|folder\\)\s+.*{\\|activate\s+.+\\)")
(defvar plantuml-indent-regexp-start "^[ \t]*\\(\\(?:.*\\)?\s*\\(?:[<>.*a-z-|]+\\)?\s*\\(?:\\[[a-zA-Z]+\\]\\)?\s+if\s+.*\\|loop\s+.*\\|group\s+.*\\|par\s*$\\|opt\s+.*\\|alt\s+.*\\|else\\|note\s+over\\|note\sas\s.*\\|note\s+\\(\\(?:\\(?:button\\|left\\|right\\|top\\)\\)\\)\\(?:\s+of\\)?\\|\\(?:\\(abstract \\)?class\\|enum\\|package\\|database\\|frame\\|cloud\\|folder\\)\s+.*{\\|activate\s+.+\\)")
(defvar plantuml-indent-regexp-end "^[ \t]*\\(endif\\|else\\|end\\|end\s+note\\|.*}\\|deactivate\s+.+\\)")
(setq plantuml-font-lock-keywords

View File

@ -306,8 +306,33 @@ package APackage {
}
"))
(ert-deftest platuml-test-block-indentation/class ()
"Test correct indentation of a class block"
(plantuml-test-indent-block
"
class Foo {
+bar()
}
"
"
class Foo {
+bar()
}
")
(plantuml-test-indent-block
"
abstract class Foo {
+bar()
}
"
"
abstract class Foo {
+bar()
}
"))
(ert-deftest plantuml-test-block-indentation/various-keywords ()
"Test correct indentation of a package block."
"Test correct indentation of block keywords."
(plantuml-test-indent-block
"
cloud \"mycloud\" {