working copy epub flag
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 28 Mar 2012 13:44:30 +0000 (15:44 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 28 Mar 2012 13:44:30 +0000 (15:44 +0200)
librarian/epub.py
librarian/epub/xsltTitle.xsl
scripts/book2epub

index 80941eb..5481516 100644 (file)
@@ -292,7 +292,7 @@ def transform(wldoc, verbose=False,
 
     sample=n: generate sample e-book (with at least n paragraphs)
     cover: a cover.Cover object or True for default
-    flags: less-advertising, without-fonts
+    flags: less-advertising, without-fonts, working-copy
     """
 
     def transform_file(wldoc, chunk_counter=1, first=True, sample=None):
index 74ef64a..17739a8 100644 (file)
 
           <xsl:call-template name="translators" />
 
+          <xsl:if test="utwor/@working-copy">
+            <p class="info">[Kopia robocza]</p>
+          </xsl:if>
+
           <xsl:if test="not(utwor/@less-advertising)">
             <p class="info">
               <a>
index bdb5ac6..e60b932 100755 (executable)
@@ -22,6 +22,8 @@ if __name__ == '__main__':
         help='print status messages to stdout')
     parser.add_option('-c', '--with-cover', action='store_true', dest='with_cover', default=False,
                       help='create default cover')
+    parser.add_option('-w', '--working-copy', action='store_true', dest='working_copy', default=False,
+                      help='specifies the directory for output')
     parser.add_option('-d', '--make-dir', action='store_true', dest='make_dir', default=False,
                       help='create a directory for author and put the PDF in it')
     parser.add_option('-o', '--output-file', dest='output_file', metavar='FILE',
@@ -35,6 +37,10 @@ if __name__ == '__main__':
         parser.print_help()
         exit(1)
 
+    flags = []
+    if options.working_copy:
+        flags.append('working-copy')
+
     # Do some real work
     try:
         for main_input in input_filenames:
@@ -49,7 +55,7 @@ if __name__ == '__main__':
                 output_file = None
 
             doc = WLDocument.from_file(main_input, provider=provider)
-            epub = doc.as_epub(cover=options.with_cover)
+            epub = doc.as_epub(cover=options.with_cover, flags=flags)
 
             doc.save_output_file(epub,
                 output_file, options.output_dir, options.make_dir, 'epub')