Compare commits

...

3 commits

Author SHA1 Message Date
7ee84470e9 Workaround module import 2024-10-01 22:58:45 +02:00
9255f77d93 UCWTeX: Optional section eject 2024-10-01 21:14:42 +02:00
a9f41eb83e UCWTeX: textasciitilde 2024-10-01 21:13:07 +02:00
2 changed files with 9 additions and 4 deletions

View file

@ -7,6 +7,10 @@
\it{}#1%
}}
\def\textasciitilde{$\sim$}
\def\N{{\bb N}}
\def\R{{\bb R}}
\def\E{{\bb E}}
@ -20,9 +24,10 @@
\fncount=1
\def\fnmark{$^{\the\fncount}$}
\def\fn#1{\footnote\fnmark{#1}\advance\fncount by 1}
\def\sectioneject{\vfil\supereject}
\def\section#1#2{
\vfil\supereject
\vbox{\settextsize{20}\bf #1\kern 1em\relax#2%
\sectioneject
\vskip 16pt\vbox{\settextsize{20}\bf #1\kern 1em\relax#2%
\addtoc\tocsection{#1}{}{#2}%
}\nobreak\vskip 12pt
}

View file

@ -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)