|
7 | 7 | import natsort |
8 | 8 | import re |
9 | 9 |
|
10 | | -parser = argparse.ArgumentParser(description='Export book to PDF') |
| 10 | +parser = argparse.ArgumentParser(description='Export book') |
11 | 11 | parser.add_argument("-ch", type=int, help="Chapter to export", default="99") |
| 12 | +parser.add_argument("-pdf", help="Export for PDF print", action="store_true", default=False) |
12 | 13 | parser.add_argument("-paperback", help="Export for paperback print", action="store_true", default=False) |
13 | 14 | parser.add_argument("-kindle", help="Export the kindle version", action="store_true", default=False) |
14 | 15 | parser.add_argument("-v", help="verbose", action="store_true", default=False) |
@@ -58,13 +59,16 @@ def get_list_of_files(path, extension): |
58 | 59 | pandoc_cmd = pandoc_cmd + "-V geometry:top=1.5cm " |
59 | 60 | pandoc_cmd = pandoc_cmd + "-V geometry:bottom=1.5cm " |
60 | 61 | pandoc_cmd = pandoc_cmd + "-V fontsize:12pt " |
61 | | -else: |
62 | | - pandoc_cmd = pandoc_cmd + "--include-before-body cover.tex " |
| 62 | +elif args.pdf: |
| 63 | + #pandoc_cmd = pandoc_cmd + "--include-before-body cover.tex " |
| 64 | + pandoc_cmd = pandoc_cmd + "-V classoption=twoside " |
| 65 | + pandoc_cmd = pandoc_cmd + "-V geometry:paperwidth=169.90mm " |
| 66 | + pandoc_cmd = pandoc_cmd + "-V geometry:paperheight=244.10mm " |
63 | 67 | pandoc_cmd = pandoc_cmd + "-V geometry:left=2cm " |
64 | 68 | pandoc_cmd = pandoc_cmd + "-V geometry:right=2cm " |
65 | 69 | pandoc_cmd = pandoc_cmd + "-V geometry:top=2cm " |
66 | 70 | pandoc_cmd = pandoc_cmd + "-V geometry:bottom=2cm " |
67 | | - pandoc_cmd = pandoc_cmd + "-V fontsize:10pt " |
| 71 | + pandoc_cmd = pandoc_cmd + "-V fontsize:8pt " |
68 | 72 |
|
69 | 73 | pandoc_cmd = pandoc_cmd + "--filter pandoc-fignos --filter pandoc-tablenos --filter pandoc-crossref --natbib -o book.tex metadata.txt " |
70 | 74 |
|
@@ -102,7 +106,7 @@ def get_list_of_files(path, extension): |
102 | 106 | addTabularnewlineTablePerfMetrics = False |
103 | 107 | for line in lines: |
104 | 108 | # change font size in listings for paperback |
105 | | - if (args.paperback or args.kindle) and "basicstyle=\\ttfamily," in line: |
| 109 | + if (args.paperback or args.kindle or args.pdf) and "basicstyle=\\ttfamily," in line: |
106 | 110 | g.write(line.replace("basicstyle=\\ttfamily,", "basicstyle=\\lst@ifdisplaystyle\\footnotesize\\fi\\ttfamily,")) |
107 | 111 | # workaround for citations and bibliography |
108 | 112 | elif "\\usepackage[]{natbib}" in line: |
|
0 commit comments