2 runs in creating pdf
[librarian.git] / scripts / book2pdf
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 #
7 from librarian.book2anything import Book2Anything, Option
8 import os.path
9 from optparse import OptionParser
10
11
12 class Book2Pdf(Book2Anything):
13     format_name = "PDF"
14     ext = "pdf"
15     uses_cover = True
16     uses_provider = True
17     transform_options = [
18         Option('-t', '--save-tex', dest='save_tex', metavar='FILE',
19                 help='path to save the intermediary LaTeX file to'),
20         Option('-x', '--save-texml', dest='save_texml', metavar='FILE',
21                 help='path to save the intermediary TeXML file to'),
22         Option('-m', '--morefloats', dest='morefloats', metavar='old/new/none',
23                 help='force morefloats in old (<1.0c), new (>=1.0c) or none'),
24         Option('-R', '--resources', dest='resources', metavar='DIR',
25                 help='a directory with additional resources'),
26         Option('-D', '--documentclass', dest='documentclass', 
27                help='LaTeX document class, defaults to "wl"'),
28         Option('-s', '--customizations', dest='customizations', action='append', 
29                help='LaTeX document class options'),
30         Option('-e', '--cover-file', dest='cover_file', metavar='FILE',
31                help='Cover image file'),
32         Option('-2', '--two-runs', dest='tworuns', action='store_true', default=False,
33                help='two runs of (Xe)Latex'),
34     ]
35
36
37 if __name__ == '__main__':
38     Book2Pdf.run()