~ubuntu-branches/ubuntu/karmic/calibre/karmic

« back to all changes in this revision

Viewing changes to src/calibre/ebooks/oeb/transforms/htmltoc.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-30 12:49:41 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730124941-qjdsmri25zt8zocn
Tags: 0.6.3+dfsg-0ubuntu1
* New upstream release. Please see http://calibre.kovidgoyal.net/new_in_6/
  for the list of new features and changes.
* remove_postinstall.patch: Update for new version.
* build_debug.patch: Does not apply any more, disable for now. Might not be
  necessary any more.
* debian/copyright: Fix reference to versionless GPL.
* debian/rules: Drop obsolete dh_desktop call.
* debian/rules: Add workaround for weird Python 2.6 setuptools behaviour of
  putting compiled .so files into src/calibre/plugins/calibre/plugins
  instead of src/calibre/plugins.
* debian/rules: Drop hal fdi moving, new upstream version does not use hal
  any more. Drop hal dependency, too.
* debian/rules: Install udev rules into /lib/udev/rules.d.
* Add debian/calibre.preinst: Remove unmodified
  /etc/udev/rules.d/95-calibre.rules on upgrade.
* debian/control: Bump Python dependencies to 2.6, since upstream needs
  it now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
__license__   = 'GPL v3'
7
7
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
8
8
 
9
 
import sys
10
 
import os
11
 
from lxml import etree
12
9
from calibre.ebooks.oeb.base import XML, XHTML, XHTML_NS
13
10
from calibre.ebooks.oeb.base import XHTML_MIME, CSS_MIME
14
11
from calibre.ebooks.oeb.base import element
33
30
  margin-left: 3.6em;
34
31
}
35
32
""",
36
 
   
 
33
 
37
34
    'centered': """
38
35
.calibre_toc_header {
39
36
  text-align: center;
51
48
    def __init__(self, title=None, style='nested'):
52
49
        self.title = title
53
50
        self.style = style
54
 
    
55
 
    def transform(self, oeb, context):
 
51
 
 
52
    @classmethod
 
53
    def config(cls, cfg):
 
54
        group = cfg.add_group('htmltoc', _('HTML TOC generation options.'))
 
55
        group('toc_title', ['--toc-title'], default=None,
 
56
              help=_('Title for any generated in-line table of contents.'))
 
57
        return cfg
 
58
 
 
59
    @classmethod
 
60
    def generate(cls, opts):
 
61
        return cls(title=opts.toc_title)
 
62
 
 
63
    def __call__(self, oeb, context):
56
64
        if 'toc' in oeb.guide:
57
65
            return
58
66
        if not getattr(getattr(oeb, 'toc', False), 'nodes', False):