Skip to content

Instantly share code, notes, and snippets.

@munky69rock
Last active December 12, 2015 00:09
Show Gist options
  • Select an option

  • Save munky69rock/4682111 to your computer and use it in GitHub Desktop.

Select an option

Save munky69rock/4682111 to your computer and use it in GitHub Desktop.
convert html to haml
#!/bin/sh
# http://html2haml.heroku.com/
set -ue
if [ $# -ne 1 -o ! -e "$1" ]; then
echo "Usage: $0 [path] ";
exit
fi
cat $1 | curl -F 'page[html]=<-' http://html2haml.heroku.com/ 2>/dev/null | grep 'page\[haml\]' | perl -pe "s#^.*<textarea id='page_haml' name='page\[haml\]'>(.*)</textarea>.*\$#\$1#; s/&#x000A;/\n/g;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment