+++ title = "PlantUML" author = ["Kaushal Modi"] description = "Collection of PlantUML snippets that I find useful." date = 2018-04-06 lastmod = 2018-06-13T10:24:21-04:00 tags = ["plantuml"] draft = false creator = "Emacs 27.0.50 (Org mode 9.1.13 + ox-hugo)" [versions] plantuml = "beta 2018/04/09" +++
Table of Contents
- [Class with tree-structure in body](#class-with-tree-structure-in-body) - [Class Composition](#class-composition) - [Reference](#reference) - [Nested boxes](#nested-boxes) - [Forcing vertical ordering of rectangles](#forcing-vertical-ordering-of-rectangles)
## Class with tree-structure in body {#class-with-tree-structure-in-body} ```plantuml class Foo { **Bar(Model)** |_ prop |_ **Bom(Model)** |_ prop2 |_ prop3 |_ prop3.1 |_ prop4 -- } ``` {{< figure src="class-body-tree.png" >}} [Source](http://forum.plantuml.net/3448/how-to-display-nested-tree-like-structure-in-a-class-body?show=3455#a3455) ## Class Composition {#class-composition} Diagram to represent a class containing children classes. ```plantuml class h-entry << (H,white) >> { Post Entry == ""
..
"" } class p-name << (P,orchid) >> { Title of the post == ""

..

"" } class u-url << (U,#7EC0EE) >> { Permalink of the post == "".."" } class u-syndication << (U,#7EC0EE) >> { Link where the post is syndicated == "".."" } class dt-published << (D,green) >> { Publish date of the post .. Go Date/time format: "2006-01-02T15:04:05-0700" == """" } class p-summary << (P,orchid) >> { Summary/description of the post == ""
..
"" } class u-author << (U,#7EC0EE) >> { Post author == "".."" } class e-content << (E,red) >> { Post content == ""
..
"" } class p-category << (P,orchid) >> { Tag, category, series name == ""TAG"" } "p-name" -up-* "h-entry" "u-url" -up-* "h-entry" "u-syndication" -left-* "h-entry" "h-entry" *-right- "p-summary" "h-entry" *-right- "u-author" "h-entry" *-down- "dt-published" "h-entry" *-down- "e-content" "h-entry" *-down- "p-category" ``` {{< figure src="class-composition.png" >}} ### Reference {#reference} - ## Nested boxes {#nested-boxes} > I'd like to document the nested HTML tags for my web page, and > represent them as a diagram with nested blocks. > > While searching for an existing representation like that online, I > came across [this](https://mdn.mozillademos.org/files/14075/bubbling-capturing.png). > > Is there a way to draw something like the nested blocks in the center > of that figure using PlantUML? ```plantuml rectangle ", , etc." as a { rectangle "
..." as b #antiquewhite { rectangle "