Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if len(project.files) < 1:
print("Error: No source files with appropriate extension found in specified directory.")
sys.exit(1)
# 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
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)
def render(self,data,proj,obj):
if data['relative']:
data['project_url'] = '..'
ford.sourceform.set_base_url('..')
ford.pagetree.set_base_url('..')
template = env.get_template('prog_list.html')
return template.render(data,project=proj)
def make_links(self,base_url='..'):
"""
Substitute intrasite links to documentation for other parts of
the program.
"""
ford.sourceform.set_base_url(base_url)
for src in self.allfiles:
src.make_links(self)
def render(self,data,proj,obj):
if data['relative']:
data['project_url'] = '.'
ford.sourceform.set_base_url('.')
ford.pagetree.set_base_url('.')
template = env.get_template('search.html')
return template.render(data,project=proj)
def markdown(self,md,base_url='..'):
"""
Process the documentation with Markdown to produce HTML.
"""
print("\nProcessing documentation comments...")
ford.sourceform.set_base_url(base_url)
if self.settings['warn'].lower() == 'true': print()
for src in self.allfiles:
src.markdown(md, self)
def render(self,data,proj,obj):
if data['relative']:
data['project_url'] = '..'
ford.sourceform.set_base_url('..')
ford.pagetree.set_base_url('..')
template = env.get_template('file_list.html')
return template.render(data,project=proj)