Last active
September 9, 2016 15:24
-
-
Save ohpauleez/8fce064d8813e738998d to your computer and use it in GitHub Desktop.
Capture blocks of Clojure code in the paste buffer for making Keynote presentations
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 | |
## Given a Clojure source file, 'example.clj' | |
## Where the contents are captured by START and END comments like: | |
## | |
## ;;START SomeTagName | |
## (println (inc 2)) | |
## ;;END | |
## | |
## Run this script: colorblock.sh example.clj SomeTagName | |
# Awk version | |
#awk -F "START $2" '{print $2}' RS=';;END' $1 | awk 'NF > 0' | pygmentize -f rtf -O "style=friendly,fontface=Inconsolata,fontsize=62" -l clojure | pbcopy | |
# Sed version | |
sed -n "/START $2/,/END/p" $1 | sed '1d;$d' | pygmentize -f rtf -O "style=friendly,fontface=Inconsolata,fontsize=62" -l clojure | pbcopy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a version that also works on Linux and also allows one to toggle the output format