~ubuntu-branches/ubuntu/dapper/python-docutils/dapper

« back to all changes in this revision

Viewing changes to docutils/transforms/peps.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2005-12-13 13:47:41 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051213134741-fhuh5tq3n346q1oj
Tags: 0.3.9-0.1ubuntu1
Synchronize with Debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Author: David Goodger
2
2
# Contact: goodger@users.sourceforge.net
3
 
# Revision: $Revision: 1.22 $
4
 
# Date: $Date: 2004/04/23 13:48:24 $
 
3
# Revision: $Revision: 3129 $
 
4
# Date: $Date: 2005-03-26 17:21:28 +0100 (Sat, 26 Mar 2005) $
5
5
# Copyright: This module has been placed in the public domain.
6
6
 
7
7
"""
46
46
            raise DataError('Document tree is empty.')
47
47
        header = self.document[0]
48
48
        if not isinstance(header, nodes.field_list) or \
49
 
              header.get('class') != 'rfc2822':
 
49
              'rfc2822' not in header['classes']:
50
50
            raise DataError('Document does not begin with an RFC-2822 '
51
51
                            'header; it is not a PEP.')
52
52
        pep = None
149
149
        language = languages.get_language(self.document.settings.language_code)
150
150
        name = language.labels['contents']
151
151
        title = nodes.title('', name)
152
 
        topic = nodes.topic('', title, CLASS='contents')
 
152
        topic = nodes.topic('', title, classes=['contents'])
153
153
        name = nodes.fully_normalize_name(name)
154
154
        if not self.document.has_name(name):
155
 
            topic['name'] = name
 
155
            topic['names'].append(name)
156
156
        self.document.note_implicit_target(topic)
157
157
        pending = nodes.pending(parts.Contents)
158
158
        topic += pending
244
244
        node.parent.replace(node, mask_email(node))
245
245
 
246
246
    def visit_field_list(self, node):
247
 
        if node.hasattr('class') and node['class'] == 'rfc2822':
 
247
        if 'rfc2822' in node['classes']:
248
248
            raise nodes.SkipNode
249
249
 
250
250
    def visit_tgroup(self, node):
254
254
    def visit_colspec(self, node):
255
255
        self.entry += 1
256
256
        if self.pep_table and self.entry == 2:
257
 
            node['class'] = 'num'
 
257
            node['classes'].append('num')
258
258
 
259
259
    def visit_row(self, node):
260
260
        self.entry = 0
262
262
    def visit_entry(self, node):
263
263
        self.entry += 1
264
264
        if self.pep_table and self.entry == 2 and len(node) == 1:
265
 
            node['class'] = 'num'
 
265
            node['classes'].append('num')
266
266
            p = node[0]
267
267
            if isinstance(p, nodes.paragraph) and len(p) == 1:
268
268
                text = p.astext()