コード例 #1
0
    def run(self):
        if self.is_seealso:
            ret = make_admonition(addnodes.seealso, self.name, [_('See')],
                                  self.options, self.content, self.lineno,
                                  self.content_offset, self.block_text,
                                  self.state, self.state_machine)
        elif self.is_related:
            ret = make_admonition(addnodes.seealso, self.name, [_('Related')],
                                  self.options, self.content, self.lineno,
                                  self.content_offset, self.block_text,
                                  self.state, self.state_machine)
        else:
            ret = make_admonition(optional_node, self.name,
                                  self.directive_name, self.options,
                                  self.content, self.lineno,
                                  self.content_offset, self.block_text,
                                  self.state, self.state_machine)

        if self.arguments:
            argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                    self.lineno)
            para = nodes.paragraph()
            para += argnodes
            para += msgs
            ret[0].insert(1, para)
        return ret
コード例 #2
0
 def run(self):
     ad = make_admonition(youcanhelp_node, self.name, ["You Can Help!"],
                          self.options, self.content, self.lineno,
                          self.content_offset, self.block_text, self.state,
                          self.state_machine)
     ad[0].line = self.lineno
     return ad
コード例 #3
0
   def run(self):
      # noinspection PyUnresolvedReferences
      """ run
      :return:
      """
      ret = make_admonition(
         self.node_class,
         self.name,
         [self.label],
         self.options,
         self.content,
         self.lineno,
         self.content_offset,
         self.block_text,
         self.state,
         self.state_machine
      )

      if self.arguments:
         argnodes, msgs = self.state.inline_text(self.arguments[0], self.lineno)
         para = nodes.paragraph()
         para += argnodes
         para += msgs
         ret[0].insert(1, para)

      return ret
コード例 #4
0
ファイル: directives.py プロジェクト: rawfalafel/docs-tools
    def run(self):
        ret = make_admonition(related_node, self.name, [_('Related')],
                              self.options, self.content, self.lineno,
                              self.content_offset, self.block_text, self.state,
                              self.state_machine)

        return self.return_node(ret)
コード例 #5
0
    def run(self):
        env = self.state.document.settings.env
        targetid = "tag-%d" % env.new_serialno('tag')
        targetnode = nodes.target('', '', ids=[targetid])

        #the tags fetched from the custom directive are one piece of text
        #sitting in self.content[0]
        taggs = self.content[0].split(", ")
        links = []

        for tagg in taggs:
            #create rst hyperlinks of format `Python <http://www.python.org/>`_.
            link = "`" + tagg  +" <../tags/" + tagg + ".html>`_ "
            links.append(link)
        #put links back in a single comma-separated string together
        linkjoin = ", ".join(links)

        #replace content[0] with hyperlinks to display in admonition
        self.content[0] = linkjoin

        ad = make_admonition(tag, self.name, [_('Tags')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        return [targetnode] + ad
コード例 #6
0
ファイル: dbapi_extension.py プロジェクト: greeness/pyvertica
 def run(self):
     nodes = make_admonition(extension_node,
             self.name, [_('DB API extension')], self.options,
             self.content, self.lineno, self.content_offset,
             self.block_text, self.state, self.state_machine)
     nodes[0]['classes'].append('dbapi-extension')
     return nodes
コード例 #7
0
    def run(self):
        if len(self.content) == 0:
            # TODO: raise nice error that something is missing
            return

        string_vars = {
            'uid': self.content[0],
            'width': 480,
            'height': 300,
            'allowscriptaccess': 'allways',
            'allowfullscreen': 'true', }

        # TODO: need to redo this
        #for item in self.content[1:]:
        #    item = item.split('=')
        #    if len(item) == 2:
        #        key, value = item[0].strip(), item[1].strip()
        #        if key in string_vars.keys():
        #            string_vars[key] = value

        env = self.state.document.settings.env
        targetid = "bliptv-%d" % env.new_serialno('embed')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(embed, self.name, ['Todo'], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        return [targetnode] + ad
コード例 #8
0
    def run(self):
        env = self.state.document.settings.env
        targetid = "%s-%d" % (self.requirement_class,
                              env.new_serialno(self.requirement_class))
        targetnode = nodes.target('', '', ids=[targetid])

        # BUG? why is it always mandatory?
        # maybe select node type per self.requirement_class
        ad = make_admonition(mandatory, self.name, [_(self.label)],
                             self.options, self.content, self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)

        env_data_name = "rfc2119_all_%s" % self.requirement_class
        if not hasattr(env, env_data_name):
            exec("env.%s = []" % env_data_name)

        env_data = eval("env.%s" % env_data_name)
        env_data.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'rfc2119': ad[0].deepcopy(),
            'target': targetnode
        })

        return [targetnode] + ad
コード例 #9
0
ファイル: qt_doc.py プロジェクト: NopMicrowave/pyqtgraph
    def run(self):
        env = self.state.document.settings.env

        # create a new target node for linking to
        targetid = "todo-%d" % env.new_serialno("todo")
        targetnode = nodes.target("", "", ids=[targetid])

        # make the admonition node
        ad = make_admonition(
            Todo,
            self.name,
            [("Todo")],
            self.options,
            self.content,
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine,
        )

        # store a handle in a global list of all todos
        if not hasattr(env, "todo_all_todos"):
            env.todo_all_todos = []
        env.todo_all_todos.append(
            {"docname": env.docname, "lineno": self.lineno, "todo": ad[0].deepcopy(), "target": targetnode}
        )

        # return both the linking target and the node itself
        return [targetnode] + ad
コード例 #10
0
    def run(self):
        env = self.state.document.settings.env

        targetid = "req-%d" % env.new_serialno('req')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(req, self.name, [_('Requirement coverage')],
                             self.options, self.content, self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)

        if not hasattr(env, 'req_all_reqs'):
            env.req_all_reqs = []

        env.req_all_reqs.append({
            'docname': env.docname,
            'evidence': '\n'.join(self.content[-1:]),
            'section': find_parent_section_name(self.state),
            'reqid': self.content[0],
            'req': ad[0].deepcopy(),
            'target': targetnode,
        })

        if not self.options.has_key('show'):
            return [targetnode]

        return [targetnode] + ad
コード例 #11
0
ファイル: directives.py プロジェクト: rawfalafel/docs-tools
    def run(self):
        ret = make_admonition(optional_node, self.name, self.directive_name,
                              self.options, self.content, self.lineno,
                              self.content_offset, self.block_text, self.state,
                              self.state_machine)

        return self.return_node(ret)
コード例 #12
0
ファイル: tutorial.py プロジェクト: Oberon00/cpptutorial
 def _make_admonition(self, title="Task"):
     ad = make_admonition(task, self.name, [title], self.options,
                          self.content, self.lineno, self.content_offset,
                          self.block_text, self.state, self.state_machine)
     self.add_name(ad[0])
     #print(title, ad)
     return ad
コード例 #13
0
ファイル: req.py プロジェクト: Terradue/doc-tep-geohazards
    def run(self):
        env = self.state.document.settings.env

        targetid = "req-%d" % env.new_serialno('req')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(req, self.name, [_('Requirement coverage')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        if not hasattr(env, 'req_all_reqs'):
            env.req_all_reqs = []

        

        env.req_all_reqs.append({
            'docname': env.docname,
            'evidence': '\n'.join(self.content[-1:]),
            'section' : find_parent_section_name(self.state),
            'reqid' : self.content[0],
            'req': ad[0].deepcopy(),
            'target': targetnode,
        })

        if not self.options.has_key('show'):
            return [targetnode]

        return [targetnode] + ad
コード例 #14
0
    def run(self):
        env = self.state.document.settings.env
        targetid = "sphinxreportwarning-%s" % env.new_serialno( 'sphinxreportwarning' )
        # env.index_num += 1
        targetnode = nodes.target('', '', ids=[targetid])

        # this sets the formatting
        self.options["class"] = "critical"

        if len(self.arguments) > 0:
            warningclass = self.arguments[0]
        else:
            warningclass = "generic"

        ad = make_admonition(sphinxreportwarning_node, 
                             self.name, 
                             [_('SphinxreportWarning')],
                             self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        # Attach a list of all sphinxreportwarnings to the environment,
        # the sphinxreportwarninglist works with the collected sphinxreportwarning nodes
        if not hasattr(env, 'sphinxreportwarning_all_sphinxreportwarnings'):
            env.sphinxreportwarning_all_sphinxreportwarnings = []
        env.sphinxreportwarning_all_sphinxreportwarnings.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'sphinxreportwarning': ad[0].deepcopy(),
            'warningclass' : warningclass,
            'target': targetnode,
        })

        return [targetnode] + ad
コード例 #15
0
ファイル: xdirectives.py プロジェクト: xcore/xdoc
    def run(self):
        env = self.state.document.settings.env
        ad = make_admonition(newinxc, self.name, [], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)


        return ad
コード例 #16
0
    def run(self):
        env = self.state.document.settings.env

        return make_admonition(mongodoc, self.name,
                               ['See general MongoDB documentation'],
                               self.options, self.content, self.lineno,
                               self.content_offset, self.block_text,
                               self.state, self.state_machine)
コード例 #17
0
    def run(self):
        env = self.state.document.settings.env

        return make_admonition(mongodoc, self.name,
                               ['See general MongoDB documentation'],
                               self.options, self.content, self.lineno,
                               self.content_offset, self.block_text,
                               self.state, self.state_machine)
コード例 #18
0
    def run(self):
        message = IMPORT_MESSAGE.format(module=self.content[0])

        ad = make_admonition(ImportFrom, self.name, [], self.options,
                             nodes.paragraph("", message), self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)
        ad[0].line = self.lineno
        return ad
コード例 #19
0
ファイル: post.py プロジェクト: AlbertMietus/ablog
    def run(self):

        ad = make_admonition(UpdateNode, self.name, [_('Updated on')],
                             self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
        ad[0]['date'] = self.arguments[0] if self.arguments else ''
        set_source_info(self, ad[0])
        return ad
コード例 #20
0
    def run(self):
        if self.is_seealso:
            ret = make_admonition(addnodes.seealso, self.name, [_('See')], self.options,
                                  self.content, self.lineno, self.content_offset, self.block_text,
                                  self.state, self.state_machine)
        else:
            ret = make_admonition(optional_node, self.name, self.directive_name, self.options,
                                  self.content, self.lineno, self.content_offset,
                                  self.block_text, self.state, self.state_machine)

        if self.arguments:
            argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                    self.lineno)
            para = nodes.paragraph()
            para += argnodes
            para += msgs
            ret[0].insert(1, para)
        return ret
コード例 #21
0
    def run(self):

        ad = make_admonition(UpdateNode, self.name, [_('Updated on')],
                             self.options, self.content, self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)
        ad[0]['date'] = self.arguments[0] if self.arguments else ''
        set_source_info(self, ad[0])
        return ad
コード例 #22
0
ファイル: todo.py プロジェクト: APSL/django-braces
    def run(self):
        env = self.state.document.settings.env
        targetid = 'index-%s' % env.new_serialno('index')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(todo_node, self.name, [_('Todo')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
        set_source_info(self, ad[0])
        return [targetnode] + ad
コード例 #23
0
ファイル: todo.py プロジェクト: jwaterfield/echidna_env27
    def run(self):
        env = self.state.document.settings.env
        targetid = 'index-%s' % env.new_serialno('index')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(todo_node, self.name, [_('Todo')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
        set_source_info(self, ad[0])
        return [targetnode] + ad
コード例 #24
0
    def run(self):
        env = self.state.document.settings.env

        targetid = "tip-%d" % (env.new_serialno('tip'))
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(tip_node, self.name, [_('Tip')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        return [targetnode] + ad
コード例 #25
0
    def run(self):
        env = self.state.document.settings.env

        targetid = 'question-%d' % env.new_serialno('question')
        targetnode = nodes.target('', '', ids=[targetid])

        self.options['class'] = ['question']
        ad = make_admonition(question, self.name, ['Question'], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
        return [targetnode] + ad
コード例 #26
0
ファイル: yippie.py プロジェクト: rlr/fjord
    def run(self):
        env = self.state.document.settings.env

        targetid = 'yippie-%d' % env.new_serialno('yippie')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(yippie_node, self.name, [_('Yippie')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        return [targetnode] + ad
コード例 #27
0
ファイル: req.py プロジェクト: HerveCaumont/api
    def run(self):
        env = self.state.document.settings.env

        targetid = "req-%d" % env.new_serialno('req')
        targetnode = nodes.target('', '', ids=[targetid])
        sectionnode = find_parent_section_name(self.state)
        includead = True

        ads = []
        ad = None

        if sectionnode : 
            ads = sectionnode.traverse(nodes.Admonition)
        
        if len(ads) > 0 :
            ad = ads[0] 
            #pprint(ad)
            para = ad.traverse(nodes.paragraph, descend=True)
            para[0] += nodes.Text(', ' + self.content[0])   
#            pprint(para[0])
            includead = False
        else :
            #pprint(self.content)
            text = nodes.paragraph()
            text += nodes.Text("This section covers ")
            text += nodes.Text(self.content[0])
            ad = make_admonition(req, self.name, [_('Requirement coverage')], self.options,
                             text, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
            #pprint(ad)


        if not hasattr(env, 'req_all_reqs'):
            env.req_all_reqs = []

        

        env.req_all_reqs.append({
            'docname': env.docname,
            'evidence': '\n'.join(self.content[-1:]),
            'section' : sectionnode,
            'reqid' : self.content[0],
            'req': ad[0].deepcopy(),
            'target': targetnode,
        })

        if not includead:
            return [targetnode]

        if not 'show' in self.options:
            return [targetnode]

        #pprint("return all")
        return [targetnode] + ad
コード例 #28
0
 def run(self):
     ad = make_admonition(self.name, ['Autopilot Says'], self.options,
                          self.content, self.lineno, self.content_offset,
                          self.block_text, self.state, self.state_machine)
     #image_container = nodes.container()
     #image_container.append(nodes.image(uri='/images/otto-64.png'))
     #image_container['classes'] = ['otto-image-container']
     #outer_container = nodes.container()
     #outer_container.extend([image_container, ad])
     #outer_container['classes'] = ['otto-says-container']
     return [ad]
コード例 #29
0
ファイル: post.py プロジェクト: marble/ablog
    def run(self):

        ad = make_admonition(UpdateNode, self.name, [_('Updated on')],
                             self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)
            #date = datetime.strptime(date, app.config['post_date_format'])
        ad[0]['date'] = self.arguments[0] if self.arguments else ''

        set_source_info(self, ad[0])
        return ad
コード例 #30
0
    def run(self):
        message = DANGER_MESSAGE
        if self.content:
            message += DANGER_ALTERNATE.format(alternate=self.content[0])

        ad = make_admonition(Hazmat, self.name, [], self.options,
                             nodes.paragraph("", message), self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)
        ad[0].line = self.lineno
        return ad
コード例 #31
0
ファイル: codesnippet.py プロジェクト: Sahanduiuc/mdp-docs
 def run(self):
     env = self.state.document.settings.env
     link = env.docname.replace('\\', '_') + '.html'
     self.content = statemachine.StringList([SNIPTEXT % link])
     targetid = "codesnippet-%d" % env.new_serialno('codesnippet')
     targetnode = nodes.target('', '', ids=[targetid])
     ad = make_admonition(CodeSnippet, self.name, ['CodeSnippet'],
                          self.options, self.content, self.lineno,
                          self.content_offset, self.block_text, self.state,
                          self.state_machine)
     return [targetnode] + ad
コード例 #32
0
    def run(self):

        ad = make_admonition(UpdateNode, self.name, [_('Updated on')],
                             self.options, self.content, self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)
        #date = datetime.strptime(date, app.config['post_date_format'])
        ad[0]['date'] = self.arguments[0] if self.arguments else ''

        set_source_info(self, ad[0])
        return ad
コード例 #33
0
    def run(self):
        lines = (
            """The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.""",
        )
        boilerplate = statemachine.ViewList(initlist=lines)
        self.content.append(boilerplate)

        return make_admonition(rfc2119interpretation, self.name,
                               [_('RFC 2119 keywords')], self.options,
                               self.content, self.lineno, self.content_offset,
                               self.block_text, self.state, self.state_machine)
コード例 #34
0
ファイル: directives.py プロジェクト: willingc/docs-tools
    def run(self):
        self.arguments = ['instructor']

        ret = make_admonition(instructor_node, self.name, [_('Instructor Note')],
                              self.options, self.content, self.lineno, self.content_offset,
                              self.block_text, self.state, self.state_machine)

        ret[0]['expr'] = self.arguments[0]
        ret[0]['classes'] += 'note'

        return ret
コード例 #35
0
 def run(self):
     ret = make_admonition(exercise, self.name, ['Exercise'], self.options,
                           self.content, self.lineno, self.content_offset,
                           self.block_text, self.state, self.state_machine)
     if self.arguments:
         argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                 self.lineno)
         para = nodes.paragraph()
         para += argnodes
         para += msgs
         ret[0].insert(1, para)
     return ret
コード例 #36
0
ファイル: other.py プロジェクト: fedor4ever/linux_build
def seealso_directive(name, arguments, options, content, lineno,
                      content_offset, block_text, state, state_machine):
    ret = make_admonition(
        addnodes.seealso, name, [_('See also')], options, content,
        lineno, content_offset, block_text, state, state_machine)
    if arguments:
        argnodes, msgs = state.inline_text(arguments[0], lineno)
        para = nodes.paragraph()
        para += argnodes
        para += msgs
        ret[0].insert(1, para)
    return ret
コード例 #37
0
def seealso_directive(name, arguments, options, content, lineno,
                      content_offset, block_text, state, state_machine):
    ret = make_admonition(
        addnodes.seealso, name, [_('See also')], options, content,
        lineno, content_offset, block_text, state, state_machine)
    if arguments:
        argnodes, msgs = state.inline_text(arguments[0], lineno)
        para = nodes.paragraph()
        para += argnodes
        para += msgs
        ret[0].insert(1, para)
    return ret
コード例 #38
0
 def run(self):
     ret = make_admonition(optional_node, self.name, [_('Optional')], self.options,
                          self.content, self.lineno, self.content_offset,
                          self.block_text, self.state, self.state_machine)
     if self.arguments:
         argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                 self.lineno)
         para = nodes.paragraph()
         para += argnodes
         para += msgs
         ret[0].insert(1, para)
     return ret
コード例 #39
0
    def run(self):
        env = self.state.document.settings.env

        targetid = "req-%d" % env.new_serialno('req')
        targetnode = nodes.target('', '', ids=[targetid])
        sectionnode = find_parent_section_name(self.state)
        includead = True

        ads = []
        ad = None

        if sectionnode:
            ads = sectionnode.traverse(nodes.Admonition)

        if len(ads) > 0:
            ad = ads[0]
            #pprint(ad)
            para = ad.traverse(nodes.paragraph, descend=True)
            para[0] += nodes.Text(', ' + self.content[0])
            #            pprint(para[0])
            includead = False
        else:
            #pprint(self.content)
            text = nodes.paragraph()
            text += nodes.Text("This section covers ")
            text += nodes.Text(self.content[0])
            ad = make_admonition(req, self.name, [_('Requirement coverage')],
                                 self.options, text, self.lineno,
                                 self.content_offset, self.block_text,
                                 self.state, self.state_machine)
            #pprint(ad)

        if not hasattr(env, 'req_all_reqs'):
            env.req_all_reqs = []

        env.req_all_reqs.append({
            'docname': env.docname,
            'evidence': '\n'.join(self.content[-1:]),
            'section': sectionnode,
            'reqid': self.content[0],
            'req': ad[0].deepcopy(),
            'target': targetnode,
        })

        if not includead:
            return [targetnode]

        if not 'show' in self.options:
            return [targetnode]

        #pprint("return all")
        return [targetnode] + ad
コード例 #40
0
    def plot_directive(name, arguments, options, content, lineno,
                       content_offset, block_text, state, state_machine):
        env = state.document.settings.env

        targetid = "plot-%d" % env.new_serialno('plot')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(missing_plot, name,
                             [_('Install matplotlib to render this plot')],
                             options, content, lineno, content_offset,
                             block_text, state, state_machine)

        return [targetnode] + ad
コード例 #41
0
 def run(self):
     ad = make_admonition(
         youcanhelp_node,
         self.name,
         ["You Can Help!"],
         self.options,
         self.content,
         self.lineno,
         self.content_offset,
         self.block_text,
         self.state,
         self.state_machine)
     ad[0].line = self.lineno
     return ad
コード例 #42
0
    def run(self):
        title = u''
        if self.arguments:
            title += self.arguments[0]

        if 'class' in self.options:
            self.options['class'].append(self.css_class)
        else:
            self.options['class'] = [self.css_class]

        ret = make_admonition(node_class, self.name, [title], self.options,
                              self.content, self.lineno, self.content_offset,
                              self.block_text, self.state, self.state_machine)
        ret[0].attributes['name'] = self.name
        return ret
コード例 #43
0
ファイル: directives.py プロジェクト: rawfalafel/docs-tools
    def run(self):
        ret = make_admonition(
            optional_node,
            self.name,
            self.directive_name,
            self.options,
            self.content,
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine,
        )

        return self.return_node(ret)
コード例 #44
0
ファイル: directives.py プロジェクト: rawfalafel/docs-tools
    def run(self):
        ret = make_admonition(
            related_node,
            self.name,
            [_("Related")],
            self.options,
            self.content,
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine,
        )

        return self.return_node(ret)
コード例 #45
0
ファイル: d2l_local.py プロジェクト: smajkic/valence-ui-docs
    def run(self):
        ad = make_admonition(reserved, self.name, [_('Reserved')],
                             self.options, self.content, self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)

        if self.arguments:
            argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                    self.lineno)
            para = nodes.paragraph()
            para += argnodes
            para += msgs
            ad[0].insert(1, para)

        return ad
コード例 #46
0
ファイル: sql.py プロジェクト: oci1517/files-db
    def run(self):
        ''' Cette fonction doit retourner une liste de noeuds '''

        env = self.state.document.settings.env
        app = env.app

        res_nodes = []

        # ajouter l'admonition n�cessaire
        ad = make_admonition(sqlexplain, self.name, ['But de la requete'],
                             self.options, self.content, self.lineno,
                             self.content_offset, self.block_text, self.state,
                             self.state_machine)

        return ad
コード例 #47
0
 def run(self):
     ad = make_admonition(
         Hazmat,
         self.name,
         [],
         self.options,
         nodes.paragraph("", DANGER_MESSAGE),
         self.lineno,
         self.content_offset,
         self.block_text,
         self.state,
         self.state_machine
     )
     ad[0].line = self.lineno
     return ad
コード例 #48
0
ファイル: d2l_local.py プロジェクト: Shubachi/valence-ui-docs
    def run(self):
        ad = make_admonition(
            reserved, self.name, [_('Reserved')], self.options,
            self.content, self.lineno, self.content_offset, self.block_text,
            self.state, self.state_machine)

        if self.arguments:
            argnodes, msgs = self.state.inline_text(self.arguments[0],
                                                    self.lineno)
            para = nodes.paragraph()
            para += argnodes
            para += msgs
            ad[0].insert(1,para)

        return ad
コード例 #49
0
ファイル: spam.py プロジェクト: jptomo/sphinxcontrib-spam
    def run(self):
        env = self.state.document.settings.env

        ad = make_admonition(spam, self.name, [SPAM], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        spams = getattr(env, 'spam_all_spams', [])
        spams.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'spam': ad[0].deepcopy(),
        })
        print(spams)
        env.spam_all_spams = spams

        return ad
コード例 #50
0
    def run(self):
        message = IMPORT_MESSAGE.format(module=self.content[0])

        ad = make_admonition(
            ImportFrom,
            self.name,
            [],
            self.options,
            nodes.paragraph("", message),
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine
        )
        ad[0].line = self.lineno
        return ad
コード例 #51
0
ファイル: codesnippet.py プロジェクト: jheusser/mdp-docs
 def run(self):
     env = self.state.document.settings.env
     link = env.docname.replace("\\", "_") + ".html"
     self.content = statemachine.StringList([SNIPTEXT % link])
     targetid = "codesnippet-%d" % env.new_serialno("codesnippet")
     targetnode = nodes.target("", "", ids=[targetid])
     ad = make_admonition(
         CodeSnippet,
         self.name,
         ["CodeSnippet"],
         self.options,
         self.content,
         self.lineno,
         self.content_offset,
         self.block_text,
         self.state,
         self.state_machine,
     )
     return [targetnode] + ad
コード例 #52
0
    def run(self):
        message = DANGER_MESSAGE
        if self.content:
            message += DANGER_ALTERNATE.format(alternate=self.content[0])

        ad = make_admonition(
            Hazmat,
            self.name,
            [],
            self.options,
            nodes.paragraph("", message),
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine
        )
        ad[0].line = self.lineno
        return ad
コード例 #53
0
ファイル: directives.py プロジェクト: rawfalafel/docs-tools
    def run(self):
        self.arguments = ["instructor"]

        ret = make_admonition(
            instructor_node,
            self.name,
            [_("Instructor")],
            self.options,
            self.content,
            self.lineno,
            self.content_offset,
            self.block_text,
            self.state,
            self.state_machine,
        )

        ret[0]["expr"] = self.arguments[0]
        ret[0]["classes"] += "note"

        return ret
コード例 #54
0
    def run(self):
        env = self.state.document.settings.env

        targetid = "citeulike-%d" % env.new_serialno('citeulike')
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(citeulike, self.name, [_('citeulike')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        if not hasattr(env, 'citeulike_all_citeulikes'):
            env.citeulike_all_citeulikes = []
        env.citeulike_all_citeulikes.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'citeulike': ad[0].deepcopy(),
            'target': targetnode,
        })

        return [targetnode] + ad
コード例 #55
0
   def run(self):
      # noinspection PyUnresolvedReferences
      """ run
      :return:
      """
      if self.code_block_highlighter_to_check not in self.block_text:
         raise Err('PSphinxExampleCheckedAdmonition.run', [
            'Did not find required code-block directive: <{}>'.format(self.code_block_highlighter_to_check),
            '',
            ' -------------------- block_text START --------------------',
            '',
            '',
            self.block_text,
            '',
            '',
            ' -------------------- block_text END --------------------'
            ])

      ret = make_admonition(
         self.node_class,
         self.name,
         [self.label],
         self.options,
         self.content,
         self.lineno,
         self.content_offset,
         self.block_text,
         self.state,
         self.state_machine
      )

      if self.arguments:
         argnodes, msgs = self.state.inline_text(self.arguments[0], self.lineno)
         para = nodes.paragraph()
         para += argnodes
         para += msgs
         ret[0].insert(1, para)

      return ret
コード例 #56
0
ファイル: todo.py プロジェクト: gamearming/sphinxdev
    def run(self):
        env = self.state.document.settings.env

        targetid = "todo-%s" % env.index_num
        env.index_num += 1
        targetnode = nodes.target('', '', ids=[targetid])

        ad = make_admonition(todo_node, self.name, [_('Todo')], self.options,
                             self.content, self.lineno, self.content_offset,
                             self.block_text, self.state, self.state_machine)

        # Attach a list of all todos to the environment,
        # the todolist works with the collected todo nodes
        if not hasattr(env, 'todo_all_todos'):
            env.todo_all_todos = []
        env.todo_all_todos.append({
            'docname': env.docname,
            'lineno': self.lineno,
            'todo': ad[0].deepcopy(),
            'target': targetnode,
        })

        return [targetnode] + ad