Skip to content

Commit

Permalink
Add syntax highlighting for PlantUML (#4740)
Browse files Browse the repository at this point in the history
* Created initial cut at syntax highlighting changes
for PlantUML, a popular diagram markup language

* Update color

* Trying another color - this time background color used in most plantUML diagrams

* Trying very light green

* Update vendor/licenses/grammar/vscode-plantuml.txt

Co-Authored-By: Colin Seymour <colin@github.com>

* Added 2 plantuml samples each for iuml, pu, and wsd

* Added heuristics for plantuml files

* Remove .pu, .wsd, mark as data

* Removed .pu and .wsd from heuristics file

* Undo changes to heuristics

* Add another iuml example

Co-authored-by: Colin Seymour <colin@github.com>
  • Loading branch information
karloskalcium and lildude authored Mar 10, 2020
1 parent 85d85a9 commit 743107d
Show file tree
Hide file tree
Showing 13 changed files with 412 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,9 @@
[submodule "vendor/grammars/vscode-opa"]
path = vendor/grammars/vscode-opa
url = https://github.com/tsandall/vscode-opa
[submodule "vendor/grammars/vscode-plantuml"]
path = vendor/grammars/vscode-plantuml
url = https://github.com/qjebbs/vscode-plantuml
[submodule "vendor/grammars/vscode-prisma"]
path = vendor/grammars/vscode-prisma
url = https://github.com/prisma/vscode-prisma
Expand Down
3 changes: 3 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,9 @@ vendor/grammars/vscode-lean:
- source.lean
vendor/grammars/vscode-opa:
- source.rego
vendor/grammars/vscode-plantuml:
- markdown.plantuml.codeblock
- source.wsd
vendor/grammars/vscode-prisma:
- source.prisma
vendor/grammars/vscode-scala-syntax:
Expand Down
9 changes: 9 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3964,6 +3964,15 @@ Pike:
tm_scope: source.pike
ace_mode: text
language_id: 287
PlantUML:
type: data
extensions:
- ".puml"
- ".iuml"
- ".plantuml"
tm_scope: source.wsd
ace_mode: text
language_id: 833504686
Pod:
type: prose
ace_mode: perl
Expand Down
14 changes: 14 additions & 0 deletions samples/PlantUML/ProtectedMeta.iuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
!define PROTECTED_META
' from https://github.com/FooBarShebang/libencapsulation/blob/master/docs/UML/implementation/ProtectedMeta.iuml'

!ifndef CLASSES
!include ../Templates/Classes.cuml
!endif

class ProtectedMeta <<metaclass>> {
__getattribute__(): class A, str -> type A
__setattr__(): class A, str, type A -> None
__delattr__(): class A, str -> None
__new__(): type class A, str, list(class B), dict(str -> type A) -> class A
__del__(): class A -> None
}
47 changes: 47 additions & 0 deletions samples/PlantUML/PublicallyAccessibleReDirect.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@startuml PublicallyAccessibleReDirect
' from https://github.com/newportg/newportg.github.io/blob/master/assets/PublicallyAccessibleReDirect.puml'

!includeurl https://raw.githubusercontent.com/RicardoNiepel/C4-PlantUML/master/C4_Component.puml
!define AzurePuml https://raw.githubusercontent.com/RicardoNiepel/Azure-PlantUML/release/2-1/dist
!includeurl AzurePuml/AzureCommon.puml
!includeurl AzurePuml/Identity/AzureActiveDirectory.puml
!includeurl AzurePuml/Networking/AzureApplicationGateway.puml
!includeurl AzurePuml/Networking/AzureVirtualNetwork.puml
!includeurl AzurePuml/Compute/AzureFunction.puml
!includeurl AzurePuml/Compute/AzureAppService.puml
!includeurl AzurePuml/Web/AzureCDN.puml
!includeurl AzurePuml/Storage/AzureBlobStorage.puml

title Publically Accessible Re-Direct

System_Boundary(off, "Office 365") {
Component(out, "", "Outlook", "Contact")
}
System_Boundary(ios, "Ios Contact") {
Component(ac, "", "Apple", "Contact")
}

System_Boundary(Az, "Azure") {
Container(asa, "apple-app-site-association", "","")

AzureCDN(cdn, "CDN","","")
AzureApplicationGateway(fd, "ApplicationGateway","","")
AzureFunction(afHb, "HeartBeat","","")
AzureAppService(afRw, "ReWrite","","")
AzureBlobStorage(bs, "Blob Storage","","Static Content")
}

Container(hub, "", "Hub", "")

ac -down-> fd
out -down-> fd

fd -down-> afRw
fd -down-> afHb
fd -down-> cdn
bs -up-> cdn

afRw --> hub
asa -up-> bs

@enduml
21 changes: 21 additions & 0 deletions samples/PlantUML/associations.iuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
' from https://raw.githubusercontent.com/freezed/ocp13/master/doc/data_model/associations.iuml
/' = = = = = = = ASSOCIATION = = = = = = = '/
package "tag" {
class tag
}

package "lead" {
class contact
class contact_tag <<assoc>>
rea(tag,contact,.,contact_tag)
}

package "django.contrib.auth" {
class user
}

package "log" {
class entry
class entry_tag <<assoc>>
rea(tag,entry,.,entry_tag)
}
38 changes: 38 additions & 0 deletions samples/PlantUML/casUtilisation.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@startuml
' from https://github.com/teamflat/enflatme/blob/master/livrables/casUtilisation/casUtilisation.txt'

title Modèle d'usage\n <b>enflatme</b>
left to right direction
skinparam packageStyle rect
skinparam shadowing false

actor Visiteur as visiteur
actor Colocataire as coloc
actor :Responsable de la colocation: as respColoc
coloc <|-- respColoc

rectangle application {
(S'inscrire) as inscription
(Afficher la colocation) as afficher
(Modifier la colocation) as modifier
(Administrer la colocation) as administrer
(Modifier des tâches) as modifierTaches

(Créer une colocation) .> administrer : extends
(Supprimer une colocation) ..> administrer : extends
(Ajouter des tâches) ..> administrer : extends
(Supprimer des tâches) ..> administrer : extends

(Marquer une tâche commme complétée) .> modifier : extends
modifierTaches ..> modifier : extends
note right of modifierTaches
Exemple : indiquer qu'une tâche
ménagère a été effectuée.
end note

visiteur --> inscription
coloc --> afficher
coloc --> modifier
respColoc -> administrer
}
@enduml
139 changes: 139 additions & 0 deletions samples/PlantUML/common.iuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
' section with id user to define user actor
' from https://github.com/petersgiles/silver-octo-architecture/blob/master/content/docs/includes/common.iuml'

/'
' CUT AND PASTE INTO YOUR PUML
!include includes/common.iuml!pla_sql
!include includes/common.iuml!pla_sp
!include includes/common.iuml!pla_couch
!include includes/common.iuml!svc_ad
!include includes/common.iuml!svc_mi
!include includes/common.iuml!sys_dsuite
!include includes/common.iuml!act_user
'/

''' ACTORS

@startuml(id=act_user)
actor "Application User" <<person>> as ACT_USER
@enduml

@startuml(id=act_guest)
actor "Guest" <<function>> as ACT_GUEST
@enduml

@startuml(id=act_reader)
actor "Reader" <<function>> as ACT_READER
@enduml

@startuml(id=act_editor)
actor "Editor" <<function>> as ACT_EDITOR
@enduml

@startuml(id=act_owner)
actor "Owner" <<function>> as ACT_OWNER
@enduml

@startuml(id=act_admin)
actor "Administrator" <<function>> as ACT_ADMIN
@enduml

@startuml(id=act_aps)
actor "APS" <<person>> as ACT_APS
@enduml

@startuml(id=act_dlo)
actor "DLO" <<person>> as ACT_DLO
@enduml

@startuml(id=act_pmo)
actor "PMO" <<person>> as ACT_PMO
@enduml

@startuml(id=act_vip)
actor "VIP" <<person>> as ACT_VIP
@enduml

''' PLATFORMS

@startuml(id=sys_dsuite)
node "DSuite" <<system>> as SYS_DSUITE
@enduml

@startuml(id=pla_couch)
node "Couch DB" <<platform>> as PLA_COUCH
@enduml

@startuml(id=pla_web)
node "Web Servers" <<platform>> as PLA_WEB
@enduml

@startuml(id=pla_sp)
node "SharePoint" <<platform>> as PLA_SP
@enduml

@startuml(id=pla_sql)
node "MS SQL Server" <<platform>> as PLA_SQL
@enduml

''' SERVICES

@startuml(id=svc_mi)
component "Mobile Iron" <<service>> as SVC_MI
@enduml

@startuml(id=svc_ad)
component "Active Directory" <<service>> as SVC_AD
@enduml

@startuml(id=svc_vanguard)
component "Vanguard" <<service>> as SVC_VANGUARD
@enduml

@startuml(id=svc_couch_proxy)

node "Proxy Service" as SVC_COUCH_PROXY <<service>> {
component "Authentication Manager" as CPNT_USER_AUTH
component "Couch Proxy" as CPNT_COUCH_PROXY

CPNT_COUCH_PROXY .right. CPNT_USER_AUTH
}

@enduml

@startuml(id=svc_event_bridge)
component "Event Bridge" <<service>> as SVC_EVENT_BRIDGE
@enduml

@startuml(id=svc_event_publisher)
component "Event Publisher" <<service>> as SVC_EVENT_PUBLISHER
@enduml

@startuml(id=svc_brief_converter)
component "Brief Converter" <<service>> as SVC_BRIEF_CONVERTER
@enduml

@startuml(id=svc_esb)
queue "Enterprise Service Bus" <<esb>> as SVC_ESB
@enduml



''' APPLICATIONS

@startuml(id=app_ms_office)
component "Office" <<app>> as APP_MS_OFFICE
@enduml

@startuml(id=app_browser)
component "Web Browser" <<app>> as APP_BROWSER
@enduml

@startuml(id=app_email)
component "Email" <<app>> as APP_EMAIL
@enduml

''' NOTES
69 changes: 69 additions & 0 deletions samples/PlantUML/overview.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@startuml
' from https://github.com/Distrotech/bind10/blob/master/doc/design/datasrc/overview.txt'

hide members

note "Automatic placement of classes\ndoesn't look good. This diagram\nhas to be improved." as n1

Auth "1" *--> "*" ConfigurableClientList
Auth --> DataSourceClient
Auth --> ZoneWriter
Auth --> ZoneTableAccessor
Auth --> DataSourceStatus
Auth --> ZoneTableIterator

ConfigurableClientList "1" *--> "*" DataSourceInfo
ConfigurableClientList ..> ZoneTableSegment : <<reset>>
ConfigurableClientList ..> DataSourceStatus : <<create>>
ConfigurableClientList ..> ZoneWriter : <<create>>
ConfigurableClientList ..> ZoneTableAccessor : <<create>>

DataSourceInfo "1" *--> "*" DataSourceClient
DataSourceInfo "1" *--> "*" CacheConfig
DataSourceInfo "1" *--> "*" ZoneTableSegment

ZoneTableAccessor ..> ZoneTableIterator : <<create>>

ZoneTableAccessorCache --> CacheConfig
ZoneTableAccessorCache ..> ZoneTableIteratorCache : <<create>>
ZoneTableAccessorCache --o ZoneTableAccessor

ZoneTableIteratorCache --o ZoneTableIterator
ZoneTableIteratorCache --> CacheConfig

ZoneWriter --> ZoneTableSegment
ZoneWriter ..> ZoneData : add/replace

ZoneTableSegment "1" *--> "1" ZoneTableHeader
ZoneTableSegment "1" *--> "1" MemorySegment

CacheConfig ..> LoadAction

LoadAction ..> ZoneData : create
LoadAction *--> ZoneDataLoader

ZoneDataLoader --> ZoneData
ZoneDataLoader *--> ZoneDataUpdater
ZoneDataLoader --> MemorySegment

ZoneDataUpdater --> ZoneData
ZoneDataUpdater ..> RdataSet : create
ZoneDataUpdater ..> RdataSet : add

ZoneTableHeader "1" *--> "1" ZoneTable
ZoneTable "1" *--> "1" ZoneData
ZoneData "1" *--> "1" RdataSet

LoadFromFile --o LoadAction
IteratorLoader --o LoadAction

MemorySegmentMapped --o MemorySegment
MemorySegmentLocal --o MemorySegment

ZoneTableSegmentMapped --o ZoneTableSegment
ZoneTableSegmentLocal --o ZoneTableSegment

ZoneTableSegmentMapped *--> MemorySegmentMapped
ZoneTableSegmentLocal *--> MemorySegmentLocal

@enduml
Loading

0 comments on commit 743107d

Please sign in to comment.