2022-08-22 10:42:12 +00:00
|
|
|
# PlantUML
|
2020-01-19 21:24:00 +00:00
|
|
|
|
2022-08-22 10:42:12 +00:00
|
|
|
Javascript necessary to render PlantUML from content in a html-block of class "language-uml".
|
|
|
|
|
|
|
|
> With help to get this to work on Gitea.
|
2020-01-20 06:08:21 +00:00
|
|
|
|
|
|
|
## Install
|
2022-08-22 10:42:12 +00:00
|
|
|
Copy the javascript files to your server.
|
|
|
|
Then to convert all html blocks having the class `language-uml` add the following to the html page:
|
2020-01-20 06:08:21 +00:00
|
|
|
```html
|
|
|
|
<script src="https://your-server.com/deflate.js"></script>
|
|
|
|
<script src="https://your-server.com/encode.js"></script>
|
2022-08-22 10:42:12 +00:00
|
|
|
<script src="https://your-server.com/plantuml.js"></script>
|
2020-01-20 06:08:21 +00:00
|
|
|
<script>
|
2022-08-22 10:42:12 +00:00
|
|
|
plantUML("http://www.plantuml.com/plantuml")
|
2020-01-20 06:08:21 +00:00
|
|
|
</script>
|
|
|
|
```
|
|
|
|
|
2022-08-22 10:42:12 +00:00
|
|
|
### Specifically for Gitea
|
|
|
|
|
|
|
|
Copy the javascript files to your `custom/public` folder.
|
|
|
|
Then place the following code in `custom/templates/custom/footer.tmpl`:
|
|
|
|
|
2020-01-20 06:08:21 +00:00
|
|
|
```html
|
|
|
|
<script>
|
2022-08-22 10:42:12 +00:00
|
|
|
$(async () => {
|
|
|
|
if (!$('.language-uml').length) return;
|
|
|
|
await Promise.all([
|
|
|
|
$.getScript('https://your-server.com/deflate.js'),
|
|
|
|
$.getScript('https://your-server.com/encode.js'),
|
|
|
|
$.getScript('https://your-server.com/plantuml.js'),
|
|
|
|
]);
|
|
|
|
// Replace call with address to your plantuml server
|
|
|
|
plantUML("http://www.plantuml.com/plantuml");
|
|
|
|
});
|
2020-01-20 06:08:21 +00:00
|
|
|
</script>
|
2022-08-22 10:42:12 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## How to use in GITEA
|
|
|
|
|
|
|
|
You add a normal code block with 3 backticks `` ``` `` but then add to the opening **uml** like this: `` ```uml ``
|
|
|
|
|
|
|
|
Example:
|
|
|
|
<pre>
|
|
|
|
```uml
|
|
|
|
@startuml
|
|
|
|
(*) --> "Initialization"
|
|
|
|
|
|
|
|
if "Some Test" then
|
|
|
|
-->[true] "Some Action"
|
|
|
|
--> "Another Action"
|
|
|
|
-right-> (*)
|
|
|
|
else
|
|
|
|
->[false] "Something else"
|
|
|
|
-->[Ending process] (*)
|
|
|
|
endif
|
|
|
|
|
|
|
|
@enduml
|
|
|
|
```
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
Output:
|
|
|
|
```uml
|
|
|
|
@startuml
|
|
|
|
(*) --> "Initialization"
|
|
|
|
|
|
|
|
if "Some Test" then
|
|
|
|
-->[true] "Some Action"
|
|
|
|
--> "Another Action"
|
|
|
|
-right-> (*)
|
|
|
|
else
|
|
|
|
->[false] "Something else"
|
|
|
|
-->[Ending process] (*)
|
|
|
|
endif
|
|
|
|
|
|
|
|
@enduml
|
2020-01-20 06:08:21 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## License
|
2020-01-20 17:10:12 +00:00
|
|
|
- deflate.js: Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>. Some sources claim this to be GPL-2
|
|
|
|
- encode.js: From https://plantuml.com/code-javascript-synchronous. GPL-3
|
2022-08-22 10:42:12 +00:00
|
|
|
- plantuml.js: MIT or GPL-2 or GPL-3 at your choice.
|
2020-01-20 06:08:21 +00:00
|
|
|
|