Skip to content

Commit

Permalink
Example of usage with Tcl (#1349)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Grossetie <ggrossetie@yuzutech.fr>
  • Loading branch information
torstenberg and ggrossetie authored Oct 21, 2022
1 parent e5d43a2 commit f363d32
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/modules/setup/pages/encode-diagram.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
:uri-gh-pako: https://github.com/nodeca/pako
:uri-mdn-textencoder: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder
:uri-mdn-textencoder-browser-compat: {uri-mdn-textencoder}#Browser_compatibility
:uri-dia2kroki: https://wiki.tcl-lang.org/page/dia2kroki

When using GET requests, your diagram must be encoded in the URL using a deflate + base64 algorithm.
On this page you will learn how to encode a diagram using:
Expand All @@ -13,6 +14,7 @@ On this page you will learn how to encode a diagram using:
- xref:kotlin[]
- xref:go[]
- xref:php[]
- xref:tcl[]
[#nodejs]
== Node.js
Expand Down Expand Up @@ -139,3 +141,14 @@ include::example$encode.go[]
----
include::example$encode.php[]
----

[#tcl]
== Tcl

[source,tcl]
----
# assuming the diagram code is stored in the variable named `diagramSource`:
puts [string map {+ - / _} [binary encode base64 [zlib compress $diagramSource]]]
----

Also, see the Tcl package {uri-dia2kroki}[dia2kroki] which has procedures to both decode and encode the diagram source code and a GUI to create diagrams with a live preview.

0 comments on commit f363d32

Please sign in to comment.