Add gdoctidy script.
authorManu Sporny <msporny@digitalbazaar.com>
Wed, 10 Jun 2015 12:15:00 -0400
changeset 739 da250feac10c
parent 738 7de692b1ddf4
child 740 d15f41ac8868
Add gdoctidy script.
latest/capabilities/gdoctidy.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latest/capabilities/gdoctidy.sh	Wed Jun 10 12:15:00 2015 -0400
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# Tidys a google doc
+#
+# To use:
+#   1. Export Google document to HTML
+#   2. Run this script on the file:
+#         ./gdoctidy.sh GoogleDoc.html
+
+OUTFILE=`basename $1 .html`-tidy.html
+
+cat $1 | \
+  sed -e 's/ id\="[^"]*"//gm' | \
+  sed -e 's/ name\="[^"]*"//gm' | \
+  sed -e 's/ class\="[^"]*"//gm' | \
+  sed -e 's/ style\="[^"]*"//gm' | \
+  sed -e 's/ start\="[^"]*"//gm' | \
+  sed -e 's/\&nbsp\;//gm' | \
+  sed -r 's/<span>([^<]*)?<\/span>/\1/gm' |
+  tidy -utf8 -i -w 80 -c --show-body-only y -o $OUTFILE
+
+echo "\n\nWrote $OUTFILE"
+