aboutsummaryrefslogtreecommitdiff
path: root/wrappers
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-03-19 18:46:57 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-03-19 18:46:57 +0000
commit91d9fffe9e70a59bf37823670d8f975179f4d001 (patch)
treea1a57f8cc03a776d864fa148ca4e409682d1dae8 /wrappers
parent1cbcaa88025c174662d0724ff1e3f2f02f631f5c (diff)
downloadpandoc-91d9fffe9e70a59bf37823670d8f975179f4d001.tar.gz
Added preliminary version of markdown2odt wrapper.
Added man page. Modified Makefile to create markdown2odt from template. Modified Makefile to create reference.odt file from files in odt-styles. Modified Makefile to install reference.odt into PACKAGEDATAPATH. Modified macports Portfile. Modified freebsd Makefile. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1259 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'wrappers')
-rw-r--r--wrappers/markdown2odt.in41
1 files changed, 41 insertions, 0 deletions
diff --git a/wrappers/markdown2odt.in b/wrappers/markdown2odt.in
new file mode 100644
index 000000000..e5b3f0212
--- /dev/null
+++ b/wrappers/markdown2odt.in
@@ -0,0 +1,41 @@
+#!/bin/sh -e
+
+REQUIRED="zip"
+SYNOPSIS="converts markdown-formatted text to ODT."
+
+### odtref.sh
+
+### common.sh
+
+### tempdir.sh
+
+if [ "$OUTPUT" = "-" ]; then
+ firstinfile="$(echo $ARGS | sed -ne '1p')"
+ firstinfilebase="${firstinfile%.*}"
+ destname="${firstinfilebase:-stdin}.odt"
+else
+ destname="$OUTPUT"
+fi
+
+(
+ cp $REFERENCEODT $THIS_TEMPDIR/new.odt
+ pandoc -s -r markdown -w opendocument "$@" -o $THIS_TEMPDIR/content.xml
+ zip -9 -j $THIS_TEMPDIR/new.odt $THIS_TEMPDIR/content.xml
+) || exit $?
+
+is_target_exists=
+if [ -f "$destname" ]; then
+ is_target_exists=1
+ mv "$destname" "$destname~"
+fi
+
+mv -f $THIS_TEMPDIR/new.odt "$destname"
+
+errn "Created $destname"
+[ -z "$is_target_exists" ] || {
+ errn " (previous file has been backed up as $destname~)"
+}
+
+err .
+
+