ford._markdown module#
- class ford._markdown.AliasExtension(**kwargs)#
Bases:
ExtensionMarkdown 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:
PreprocessorSubstitute 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('(?<!\\\\)\\|([^ ].*?[^ ]?)\\|')#
- class ford._markdown.FordLinkExtension(**kwargs)#
Bases:
ExtensionMarkdown 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:
InlineProcessorReplace 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.
- LINK_RE = re.compile('\\[\\[\n (?P<name>\\w+(?:\\.\\w+)?)\n (?:\\((?P<entity>\\w+)\\))?\n (?::(?P<child_name>\\w+)\n (?:\\((?P<child_entity>\\w+)\\))?)?\n \\]\\]', re.VERBOSE)#
- convert_link(m)#
- getCompiledRegExp()#
Return a compiled regular expression.
- handleMatch(m, data)#
Return the converted match, along with start and end positions
- md: MetaMarkdown#
- class ford._markdown.MetaMarkdown(md_base='.', base_url='.', extensions=None, extension_configs=None, aliases=None, project=None)#
Bases:
MarkdownHelper subclass that captures our defaults
- Parameters:
md_base (
Union[PathLike,str]) – Base path for md_include extensionextensions (
Optional[Sequence[Union[str,Extension]]]) – List of markdown extension names or instancesextension_configs (
Optional[Dict[str,Dict]]) – Dictionary of markdown extension config settingsaliases (
Optional[Dict[str,str]]) – Dictionary of text aliasesbase_url (
Union[PathLike,str]) – Base/project URL for relative links (required ifrelativeis True)
- convert(source, context=None, path=None)#
Convert from markdown to HTML
- Parameters:
source (
str) – Text to convertcontext (
Optional[FortranBase]) – Current Ford object being processedpath (
Optional[Path]) – Current (output) path of page being processed
- current_context: FortranBase | None#
- reset()#
Resets all state variables so that we can start with a new text.
- class ford._markdown.RelativeLinksExtension(**kwargs)#
Bases:
ExtensionMarkdown 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:
TreeprocessorModify link URLs to be relative to the given base URL
- md: MetaMarkdown#