Wrap gallery code for standalone compilation

closes #59
Merge pull request #60 from diagrams/gallery-wrap

Wrap gallery code for standalone compilation