Last active
December 29, 2017 13:56
-
-
Save wknapik/d4c3c662cbc79d2739725b34e088f545 to your computer and use it in GitHub Desktop.
draw.io xml to html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# USAGE: drawioxml2html.sh diagram.xml >diagram.html | |
# html encoding from https://stackoverflow.com/questions/12873682/#answer-12873723 | |
diag="$(sed 's,.*<\(diagram [^>]*\)>\(.*\)<\(/diagram\)>.*,\1FOO\2BAR\3,g' <"$1"|\ | |
sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g'|\ | |
sed 's/&/\\&/g; s/FOO/\>/; s/BAR/\</')" | |
cat <<EOF | |
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=5,IE=9" ><![endif]--> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>diagram</title> | |
<meta charset="utf-8"/> | |
</head> | |
<body><div class="mxgraph" style="max-width:100%;border:1px solid transparent;" data-mxgraph="{"highlight":"#0000ff","nav":true,"resize":true,"toolbar":"zoom layers lightbox","edit":"_blank","xml":"<mxfile userAgent=\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\" version=\"7.3.5\" editor=\"www.draw.io\" type=\"device\"><$diag></mxfile>"}"></div> | |
<script type="text/javascript" src="https://www.draw.io/embed2.js?s=aws3;mscae/enterprise;gcp/networking;citrix&"></script> | |
</body> | |
</html> | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to generate pdf or any other format?