Skip to content

Instantly share code, notes, and snippets.

@palashkulsh
Last active September 4, 2022 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palashkulsh/190219a4f7f7dc4d7e29c5bbe2a26e35 to your computer and use it in GitHub Desktop.
Save palashkulsh/190219a4f7f7dc4d7e29c5bbe2a26e35 to your computer and use it in GitHub Desktop.
org file to plantuml mindmap or work break down structure wbs diagram creator
#!/bin/bash
#identify is part of imagemagick suite
echo "@startmindmap" > /tmp/.org2file.uml
cat $1 >> /tmp/.org2file.uml
echo "@endmindmap" >> /tmp/.org2file.uml
#if -DPLANTUML_LIMIT_SIZE=18192 is not provided then image gets cropped off
java -jar /home/palashkulshreshtha/bin/plantuml.jar -DPLANTUML_LIMIT_SIZE=18192 -o /tmp/ /tmp/.org2file.uml
dimensions=`identify /tmp/.org2file.png | awk '{print $3}'`
width=`echo $dimensions |awk 'BEGIN{FS="x"}{print $1}'`
height=`echo $dimensions | awk 'BEGIN{FS="x"}{print $2}'`
echo '
<!DOCTYPE html>
<html>
<head>
<style>
.bg {
background-image: url("/tmp/.org2file.png");
width: '$width'px;
height: '$height'px;
background-position: top center;
background-repeat: no-repeat;
background-size: contain;
}
</style>
</head>
<div class="bg"></div>' > /tmp/org2file.html
chromium-browser /tmp/org2file.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment