Beispiel #1
0
 def run(self):
     env = self.state.document.settings.env
     modname = self.arguments[0].strip()
     noindex = 'noindex' in self.options
     env.currmodule = modname
     env.note_module(modname, self.options.get('synopsis', ''),
                     self.options.get('platform', ''), 'deprecated'
                     in self.options)
     modulenode = addnodes.module()
     modulenode['modname'] = modname
     modulenode['synopsis'] = self.options.get('synopsis', '')
     targetnode = nodes.target('',
                               '',
                               ids=['module-' + modname],
                               ismod=True)
     self.state.document.note_explicit_target(targetnode)
     ret = [modulenode, targetnode]
     if 'platform' in self.options:
         platform = self.options['platform']
         modulenode['platform'] = platform
         node = nodes.paragraph()
         node += nodes.emphasis('', _('Platforms: '))
         node += nodes.Text(platform, platform)
         ret.append(node)
     # the synopsis isn't printed; in fact, it is only used in the
     # modindex currently
     if not noindex:
         indextext = _('%s (module)') % modname
         inode = addnodes.index(entries=[('single', indextext,
                                          'module-' + modname, modname)])
         ret.insert(0, inode)
     return ret
Beispiel #2
0
def module_directive(name, arguments, options, content, lineno, content_offset,
                     block_text, state, state_machine):
    env = state.document.settings.env
    modname = arguments[0].strip()
    noindex = 'noindex' in options
    env.currmodule = modname
    env.note_module(modname, options.get('synopsis', ''),
                    options.get('platform', ''), 'deprecated' in options)
    modulenode = addnodes.module()
    modulenode['modname'] = modname
    modulenode['synopsis'] = options.get('synopsis', '')
    targetnode = nodes.target('', '', ids=['module-' + modname])
    state.document.note_explicit_target(targetnode)
    ret = [modulenode, targetnode]
    if 'platform' in options:
        modulenode['platform'] = options['platform']
        node = nodes.paragraph()
        node += nodes.emphasis('', _('Platforms: '))
        node += nodes.Text(options['platform'], options['platform'])
        ret.append(node)
    # the synopsis isn't printed; in fact, it is only used in the modindex currently
    if not noindex:
        indextext = _('%s (module)') % modname
        inode = addnodes.index(entries=[('single', indextext,
                                         'module-' + modname, modname)])
        ret.insert(0, inode)
    return ret
Beispiel #3
0
 def run(self):
     env = self.state.document.settings.env
     modname = self.arguments[0].strip()
     noindex = 'noindex' in self.options
     env.currmodule = modname
     env.note_module(modname, self.options.get('synopsis', ''),
                     self.options.get('platform', ''),
                     'deprecated' in self.options)
     modulenode = addnodes.module()
     modulenode['modname'] = modname
     modulenode['synopsis'] = self.options.get('synopsis', '')
     targetnode = nodes.target('', '', ids=['module-' + modname], ismod=True)
     self.state.document.note_explicit_target(targetnode)
     ret = [modulenode, targetnode]
     if 'platform' in self.options:
         platform = self.options['platform']
         modulenode['platform'] = platform
         node = nodes.paragraph()
         node += nodes.emphasis('', _('Platforms: '))
         node += nodes.Text(platform, platform)
         ret.append(node)
     # the synopsis isn't printed; in fact, it is only used in the
     # modindex currently
     if not noindex:
         indextext = _('%s (module)') % modname
         inode = addnodes.index(entries=[('single', indextext,
                                          'module-' + modname, modname)])
         ret.insert(0, inode)
     return ret
Beispiel #4
0
def module_directive(name, arguments, options, content, lineno,
                     content_offset, block_text, state, state_machine):
    env = state.document.settings.env
    modname = arguments[0].strip()
    noindex = 'noindex' in options
    env.currmodule = modname
    env.note_module(modname, options.get('synopsis', ''),
                    options.get('platform', ''),
                    'deprecated' in options)
    modulenode = addnodes.module()
    modulenode['modname'] = modname
    modulenode['synopsis'] = options.get('synopsis', '')
    targetnode = nodes.target('', '', ids=['module-' + modname])
    state.document.note_explicit_target(targetnode)
    ret = [modulenode, targetnode]
    if 'platform' in options:
        modulenode['platform'] = options['platform']
        node = nodes.paragraph()
        node += nodes.emphasis('Platforms: ', 'Platforms: ')
        node += nodes.Text(options['platform'], options['platform'])
        ret.append(node)
    # the synopsis isn't printed; in fact, it is only used in the modindex currently
    if not noindex:
        env.note_index_entry('single', '%s (module)' % modname,
                             'module-' + modname, modname)
    return ret