trlcdoc.plantuml_client
Render a PlantUML diagram with a PlantUML server, as plantuml -pipe does with the jar.
sphinxcontrib-plantuml can only run a command: it passes the diagram on stdin and expects the image on stdout. This module is that command for a PlantUML server. It is started for every diagram, so it imports only what it needs.
Usage: python -m trlcdoc.plantuml_client <server URL> [PlantUML options, e.g. -pipe -tsvg]
Attributes
Functions
|
Encode a diagram for the URL of a PlantUML server. |
|
Get the image format from the PlantUML command line options. |
|
Read a diagram from stdin, render it with the PlantUML server and write the image to stdout. |
Module Contents
- trlcdoc.plantuml_client.BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
- trlcdoc.plantuml_client.PLANTUML_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'
- trlcdoc.plantuml_client.RENDER_TIMEOUT = 60
- trlcdoc.plantuml_client.encode_diagram(text: str) str[source]
Encode a diagram for the URL of a PlantUML server.
- Parameters:
text (str) – PlantUML diagram source.
- Returns:
The diagram, compressed with deflate and encoded with the PlantUML base64 alphabet.
- Return type:
str
- trlcdoc.plantuml_client.file_format(options: list[str]) str[source]
Get the image format from the PlantUML command line options.
- Parameters:
options (list[str]) – PlantUML options, e.g. [‘-pipe’, ‘-tsvg’] or [‘-tlatex:nopreamble’].
- Returns:
The format, png if no -t option is given, as with the jar.
- Return type:
str
- trlcdoc.plantuml_client.main(argv: list[str] | None = None) int[source]
Read a diagram from stdin, render it with the PlantUML server and write the image to stdout.
- Parameters:
argv (list[str] | None) – Server URL and PlantUML options, defaults to sys.argv[1:].
- Returns:
0 on success, 1 if the server reports a diagram error or cannot be reached.
- Return type:
int