summaryrefslogtreecommitdiff
path: root/word2org.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-08-28 23:12:10 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-08-28 23:12:10 -0400
commitf24e77857c4af0c53ac4c7db7e671c3fbf9dc67b (patch)
tree4e3f0fe3f6d0c2ab7492a06b82918d879eb7b70c /word2org.sh
A neat little weekend (well, two Fridays and a Sunday) project to 1) generate org-mode files from copy/pasted data from MS-word 2) generate Wordpress posts from such org-mode files
Diffstat (limited to 'word2org.sh')
-rwxr-xr-xword2org.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/word2org.sh b/word2org.sh
new file mode 100755
index 0000000..2aff59f
--- /dev/null
+++ b/word2org.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+export LANG='en_US.UTF-8'
+quote=''
+quote_credit=''
+block=''
+
+out=$1
+
+while read line; do
+ case "$line" in
+ '“'*) # quote
+ line="`echo "$line"|sed 's/[“”]//g'`"
+ quote="$quote $line"
+ :;;
+ '-'*) # quote-credit
+ credit="`echo "$line"|sed 's/^-//'`"
+ block="$block
+*** $credit
+ $quote"
+ quote=''
+ :;;
+ 'Reporter: '*) # reporter-credit
+ reporter="`echo "$line"|sed 's/^Reporter: //'`"
+ echo "** $reporter$block"
+ block=''
+ :;;
+ '') :;; # blank
+ *) # error
+ echo "error: \`$line'" >>/dev/stderr
+ exit 1;;
+ esac
+done