[Python-modules-commits] [python-odf] 77/118: Make it possible to specify the output file

Wolfgang Borgert debacle at moszumanska.debian.org
Fri Oct 3 21:27:25 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to reference refs/remotes/upstream/master
in repository python-odf.

commit a6a2b3725ab59b8abee27422228197d2dfb05ef7
Author: Søren Roug <soren.roug at eea.europa.eu>
Date:   Mon Mar 22 22:01:26 2010 +0000

    Make it possible to specify the output file
---
 contrib/odf2epub/odf2epub     | 18 +++++++++++-------
 contrib/odf2epub/odf2epub.1   |  9 +++++++--
 contrib/odf2epub/odf2epub.xml | 11 ++++++++++-
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/contrib/odf2epub/odf2epub b/contrib/odf2epub/odf2epub
index f3bbe6b..fb02b51 100755
--- a/contrib/odf2epub/odf2epub
+++ b/contrib/odf2epub/odf2epub
@@ -153,25 +153,29 @@ class EPublication:
         outputfp.close()
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], "e", ["plain"])
+    opts, args = getopt.getopt(sys.argv[1:], "po:", ["plain","output"])
 except getopt.GetoptError:
     usage()
     sys.exit(2)
 
 generatecss = True
 embedable = False
+outputfilename = "-"
+
 for o, a in opts:
     if o in ("-p", "--plain"):
         generatecss = False
+    if o in ("-o", "--output"):
+        outputfilename = a
 
 if len(args) != 1:
     usage()
     sys.exit(2)
 
-#try:
-epub = EPublication(args[0])
-epub.save("test.epub")
-#except:
-#    sys.stderr.write("Unable to open file %s or file is not OpenDocument\n" % sys.argv[1])
-#    sys.exit(1)
+try:
+    epub = EPublication(args[0])
+    epub.save(outputfilename)
+except:
+    sys.stderr.write("Unable to open file %s or file is not OpenDocument\n" % sys.argv[1])
+    sys.exit(1)
 
diff --git a/contrib/odf2epub/odf2epub.1 b/contrib/odf2epub/odf2epub.1
index 6cd9d53..20b47c7 100644
--- a/contrib/odf2epub/odf2epub.1
+++ b/contrib/odf2epub/odf2epub.1
@@ -22,11 +22,11 @@
 odf2epub \- Convert ODF to an ePub ebook
 .SH "SYNOPSIS"
 .HP \w'\fBodf2epub\fR\ 'u
-\fBodf2epub\fR [\-p] \fIpath\fR
+\fBodf2epub\fR [\-p] [\-o\ \fIoutputfile\fR] \fIpath\fR
 .SH "DESCRIPTION"
 .PP
 \fBodf2epub\fR
-is a program that will create an ebook (\&.epub) from the input file and will write the webpage to stdout\&.
+is a program that will create an ebook (\&.epub) from the input file and will write the ebook to stdout or a file specified by \-o\&.
 .PP
 "Path" is assumed to be an OpenDocument file of text, spreadsheet or presentation type\&.
 .SH "OPTIONS"
@@ -35,6 +35,11 @@ is a program that will create an ebook (\&.epub) from the input file and will wr
 .RS 4
 The \-p flag will generate HTML without CSS\&.
 .RE
+.PP
+\-o, \-\-output
+.RS 4
+Specify the output file with this flag\&. "\-" implies standard out\&.
+.RE
 .SH "EXAMPLE"
 .sp
 .if n \{\
diff --git a/contrib/odf2epub/odf2epub.xml b/contrib/odf2epub/odf2epub.xml
index abe9e75..40cb65b 100644
--- a/contrib/odf2epub/odf2epub.xml
+++ b/contrib/odf2epub/odf2epub.xml
@@ -20,6 +20,7 @@
     <cmdsynopsis>
       <command>odf2epub</command>
       <arg choice="opt">-p </arg>
+      <arg choice="opt">-o <replaceable>outputfile</replaceable></arg>
       <arg choice="plain">
         <replaceable>path</replaceable>
       </arg>
@@ -28,7 +29,7 @@
   <refsect1>
     <title>Description</title>
     <para><command>odf2epub</command> is a program that will create 
-an ebook (.epub) from the input file and will write the webpage to stdout.
+an ebook (.epub) from the input file and will write the ebook to stdout or a file specified by -o.
 </para>
     <para>
 "Path" is assumed to be an
@@ -47,6 +48,14 @@ The -p flag will generate HTML without CSS.
 </para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term>-o, --output</term>
+        <listitem>
+          <para>
+Specify the output file with this flag. "-" implies standard out.
+</para>
+        </listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-odf.git



More information about the Python-modules-commits mailing list