Support for wkhtmltopdf --dump-outline outlines
[objavi2.git] / objavi / config.py
blob85142e97865bc49d841893341fda93498f9d140c
1 # Part of Objavi2, which makes pdf versions of FLOSSManuals books.
2 # This python module contains or encapsulates configuration and
3 # constant data.
5 # Copyright (C) 2009 Douglas Bagnall
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 """This module contains constant values used to produce books.
22 """
23 #XXX eventually, read in a real config file.
24 #XXX Some of these values should be editable via an admin cgi script
26 #cgi scripts chdir here to escape htdocs
27 BASEDIR = ".."
29 #Not really configurable (72 pt per inch / 25.4 mm per inch)
30 POINT_2_MM = 25.4 / 72.0
31 MM_2_POINT = 72.0 / 25.4
32 INCH_2_POINT = 72
34 KEEP_TEMP_FILES = True
35 TMPDIR = 'htdocs/tmp'
37 LOGDIR = 'log'
38 REDIRECT_LOG = True
39 LOG_ROTATE_SIZE = 1000000
41 HTDOCS = 'htdocs'
42 BOOKI_BOOK_DIR = 'htdocs/booki-books'
43 BOOKI_BOOK_URL = '/booki-books'
45 FIREFOX = 'firefox'
46 WKHTMLTOPDF = '/usr/local/bin/wkhtmltopdf-static'
47 WKHTMLTOPDF_EXTRA_COMMANDS = []
49 #use hacked version of wkhtmltopdf that writes outline to a file
50 USE_DUMP_OUTLINE = True
51 CONTENTS_DEPTH = 1
53 HTML2ODT = 'bin/html2odt'
55 #CGITB_DOMAINS = ('203.97.236.46', '202.78.240.7')
56 CGITB_DOMAINS = False
58 #bookland is used to make isbn barcodes
59 BOOKLAND = 'bookland/bookland'
61 # how many pages to number in one pdfedit process (which has
62 # exponential memory leak)
63 PDFEDIT_MAX_PAGES = 40
65 #keep book lists around for this time without refetching
66 BOOK_LIST_CACHE = 3600 * 2
67 CACHE_DIR = 'cache'
69 #for twiki import
70 TOC_URL = "http://%s/pub/%s/_index/TOC.txt"
71 CHAPTER_URL = "http://%s/bin/view/%s/%s?skin=text"
73 PUBLISH_DIR = 'htdocs/books'
75 POLL_NOTIFY_PATH = 'htdocs/progress/%s.txt'
76 #POLL_NOTIFY_URL = 'http://%(HTTP_HOST)s/progress/%(bookname)s.txt'
78 ZIP_URLS = {
79 'TWiki': 'http://%(HTTP_HOST)s/booki-twiki-gateway.cgi?server=%(server)s&book=%(book)s&mode=zip',
80 'Booki': 'http://%(server)s/export/%(book)s/export',
81 'Archive': 'http://%(HTTP_HOST)s/espri.cgi?mode=zip&book=%(book)s',
84 DEFAULT_SERVER = 'en.flossmanuals.net'
85 DEFAULT_SIZE = 'COMICBOOK'
86 DEFAULT_ENGINE = 'webkit'
88 BOOKIZIP_MIMETYPE = "application/x-booki+zip"
90 RTL_SCRIPTS = ['persian', 'arabic', 'hebrew', 'urdu']
92 USE_CACHED_IMAGES = False
94 #Normally, Book objects try to shutdown subprocesses and clean up temp
95 #files when they __exit__. This flag makes them try when they __del__
96 #too (i.e. when they are garbage collected).
97 TRY_BOOK_CLEANUP_ON_DEL = False
99 LOCALHOST = 'localhost'
101 LANGUAGE_CSS = {
102 'en': {None: 'static/en.flossmanuals.net.css',
103 'web': 'static/en.flossmanuals.net-web.css',
104 'newspaper': 'static/en.flossmanuals.net-newspaper.css',
105 'openoffice': 'static/en.flossmanuals.net-openoffice.css',
108 'my': {None: 'static/my.flossmanuals.net.css',},
112 SERVER_DEFAULTS = {
113 'booki.flossmanuals.net': {
114 'css-book': 'static/en.flossmanuals.net.css',
115 'css-web': 'static/en.flossmanuals.net-web.css',
116 'css-newspaper': 'static/en.flossmanuals.net-newspaper.css',
117 'css-openoffice': 'static/en.flossmanuals.net-openoffice.css',
118 'lang': 'en',
119 'dir': 'LTR',
120 'toc-encoding': None,
121 'display': False,
122 'interface': 'Booki',
123 'toc_header': 'Table of Contents',
125 'booki.cc': {
126 'css-book': 'static/en.flossmanuals.net.css',
127 'css-web': 'static/en.flossmanuals.net-web.css',
128 'css-newspaper': 'static/en.flossmanuals.net-newspaper.css',
129 'css-openoffice': 'static/en.flossmanuals.net-openoffice.css',
130 'lang': 'en',
131 'dir': 'LTR',
132 'toc-encoding': None,
133 'display': False,
134 'interface': 'Booki',
135 'toc_header': 'Table of Contents',
137 'archive.org': {
138 'css-book': 'static/en.flossmanuals.net.css',
139 'css-web': 'static/en.flossmanuals.net-web.css',
140 'css-newspaper': 'static/en.flossmanuals.net-newspaper.css',
141 'css-openoffice': 'static/en.flossmanuals.net-openoffice.css',
142 'lang': 'en',
143 'dir': 'LTR',
144 'toc-encoding': None,
145 'display': False,
146 'interface': 'Archive',
147 'toc_header': 'Table of Contents',
149 LOCALHOST: {
150 'css-book': 'static/en.flossmanuals.net.css',
151 'css-web': 'static/en.flossmanuals.net-web.css',
152 'css-newspaper': 'static/en.flossmanuals.net-newspaper.css',
153 'css-openoffice': 'static/en.flossmanuals.net-openoffice.css',
154 'lang': 'en',
155 'dir': 'LTR',
156 'toc-encoding': 'iso-8859-1',
157 'display': False,
158 'interface': 'local',
159 'toc_header': 'Table of Contents',
161 'en.flossmanuals.net': {
162 'css-book': 'static/en.flossmanuals.net.css',
163 'css-web': 'static/en.flossmanuals.net-web.css',
164 'css-newspaper': 'static/en.flossmanuals.net-newspaper.css',
165 'css-openoffice': 'static/en.flossmanuals.net-openoffice.css',
166 'lang': 'en',
167 'dir': 'LTR',
168 'toc-encoding': None,
169 'display': True,
170 'interface': 'TWiki',
171 'toc_header': 'Table of Contents',
173 'fr.flossmanuals.net': {
174 'css-book': 'static/fr.flossmanuals.net.css',
175 'css-web': 'static/fr.flossmanuals.net-web.css',
176 'css-newspaper': 'static/fr.flossmanuals.net-newspaper.css',
177 'css': 'static/fr.flossmanuals.net.css',
178 'css-openoffice': 'static/fr.flossmanuals.net-openoffice.css',
179 'lang': 'fr',
180 'dir': 'LTR',
181 'toc-encoding': 'iso-8859-1',
182 'display': True,
183 'interface': 'TWiki',
184 'toc_header': 'Table of Contents',
186 'translate.flossmanuals.net': {
187 'css-book': None, #'static/translate.flossmanuals.net.css',
188 'css-web': None, #'static/translate.flossmanuals.net-web.css',
189 'css-newspaper': None, #'static/translate.flossmanuals.net-newspaper.css',
190 'css': None, #'static/translate.flossmanuals.net.css',
191 'css-openoffice': None, #'static/translate.flossmanuals.net-openoffice.css',
192 'lang': None,
193 'dir': 'auto',
194 'toc-encoding': 'iso-8859-1',
195 'display': True,
196 'interface': 'TWiki',
197 'toc_header': 'Table of Contents',
199 'nl.flossmanuals.net': {
200 'css-book': 'static/nl.flossmanuals.net.css',
201 'css-web': 'static/nl.flossmanuals.net-web.css',
202 'css-newspaper': 'static/nl.flossmanuals.net-newspaper.css',
203 'css': 'static/nl.flossmanuals.net.css',
204 'css-openoffice': 'static/nl.flossmanuals.net-openoffice.css',
205 'lang': 'nl',
206 'dir': 'LTR',
207 'toc-encoding': 'iso-8859-1',
208 'display': True,
209 'interface': 'TWiki',
210 'toc_header': 'Table of Contents',
212 'bn.flossmanuals.net': {
213 'css-book': 'static/bn.flossmanuals.net.css',
214 'css-web': 'static/bn.flossmanuals.net-web.css',
215 'css-newspaper': 'static/bn.flossmanuals.net-newspaper.css',
216 'css': 'static/bn.flossmanuals.net.css',
217 'css-openoffice': 'static/bn.flossmanuals.net-openoffice.css',
218 'lang': 'bn',
219 'dir': 'LTR',
220 'toc-encoding': 'iso-8859-1',
221 'display': True,
222 'interface': 'TWiki',
223 'toc_header': 'Table of Contents',
225 'fa.flossmanuals.net': {
226 'css-book': 'static/fa.flossmanuals.net.css',
227 'css-web': 'static/fa.flossmanuals.net-web.css',
228 'css-newspaper': 'static/fa.flossmanuals.net-newspaper.css',
229 'css': 'static/fa.flossmanuals.net.css',
230 'css-openoffice': 'static/fa.flossmanuals.net-openoffice.css',
231 'lang': 'fa',
232 'dir': 'RTL',
233 'toc-encoding': 'iso-8859-1',
234 'display': True,
235 'interface': 'TWiki',
236 'toc_header': 'Table of Contents',
240 if 'booki.cc' in SERVER_DEFAULTS:
241 SERVER_DEFAULTS['www.booki.cc'] = SERVER_DEFAULTS['booki.cc']
244 LANGUAGE_DIR = {
245 "ar": 'RTL', # arabic (many variants)
246 "dv": 'RTL', # dhivehi, maldives islands
247 "fa": 'RTL', # farsi
248 #"ha": 'RTL', # hausa, west africa, particularly niger and nigeria
249 "he": 'RTL', # hebrew
250 "ps": 'RTL', # pashto
251 "ur": 'RTL', # urdu, pakistan
252 "yi": 'RTL', # yiddish, israel
255 # uncomment a debug mode to get messages about that topic.
256 DEBUG_MODES = (
257 #'STARTUP',
258 #'INDEX',
259 #'PDFEDIT',
260 #'PDFGEN',
261 #'HTMLGEN',
263 DEBUG_ALL = False
265 #convert all sizes to points
266 PAPER_SIZES = [(s, x * MM_2_POINT, y * MM_2_POINT) for s, x, y in (
267 ("A5", 148, 210),
268 #("B5", 176, 250),
269 ("A4", 210, 297),
270 #("B4", 250, 353),
271 ("A3", 297, 420),
272 #("B3", 353, 500),
273 ("A2", 420, 594),
274 #("B2", 500, 707),
275 ("A1", 594, 841),
276 #("B1", 707, 1000),
277 ("A0", 841, 1189),
278 ("B0", 1000, 1414),
281 # margins are BASE_MARGIN + PROPORTIONAL_MARGIN * min(width, height)
282 BASE_MARGIN = 22
283 PROPORTIONAL_MARGIN = 0.04
284 # gutter is BASE_GUTTER + PROPORTIONAL_GUTTER * width
285 BASE_GUTTER = 15
286 PROPORTIONAL_GUTTER = 0.011
288 PAGE_EXTREMA = {
289 'page_width': (1, 1000, MM_2_POINT),
290 'page_height': (1, 1414, MM_2_POINT), #can't be bigger than biggest PAPER_SIZE
291 'gutter': (-1000, 1000, MM_2_POINT),
292 'top_margin': (0, 1500, MM_2_POINT),
293 'side_margin': (0, 1500, MM_2_POINT),
294 'bottom_margin': (0, 1500, MM_2_POINT),
295 "columns": (1, 12, 1),
296 "column_margin": (0, 1000, MM_2_POINT),
299 PAGE_NUMBER_SIZE = 11 #XXX this is not used by pdfedit! (ie, it is a guess)
301 PAGE_SIZE_DATA = {
302 'COMICBOOK': {'pointsize': ((6.625 * 72), (10.25 * 72)), 'class': "lulu"},
303 "POCKET": {'pointsize': (4.25 * 72, 6.875 * 72), 'class': "lulu"},
305 "USLETTER": {'pointsize': (8.5 * 72, 11 * 72), 'class': "lulu"},
306 "USTRADE": {'pointsize': (6 * 72, 9 * 72), 'class': "lulu"},
307 "LANDSCAPE9x7": {'pointsize': (9 * 72, 7 * 72), 'class': "lulu"},
308 "SQUARE7.5": {'pointsize': (7.5 * 72, 7.5 * 72), 'class': "lulu"},
309 "ROYAL": {'pointsize': (6.139 * 72, 9.21 * 72), 'class': "lulu"},
310 "CROWNQUARTO": {'pointsize': (7.444 * 72, 9.681 * 72), 'class': "lulu"},
311 "SQUARE8.5": {'pointsize': (8.5 * 72, 8.5 * 72), 'class': "lulu"},
313 "A5": {'pointsize': (148 * MM_2_POINT, 210 * MM_2_POINT), 'class': "lulu iso"},
314 "A4": {'pointsize': (210 * MM_2_POINT, 297 * MM_2_POINT), 'class': "lulu iso"},
315 "A3 (NZ Tabloid)": {'pointsize': (297 * MM_2_POINT, 420 * MM_2_POINT), 'class': 'iso newspaper'},
316 "A2 (NZ Broadsheet)": {'pointsize': (420 * MM_2_POINT, 594 * MM_2_POINT), 'class': 'iso newspaper'},
317 "A1": {'pointsize': (594 * MM_2_POINT, 841 * MM_2_POINT), 'class': 'iso'},
318 "B4": {'pointsize': (250 * MM_2_POINT, 353 * MM_2_POINT), 'class': 'iso'},
319 "B3": {'pointsize': (353 * MM_2_POINT, 500 * MM_2_POINT), 'class': 'iso'},
320 "B2": {'pointsize': (500 * MM_2_POINT, 707 * MM_2_POINT), 'class': 'iso'},
321 "B1": {'pointsize': (707 * MM_2_POINT, 1000 * MM_2_POINT), 'class': 'iso'},
323 "UK Tabloid": {'pointsize': (11 * INCH_2_POINT, 17 * INCH_2_POINT), 'class': 'newspaper'},
324 "UK Broadsheet": {'pointsize': (18 * INCH_2_POINT, 24 * INCH_2_POINT), 'class': 'newspaper'},
325 "US Broadsheet": {'pointsize': (15 * INCH_2_POINT, 22.75 * INCH_2_POINT), 'class': 'newspaper'},
326 "Berliner" : {'pointsize': (315 * MM_2_POINT, 470 * MM_2_POINT), 'class': 'newspaper'},
327 "Foolscap (F4)": {'pointsize': (210 * MM_2_POINT, 330 * MM_2_POINT)},
329 "Oamaru Broadsheet":{'pointsize': (382 * MM_2_POINT, 540 * MM_2_POINT), 'class': 'newspaper'},
330 "Oamaru Tabloid": {'pointsize': (265 * MM_2_POINT, 380 * MM_2_POINT), 'class': 'newspaper'},
332 #ODT printable 380x560
333 #Aucklander 360x260
334 #Dominion 376x540
336 "custom": {'class': "custom"},
339 MIN_COLUMN_WIDTH = (110 * MM_2_POINT)
341 ENGINES = {
342 'webkit' : [],
343 #'gecko' : [],
346 INSIDE_FRONT_COVER_TEMPLATE = 'templates/inside-front-cover.%s.html'
347 END_MATTER_TEMPLATE = 'templates/end_matter.%s.html'
349 FONT_LIST_INCLUDE = 'cache/font-list.inc'
350 FONT_LIST_URL = '/font-list.cgi.pdf'
351 FONT_EXAMPLE_SCRIPT_DIR = 'templates/font-list'
353 # for the license field, with a view to making it a drop down.
354 LICENSES = {
355 'GPL': 'http://www.gnu.org/licenses/gpl.txt',
356 'GPLv2': 'http://www.gnu.org/licenses/gpl-2.0.txt',
357 'GPLv2+': 'http://www.gnu.org/licenses/gpl-2.0.txt',
358 'GPLv3': 'http://www.gnu.org/licenses/gpl-3.0.txt',
359 'GPLv3+': 'http://www.gnu.org/licenses/gpl-3.0.txt',
360 'LGPL': 'http://www.gnu.org/licenses/lgpl.txt',
361 'LGPLv2.1': 'http://www.gnu.org/licenses/lgpl-2.1.txt',
362 'LGPLv3': 'http://www.gnu.org/licenses/lgpl-3.0.txt',
363 'BSD': 'http://www.debian.org/misc/bsd.license',
364 'public domain': None,
365 'MIT': 'http://www.opensource.org/licenses/mit-license.html',
366 'Artistic': 'http://dev.perl.org/licenses/artistic.html',
367 'CC-BY': 'http://creativecommons.org/licenses/by/3.0/',
368 'CC-BY-SA': 'http://creativecommons.org/licenses/by-sa/3.0/',
371 DEFAULT_LICENSE = 'GPLv2+'
373 CGI_MODES = { # arguments are: (publication, extension, mimetype)
374 'book': (True, '.pdf', "application/pdf"),
375 'newspaper': (True, '.pdf', "application/pdf"),
376 'web': (True, '.pdf', "application/pdf"),
377 'openoffice': (True, '.odt', "application/vnd.oasis.opendocument.text"),
378 'booklist': (False, None, None),
379 'css': (False, None, None),
380 'form': (False, None, None),
381 'epub':(True, '.epub', "application/epub+zip"),
382 'bookizip':(True, '.zip', BOOKIZIP_MIMETYPE),
385 PUBLIC_CGI_MODES = tuple(k for k, v in CGI_MODES.items() if v[0])
387 FORM_TEMPLATE = 'templates/form.html'
388 PROGRESS_ASYNC_TEMPLATE = 'templates/progress-async.html'
389 PROGRESS_TEMPLATE = 'templates/progress.html'
390 ASYNC_TEMPLATE = 'templates/async.txt'
391 ARCHIVE_TEMPLATE = 'templates/archive.txt'
392 NOWHERE_TEMPLATE = 'templates/nowhere.txt'
394 CGI_METHODS = ('sync', 'async', 'poll')
396 #used by objavi-async
397 CGI_DESTINATIONS = {
398 'archive.org': {'sync': (ARCHIVE_TEMPLATE, 'text/plain; charset=utf-8'),
399 'async': (ARCHIVE_TEMPLATE, 'text/plain; charset=utf-8'),
400 'poll': (None, None),
401 'default': 'sync',
403 'download': {'sync': (None, None),
404 'async': (ASYNC_TEMPLATE, 'text/plain; charset=utf-8'),
405 'poll': (None, None),
406 'default': 'sync',
408 'html': {'sync': (PROGRESS_TEMPLATE, 'text/html; charset=utf-8'),
409 'async': (ASYNC_TEMPLATE, 'text/plain; charset=utf-8'),
410 'poll': (PROGRESS_ASYNC_TEMPLATE, 'text/html; charset=utf-8'),
411 'default': 'sync',
413 'nowhere': {'sync': (NOWHERE_TEMPLATE, 'text/plain; charset=utf-8'),
414 'async': (NOWHERE_TEMPLATE, 'text/plain; charset=utf-8'),
415 'poll': (ASYNC_TEMPLATE, 'text/plain; charset=utf-8'),
416 'default': 'sync',
420 DEFAULT_CGI_DESTINATION = 'html'
423 FORM_INPUTS = (
424 # input, name, input type, contents key, CSS classes, extra text
425 ("server", "FLOSS Manuals server", "select", "server_options", "", ""),
426 ("book", "Manual", "select", "book_options", "", ""),
427 ("title", "Book title", "input[type=text]", None, "", ""),
428 ("license", "License", "select", "licenses", "", ""),
430 ("mode", "Document type", "select", "pdf_types", "advanced openoffice", ""),
431 ("isbn", "ISBN", "input[type=text]", None, "advanced", "(13 digits)"),
432 ("toc_header", "Table of Contents header", "input[type=text]", None, "advanced", ""),
434 ("booksize", "Page size", "select", "size_options", "advanced", '(Size compatibility: <span class="lulu">Lulu</span>, <span class="newspaper">newspapers</span>, <span class="iso">ISO standards</span>)'),
435 ("page_width", "Page width", "input[type=text]", None, "advanced booksize numeric-field", ""),
436 ("page_height", "Page height", "input[type=text]", None, "advanced booksize numeric-field", ""),
438 ("top_margin", "Top margin", "input[type=text]", None, "advanced margins numeric-field", ""),
439 ("side_margin", "Side margin", "input[type=text]", None, "advanced margins numeric-field", ""),
440 ("bottom_margin", "Bottom margin", "input[type=text]", None, "advanced margins numeric-field", ""),
441 ("gutter", "Gutter", "input[type=text]", None, "advanced margins numeric-field", ""),
443 ("columns", "Columns", "input[type=text]", None, "advanced columns numeric-field", ""),
444 ("column_margin", "Column margin", "input[type=text]", None, "advanced columns numeric-field", ""),
446 ("grey_scale", "Grey-scale", "input[type=checkbox]", 'yes', "advanced", "(for black and white printing)"),
448 #("css_customise", "Customise CSS", "input[type=checkbox]", None, "advanced", "Enter a URL or "),
449 ("css-url", "CSS URL", "input[type=text][disabled]", "css_url", "advanced css-url openoffice", ""),
450 ("font_list", "Available fonts", "ul", "font_list", "advanced css-custom openoffice", ""),
451 ("font_links", "Font examples", "ul", "font_links", "advanced css-custom openoffice", ""),
452 ("css", "CSS", "textarea", "css", "advanced css-custom openoffice", ""),
454 ("rotate", "Rotate pages for binding", "input[type=checkbox]", 'yes', "advanced", "(for RTL books on LTR printing presses, and vice versa)."),
455 #("engine", "Layout engine", "select", "engines", "advanced", ""),
456 #("header", "Header Text", "input[type=text]", None, "advanced", ""),
457 ("max-age", "Use cached data", "input[type=text]", None, "advanced numeric-field", "(younger than this many minutes)."),
458 #("destination", "Use cached data", "input[type=text]", None, "advanced", "(younger than this many minutes)."),
461 FORM_ELEMENT_TYPES = {
462 'input[type=text]' : '<input type="text" id="%(id)s" name="%(id)s" value="%(val)s" />',
463 'input[type=text][disabled]' : '<input type="text" disabled="disabled" id="%(id)s" name="%(id)s" value="%(val)s" />',
464 'input[type=checkbox]' : '<input type="checkbox" id="%(id)s" name="%(id)s" value="%(val)s" />',
465 'textarea' : '<textarea id="%(id)s" name="%(id)s">%(val)s</textarea>',
466 'select': '<select id="%(id)s" name="%(id)s">%(val)s</select>',
467 'ul': '<ul id="%(id)s">%(val)s</ul>',
470 FINISHED_MESSAGE = 'FINISHED'
472 PROGRESS_POINTS = (
473 ("start", "wake up", PUBLIC_CGI_MODES),
474 ("fetch_zip", "Load data", PUBLIC_CGI_MODES),
475 ("__init__", "Initialise the book", PUBLIC_CGI_MODES),
476 ("load_book", "Fetch the book", ('book', 'newspaper', 'web', 'openoffice')),
477 ("add_css", "Add css", ('book', 'newspaper', 'web', 'openoffice')),
478 ("add_section_titles", "Add section titles", ('book', 'newspaper', 'web', 'openoffice')),
479 ("make_epub", "Make the epub file", ('epub',)),
480 ("make_oo_doc", "Make the OpenOffice document", ('openoffice',)),
481 ("generate_pdf", "Generate the main pdf", ('book', 'newspaper', 'web')),
482 ("extract_pdf_outline", "Find page numbers", ('book',)),
483 ("reshape_pdf", "Cut pages to size", ('book', 'newspaper',)),
484 #('make_body_pdf', "Generate the main pdf", ('book', 'newspaper', 'web')),
485 ("number_pdf", "Number pages", ('book', 'newspaper',)),
486 ("make_contents", "Calculate Table of Contents", ('book',)),
487 ("make_preamble_pdf", "Generate preamble pdf", ('book',)),
488 ('make_end_matter_pdf', "Generate end matter pdf", ('book',)),
489 ("concatenated_pdfs", "concatenate the pdfs", ('book',)),
490 #("publish_pdf", "Publish the pdf", ('book', 'newspaper', 'web')),
491 (FINISHED_MESSAGE, "Finished!", PUBLIC_CGI_MODES),
494 #XML namespace stuff
495 DCNS = "{http://purl.org/dc/elements/1.1/}"
496 DC = "http://purl.org/dc/elements/1.1/"
497 FM = "http://booki.cc/"
498 XHTMLNS = '{http://www.w3.org/1999/xhtml}'
499 XHTML = 'http://www.w3.org/1999/xhtml'
501 S3_SECRET = '/home/douglas/s3.archive.org-secret'
502 S3_ACCESSKEY = '/home/douglas/s3.archive.org-accesskey'
504 #When it is necessary to creat a navpoint ID, use this string.
505 NAVPOINT_ID_TEMPLATE = 'chapter%s'
507 CLAIM_UNAUTHORED = False
509 IMG_CACHE = 'cache/images/'
511 USE_IMG_CACHE_ALWAYS_HOSTS = ['objavi.halo.gen.nz']
512 USE_ZIP_CACHE_ALWAYS_HOSTS = ['objavi.halo.gen.nz']
514 IGNORABLE_TWIKI_BOOKS = ('Main', 'TWiki', 'PR', 'Trash', 'Sandbox')
516 WHITESPACE_AND_NULL = ''.join(chr(_x) for _x in range(33))
518 #how big to let epub chapters get before splitting?
519 #sony reader has 100k compressed/300k uncompressed limit, but lets leave room to move.
520 EPUB_COMPRESSED_SIZE_MAX = 70000
521 EPUB_FILE_SIZE_MAX = 200000
523 #used to identify marker tags in html
524 MARKER_CLASS_SPLIT = "espri-marker-name-clash-with-no-one--split"
525 MARKER_CLASS_INFO = "espri-marker-name-clash-with-no-one--info"
527 if __name__ == '__main__':
528 print ', '.join(x for x in globals().keys() if not x.startswith('_'))