ford._markdown module#

class ford._markdown.AliasExtension(**kwargs)#

Bases: Extension

Markdown extension to register AliasPreprocessor

extendMarkdown(md)#

Add the various processors and patterns to the Markdown Instance.

This method must be overridden by every extension.

Keyword arguments:

  • md: The Markdown instance.

class ford._markdown.AliasPreprocessor(md, aliases)#

Bases: Preprocessor

Substitute text aliases of the form |foo| from a dictionary of aliases and their replacements. The backslash \ acts as an escape character, aliases of the form \|foo| will not be replaced, but instead copied verbatim without the preceding backslash.

ALIAS_RE = re.compile('(?<!\\\\)\\|([^ ].*?[^ ]?)\\|')#
run(lines)#

Each subclass of Preprocessor should override the run method, which takes the document as a list of strings split by newlines and returns the (possibly modified) list of lines.

Return type:

List[str]

class ford._markdown.FordLinkExtension(**kwargs)#

Bases: Extension

Markdown extension to register FordLinkProcessor

extendMarkdown(md)#

Add the various processors and patterns to the Markdown Instance.

This method must be overridden by every extension.

Keyword arguments:

  • md: The Markdown instance.

class ford._markdown.FordLinkProcessor(md, project)#

Bases: InlineProcessor

Replace links to different parts of the program, formatted as [[name]] or [[name(object-type)]] with the appropriate URL. Can also link to an item’s entry in another’s page with the syntax [[parent-name:name]]. The object type can be placed in parentheses for either or both of these parts.

getCompiledRegExp()#

Return a compiled regular expression.

handleMatch(m, data)#

Return the converted match, along with start and end positions

property warn_prefix: str#
class ford._markdown.MetaMarkdown(md_base='.', base_url='.', extensions=None, extension_configs=None, aliases=None, project=None)#

Bases: Markdown

Helper subclass that captures our defaults

Parameters:
convert(source, context=None, path=None)#

Convert from markdown to HTML

Parameters:
  • source (str) – Text to convert

  • context (Optional[FortranBase]) – Current Ford object being processed

  • path (Optional[Path]) – Current (output) path of page being processed

reset()#

Resets all state variables so that we can start with a new text.

class ford._markdown.RelativeLinksExtension(**kwargs)#

Bases: Extension

Markdown extension to register RelativeLinksTreeProcessor

extendMarkdown(md)#

Add the various processors and patterns to the Markdown Instance.

This method must be overridden by every extension.

Keyword arguments:

  • md: The Markdown instance.

class ford._markdown.RelativeLinksTreeProcessor(md)#

Bases: Treeprocessor

Modify link URLs to be relative to the given base URL

md: MetaMarkdown#
run(root)#

Subclasses of Treeprocessor should implement a run method, which takes a root ElementTree. This method can return another ElementTree object, and the existing root ElementTree `will be replaced, or it can modify the current tree and return `None.