How to use the ford.utils.sub_macros function in FORD

To help you get started, we’ve selected a few FORD examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Fortran-FOSS-Programmers / ford / ford / output.py View on Github external
def render(self,data,proj,obj):
        if data['relative']:
            base_url = ('../'*len(obj.hierarchy))[:-1]
            if obj.filename == 'index':
                if len(obj.hierarchy) > 0:
                    base_url = base_url + '/..'
                else:
                    base_url = '..'
            ford.sourceform.set_base_url(base_url)
            ford.pagetree.set_base_url(base_url)
            data['project_url'] = base_url
        template = env.get_template('info_page.html')
        obj.contents = ford.utils.sub_links(ford.utils.sub_macros(ford.utils.sub_notes(obj.contents),data['project_url']),proj)
        return template.render(data,page=obj,project=proj,topnode=obj.topnode)
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
tmp.remove('none')
                if len(tmp) == 0:
                    pass
                elif 'none' in tmp:
                    self.display = []
                elif 'public' not in tmp and 'private' not in tmp and 'protected' not in tmp:
                    pass
                else:
                    self.display = tmp
            elif len(self.meta[key]) == 1:
                self.meta[key] = self.meta[key][0]
            elif key == 'summary':
                self.meta[key] = '\n'.join(self.meta[key])
        if hasattr(self,'num_lines'): self.meta['num_lines'] = self.num_lines

        self.doc = ford.utils.sub_macros(ford.utils.sub_notes(self.doc),self.base_url)

        if 'summary' in self.meta:
            self.meta['summary'] = md.convert(self.meta['summary'])
            self.meta['summary'] = ford.utils.sub_macros(ford.utils.sub_notes(self.meta['summary']),self.base_url)
        elif PARA_CAPTURE_RE.search(self.doc):
            self.meta['summary'] = PARA_CAPTURE_RE.search(self.doc).group()
        if 'graph' not in self.meta:
            self.meta['graph'] = self.settings['graph']
        else:
            self.meta['graph'] = self.meta['graph'].lower()

        if self.obj == 'proc' or self.obj == 'type' or self.obj == 'program':
            if 'source' not in self.meta:
                self.meta['source'] = self.settings['source'].lower()
            else:
                self.meta['source'] = self.meta['source'].lower()
github Fortran-FOSS-Programmers / ford / ford / __init__.py View on Github external
project.markdown(md,'..')
    else:
        project.markdown(md,proj_data['project_url'])
    project.correlate()
    if proj_data['relative']:
        project.make_links('..')
    else:
        project.make_links(proj_data['project_url'])
    # Convert summaries and descriptions to HTML
    if proj_data['relative']: ford.sourceform.set_base_url('.')
    if 'summary' in proj_data:
        proj_data['summary'] = md.convert(proj_data['summary'])
        proj_data['summary'] = ford.utils.sub_links(ford.utils.sub_macros(ford.utils.sub_notes(proj_data['summary']),proj_data['project_url']),project)
    if 'author_description' in proj_data:
        proj_data['author_description'] = md.convert(proj_data['author_description'])
        proj_data['author_description'] = ford.utils.sub_links(ford.utils.sub_macros(ford.utils.sub_notes(proj_data['author_description']),proj_data['project_url']),project)
    proj_docs_ = ford.utils.sub_links(ford.utils.sub_macros(ford.utils.sub_notes(proj_docs),proj_data['project_url']),project)
    # Process any pages
    if 'page_dir' in proj_data:
        page_tree = ford.pagetree.get_page_tree(os.path.normpath(proj_data['page_dir']),md)
        print()
    else:
        page_tree = None
    proj_data['pages'] = page_tree

    # Produce the documentation using Jinja2. Output it to the desired location
    # and copy any files that are needed (CSS, JS, images, fonts, source files,
    # etc.)

    docs = ford.output.Documentation(proj_data,proj_docs_,project,page_tree)
    docs.writeout()
    print('')
github Fortran-FOSS-Programmers / ford / ford / __init__.py View on Github external
# Convert the documentation from Markdown to HTML. Make sure to properly
    # handle LateX and metadata.
    if proj_data['relative']:
        project.markdown(md,'..')
    else:
        project.markdown(md,proj_data['project_url'])
    project.correlate()
    if proj_data['relative']:
        project.make_links('..')
    else:
        project.make_links(proj_data['project_url'])
    # Convert summaries and descriptions to HTML
    if proj_data['relative']: ford.sourceform.set_base_url('.')
    if 'summary' in proj_data:
        proj_data['summary'] = md.convert(proj_data['summary'])
        proj_data['summary'] = ford.utils.sub_links(ford.utils.sub_macros(ford.utils.sub_notes(proj_data['summary']),proj_data['project_url']),project)
    if 'author_description' in proj_data:
        proj_data['author_description'] = md.convert(proj_data['author_description'])
        proj_data['author_description'] = ford.utils.sub_links(ford.utils.sub_macros(ford.utils.sub_notes(proj_data['author_description']),proj_data['project_url']),project)
    proj_docs_ = ford.utils.sub_links(ford.utils.sub_macros(ford.utils.sub_notes(proj_docs),proj_data['project_url']),project)
    # Process any pages
    if 'page_dir' in proj_data:
        page_tree = ford.pagetree.get_page_tree(os.path.normpath(proj_data['page_dir']),md)
        print()
    else:
        page_tree = None
    proj_data['pages'] = page_tree

    # Produce the documentation using Jinja2. Output it to the desired location
    # and copy any files that are needed (CSS, JS, images, fonts, source files,
    # etc.)
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
self.display = []
                elif 'public' not in tmp and 'private' not in tmp and 'protected' not in tmp:
                    pass
                else:
                    self.display = tmp
            elif len(self.meta[key]) == 1:
                self.meta[key] = self.meta[key][0]
            elif key == 'summary':
                self.meta[key] = '\n'.join(self.meta[key])
        if hasattr(self,'num_lines'): self.meta['num_lines'] = self.num_lines

        self.doc = ford.utils.sub_macros(ford.utils.sub_notes(self.doc),self.base_url)

        if 'summary' in self.meta:
            self.meta['summary'] = md.convert(self.meta['summary'])
            self.meta['summary'] = ford.utils.sub_macros(ford.utils.sub_notes(self.meta['summary']),self.base_url)
        elif PARA_CAPTURE_RE.search(self.doc):
            self.meta['summary'] = PARA_CAPTURE_RE.search(self.doc).group()
        if 'graph' not in self.meta:
            self.meta['graph'] = self.settings['graph']
        else:
            self.meta['graph'] = self.meta['graph'].lower()

        if self.obj == 'proc' or self.obj == 'type' or self.obj == 'program':
            if 'source' not in self.meta:
                self.meta['source'] = self.settings['source'].lower()
            else:
                self.meta['source'] = self.meta['source'].lower()
            if self.meta['source'] == 'true':
                if self.obj == 'proc':
                    obj = self.proctype.lower()
                else:
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
tmp.remove('none')
                if len(tmp) == 0:
                    pass
                elif 'none' in tmp:
                    self.display = []
                elif 'public' not in tmp and 'private' not in tmp and 'protected' not in tmp:
                    pass
                else:
                    self.display = tmp
            elif len(self.meta[key]) == 1:
                self.meta[key] = self.meta[key][0]
            elif key == 'summary':
                self.meta[key] = '\n'.join(self.meta[key])
        if hasattr(self,'num_lines'): self.meta['num_lines'] = self.num_lines

        self.doc = ford.utils.sub_macros(ford.utils.sub_notes(self.doc),self.base_url)

        if 'summary' in self.meta:
            self.meta['summary'] = md.convert(self.meta['summary'])
            self.meta['summary'] = ford.utils.sub_macros(ford.utils.sub_notes(self.meta['summary']),self.base_url)
        elif PARA_CAPTURE_RE.search(self.doc):
            if self.get_url() == None:
                # There is no stand-alone webpage for this item (e.g.,
                # an internal routine in a routine, so make the whole
                # doc blob appear, without the link to "more..."
                self.meta['summary'] = self.doc
            else:
                self.meta['summary'] = PARA_CAPTURE_RE.search(self.doc).group()
        else:
            self.meta['summary'] = ''
        if self.meta['summary'].strip() != self.doc.strip():
            self.meta['summary'] += '<a class="pull-right" href="{}">Read more…</a>'.format(self.get_url())
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
self.display = []
                elif 'public' not in tmp and 'private' not in tmp and 'protected' not in tmp:
                    pass
                else:
                    self.display = tmp
            elif len(self.meta[key]) == 1:
                self.meta[key] = self.meta[key][0]
            elif key == 'summary':
                self.meta[key] = '\n'.join(self.meta[key])
        if hasattr(self,'num_lines'): self.meta['num_lines'] = self.num_lines

        self.doc = ford.utils.sub_macros(ford.utils.sub_notes(self.doc),self.base_url)

        if 'summary' in self.meta:
            self.meta['summary'] = md.convert(self.meta['summary'])
            self.meta['summary'] = ford.utils.sub_macros(ford.utils.sub_notes(self.meta['summary']),self.base_url)
        elif PARA_CAPTURE_RE.search(self.doc):
            if self.get_url() == None:
                # There is no stand-alone webpage for this item (e.g.,
                # an internal routine in a routine, so make the whole
                # doc blob appear, without the link to "more..."
                self.meta['summary'] = self.doc
            else:
                self.meta['summary'] = PARA_CAPTURE_RE.search(self.doc).group()
        else:
            self.meta['summary'] = ''
        if self.meta['summary'].strip() != self.doc.strip():
            self.meta['summary'] += '<a class="pull-right" href="{}">Read more…</a>'.format(self.get_url())
        if 'graph' not in self.meta:
            self.meta['graph'] = self.settings['graph']
        else:
            self.meta['graph'] = self.meta['graph'].lower()