Workaround module import
This commit is contained in:
parent
9255f77d93
commit
7ee84470e9
1 changed files with 2 additions and 2 deletions
|
@ -228,12 +228,12 @@ class TransformProcessor(NOPProcessor):
|
|||
importedDoc = import_md(open(filename, "r").read())
|
||||
self.transform(importedDoc.content)
|
||||
elif e.attributes["type"] == "module":
|
||||
matches = re.match(r"^(\w+)(?: as (\w+))?$", e.content[0].text[1:])
|
||||
matches = re.match(r"^([\w\.]+)(?: as (\w+))?$", e.content[0].text[1:])
|
||||
if not matches:
|
||||
raise SyntaxError(f"`{e.content[0].text[1:]}`: invalid syntax")
|
||||
module = importlib.import_module(matches.group(1))
|
||||
module_name = matches.group(1) if matches.group(2) is None else matches.group(2)
|
||||
self.context.add_commands_from_module(module, module_name)
|
||||
self.context.add_commands_from_module(module, "")
|
||||
elif e.attributes["type"] == "metadata":
|
||||
filename = self.context.dir + "/" + e.content[0].text[1:]
|
||||
self.context.add_dep(filename)
|
||||
|
|
Loading…
Reference in a new issue