trlcdoc.plantuml_client ======================= .. py:module:: trlcdoc.plantuml_client .. autoapi-nested-parse:: 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 [PlantUML options, e.g. -pipe -tsvg] Attributes ---------- .. autoapisummary:: trlcdoc.plantuml_client.BASE64_CHARS trlcdoc.plantuml_client.PLANTUML_CHARS trlcdoc.plantuml_client.RENDER_TIMEOUT Functions --------- .. autoapisummary:: trlcdoc.plantuml_client.encode_diagram trlcdoc.plantuml_client.file_format trlcdoc.plantuml_client.main Module Contents --------------- .. py:data:: BASE64_CHARS :value: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' .. py:data:: PLANTUML_CHARS :value: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_' .. py:data:: RENDER_TIMEOUT :value: 60 .. py:function:: encode_diagram(text: str) -> str Encode a diagram for the URL of a PlantUML server. :param text: PlantUML diagram source. :type text: str :returns: The diagram, compressed with deflate and encoded with the PlantUML base64 alphabet. :rtype: str .. py:function:: file_format(options: list[str]) -> str Get the image format from the PlantUML command line options. :param options: PlantUML options, e.g. ['-pipe', '-tsvg'] or ['-tlatex:nopreamble']. :type options: list[str] :returns: The format, png if no -t option is given, as with the jar. :rtype: str .. py:function:: main(argv: list[str] | None = None) -> int Read a diagram from stdin, render it with the PlantUML server and write the image to stdout. :param argv: Server URL and PlantUML options, defaults to sys.argv[1:]. :type argv: list[str] | None :returns: 0 on success, 1 if the server reports a diagram error or cannot be reached. :rtype: int