Created
January 31, 2016 19:22
-
-
Save kiurchv/c2fcbf066c539db3d4a8 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
cat > delimiter.rtf <<EOF | |
{\\rtf1\\ansi\\ansicpg1251\\cocoartf1344\\cocoasubrtf360 | |
{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;} | |
{\\colortbl;\\red255\\green255\\blue255;} | |
\\paperw11900\\paperh16840\\margl1440\\margr1440\\vieww10800\\viewh8400\\viewkind0 | |
\\pard\\tx566\\tx1133\\tx1700\\tx2267\\tx2834\\tx3401\\tx3968\\tx4535\\tx5102\\tx5669\\tx6236\\tx6803\\pardirnatural | |
\\f0\\fs24 \\cf0 \\ | |
} | |
EOF | |
for filename in $(find . -name '*.rb'); do | |
cat > head.rtf <<EOF | |
{\\rtf1\\ansi\\ansicpg1251\\cocoartf1344\\cocoasubrtf360 | |
{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;\\f1\\fnil\\fcharset0 MesloLGS-RegularForPowerline;} | |
{\\colortbl;\\red255\\green255\\blue255;} | |
\\paperw11900\\paperh16840\\margl1440\\margr1440\\vieww10800\\viewh8400\\viewkind0 | |
\\pard\\tx566\\tx1133\\tx1700\\tx2267\\tx2834\\tx3401\\tx3968\\tx4535\\tx5102\\tx5669\\tx6236\\tx6803\\pardirnatural | |
\\f0\\fs24 \\cf0 \\ | |
\\pard\\tx566\\tx1133\\tx1700\\tx2267\\tx2834\\tx3401\\tx3968\\tx4535\\tx5102\\tx5669\\tx6236\\tx6803\\pardirnatural | |
\\f1 \\cf0 $filename\\ | |
\\ | |
} | |
EOF | |
pygmentize -f rtf -O 'fontface = Meslo LG S for Powerline' $filename > body.rtf | |
textutil -cat rtf head.rtf body.rtf -output tmp.rtf | |
test -f source.rtf && textutil -cat rtf source.rtf delimiter.rtf tmp.rtf -output source.rtf | |
! (test -f source.rtf) && mv tmp.rtf source.rtf | |
done | |
rm delimiter.rtf head.rtf body.rtf tmp.rtf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment