91d9fffe9e
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
41 lines
794 B
Bash
41 lines
794 B
Bash
#!/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 .
|
|
|
|
|