Created
February 14, 2018 13:06
-
-
Save guich-wo/c3137a52a371cacc58aac282893766f7 to your computer and use it in GitHub Desktop.
Applescript to highlight ruby code in Pages
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
# Applescript to highlight ruby code in Pages | |
# Requirements : Pygments (http://pygments.org/languages/) : pip install Pygments | |
# Tutorial: https://shomeya.com/articles/screencast-how-to-add-syntax-highlighting-to-pages-and-keynote | |
try | |
set old to the clipboard as record | |
end try | |
tell application "System Events" to keystroke "c" using command down | |
do shell script "export LC_CTYPE=UTF-8; pbpaste | /usr/local/bin/pygmentize -l ruby -f rtf -O style=default | pbcopy -Prefer rtf" | |
tell application "System Events" to keystroke "v" using command down | |
delay 0.05 | |
try | |
set the clipboard to old | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment