Ejemplo n.º 1
0
    def code(self, repo_url):
        """
        Return the GitHub/GitLab address for editing the markdown file.

        Args:
          repo_url[str]: Web address to use as the base for creating the edit link
        """
        info = []
        for key, syntax in self.__syntax.iteritems():
            for obj in syntax.objects().itervalues():
                if obj.name == self.name():
                    info.append(obj)
            for obj in syntax.actions().itervalues():
                if obj.name == self.name():
                    info.append(obj)

        output = []
        for obj in info:
            for filename in obj.code:
                rel_filename = MooseDocs.relpath(filename)
                output.append((os.path.basename(rel_filename),
                               os.path.join(repo_url, 'blob', 'master',
                                            rel_filename)))

        return output
Ejemplo n.º 2
0
    def __init__(self, repo=None, links=None, **kwargs):
        self._repo = repo
        self.inputs = collections.OrderedDict()
        self.children = collections.OrderedDict()

        for key, paths in links.iteritems():
            self.inputs[key] = dict()
            self.children[key] = dict()

            for path in paths:
                for base, _, files in os.walk(MooseDocs.abspath(path),
                                              topdown=False):
                    for filename in files:
                        full_name = os.path.join(base, filename)
                        rel_name = MooseDocs.relpath(full_name)
                        if filename.endswith('.i'):
                            self.search(full_name, self.INPUT_RE,
                                        self.inputs[key])
                        elif filename.endswith('.h'):
                            self.search(full_name, self.HEADER_RE,
                                        self.children[key])
Ejemplo n.º 3
0
    def _code(self, repo_url):
        """
        Return the GitHub/GitLab addresses for the associated C/h files.

        Args:
          repo_url[str]: Web address to use as the base for creating the edit link
        """
        info = []
        for syntax in self._syntax.itervalues():
            for obj in syntax.objects().itervalues():
                if obj.name == self.node.name():
                    info.append(obj)
            for obj in syntax.actions().itervalues():
                if obj.name == self.node.name():
                    info.append(obj)

        output = []
        for obj in info:
            for filename in obj.code:
                rel_filename = MooseDocs.relpath(filename)
                output.append((os.path.basename(rel_filename),
                               os.path.join(repo_url, 'blob', 'master', rel_filename)))

        return output
Ejemplo n.º 4
0
 def editMarkdown(self, repo_url):
     """
     Return the url to the markdown file for this object.
     """
     return os.path.join(repo_url, 'edit', 'devel',
                         MooseDocs.relpath(self.source()))
Ejemplo n.º 5
0
 def __init__(self, filename, repo):
     self.filename = MooseDocs.relpath(filename).lstrip('/')
     self.remote = '{}/{}'.format(repo.rstrip('/'), self.filename)
Ejemplo n.º 6
0
 def _editMarkdown(self, repo_url):
     """
     Return the url to the markdown file for this object.
     """
     return os.path.join(repo_url, 'edit', 'devel', MooseDocs.relpath(self.node.source()))
Ejemplo n.º 7
0
 def __init__(self, filename, repo):
     self.filename = MooseDocs.relpath(filename).lstrip('/')
     self.remote = '{}/{}'.format(repo.rstrip('/'), self.filename)