Шаблон:Plantuml
{{Plantuml}} — шаблон для вывода диаграмм UML, отрисованных программой PlantUML, использующий функциональность расширения MediaWiki ExternalData.
Параметры:
- или
uml
— описание диаграммы на языке PlantUML. Если в описании присутсвует знак равенства, потребуется использовать синтаксис именованного параметра (1=
илиuml=
). Если имеется символ|
, его надо заменить на{{!}}
,
id
— уникальный идентификатор диаграммы на странице. Его желательно использовать, если на странице есть другие диаграммы.
ПримерыПравить
Описание | Викитекст | Вывод |
---|---|---|
Пример 1 |
{{plantuml|id=e1|uml= @startuml
actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
collections Foo6
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity
Foo1 -> Foo5 : To database
Foo1 -> Foo6 : To collections
@enduml }} |
|
Пример 2 |
{{plantuml|id=e2|uml= @startuml
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Failure
group My own label [My own label 2]
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Log attack end
end
@enduml }} |
|
Пример 3 |
{{plantuml|id=e3|uml= @startuml
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()"
-->(*)
@enduml }} |
|
Пример 4 |
{{plantuml|id=e4|uml= 10.17 Digital Example 10 TIMING DIAGRAM
concise "Response freshness" as Cache
Server is idle
Client is idle
@Client
0 is send
Client -> Server@+25 : GET
+25 is await
+75 is recv
+25 is idle
+25 is send
Client -> Server@+25 : GET\nIf-Modified-Since: 150
+25 is await
+50 is recv
+25 is idle
@100 <-> @275 : no need to re-request from server
@Server
25 is recv
+25 is work
+25 is send
Server -> Client@+25 : 200 OK\nExpires: 275
+25 is idle
+75 is recv
+25 is send
Server -> Client@+25 : 304 Not Modified
+25 is idle
@Cache
75 is fresh
+200 is stale
@enduml
10.17 Digital Example
@startuml
scale 5 as 150 pixels
clock clk with period 1
binary "enable" as en
binary "R/W" as rw
binary "data Valid" as dv
concise "dataBus" as db
concise "address bus" as addr
@6 as :write_beg
@10 as :write_end
@15 as :read_beg
@19 as :read_end
@0
en is low
db is "0x0"
addr is "0x03f"
rw is low
dv is 0
@:write_beg-3
en is high
@:write_beg-2
db is "0xDEADBEEF"
@:write_beg-1
dv is 1
@:write_beg
rw is high
@:write_end
rw is low
dv is low
@:write_end+1
rw is low
db is "0x0"
addr is "0x23"
@12
dv is high
@13
db is "0xFFFF"
@20
en is low
dv is low
@21
db is "0x0"
highlight :write_beg to :write_end #Gold:Write
highlight :read_beg to :read_end #lightBlue:Read
db@:write_beg-1 <-> @:write_end : setup time
db@:write_beg-1 -> addr@:write_end+1 : hold
@enduml }} |
|
Пример 5 |
{{plantuml|@startuml :<latex>\int_0^1f(x)dx</latex>; :<latex>x^2+y_1+z_{12}^{34}</latex>; note right Try also <latex>\dfrac{d}{dx}f(x){{=}}\lim\limits_{h \to 0}\dfrac{f(x+h)-f(x)}{h}</latex> <latex>P(y{{!}}\mathbf{x}) \mbox{ or } f(\mathbf{x})+\epsilon</latex> end note @enduml}} |
Настройки викиПравить
Для работы шаблон требует установки расширения MediaWiki ExternalData, программы PlantUML и настроек в LocalSettings.php
:
// sudo wget https://downloads.sourceforge.net/project/plantuml/plantuml.jar -P /usr/share/java
// wget http://beta.plantuml.net/plantuml-jlatexmath.zip && sudo unzip plantuml-jlatexmath.zip -d /usr/share/java
$wgExternalDataSources['plantuml'] = [
'name' => 'PlantUML',
'program url' => 'https://plantuml.com',
'version command'=> 'java -jar /usr/share/java/plantuml.jar -version',
'command' => 'java -jar /usr/share/java/plantuml.jar -tsvg -charset UTF-8 -p',
'env' => [ 'LOG4J_FORMAT_MSG_NO_LOOKUPS' => true ],
'program limits'=> [ 'memory' => 0 ],
'input' => 'uml',
'preprocess' => 'EDConnectorExe::wikilinks4uml',
'postprocess' => 'EDConnectorExe::innerXML',
'tag' => 'plantuml'
];