Last active
June 18, 2018 05:29
-
-
Save gentam/5f47198f64f59d5193cd138b13e7b165 to your computer and use it in GitHub Desktop.
format codes to be included in reStructuredText
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 | |
[ $# -eq 0 ] && echo "Usage: `basename $0` [filename | *].extention [...]" \ | |
&& exit 1 | |
for f in $@; do | |
ext=${f##*.} | |
echo -e "$f\n\n.. code:: $ext" | |
echo | |
cat $f \ | |
| sed -e '/^\/\//d' \ | |
| awk '{print " " $0}' \ | |
| sed -e '1d' -e '$a\\n' \ | |
| tr -d ' | |
' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment