From c1430069ab270efbb2409726ebedeb8dfba3f9c3 Mon Sep 17 00:00:00 2001 From: Greenscreener Date: Sun, 20 Aug 2023 23:50:01 +0200 Subject: [PATCH] Pokus o opravu #33. --- src/formatitko/context.py | 4 ++-- src/formatitko/formatitko.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/formatitko/context.py b/src/formatitko/context.py index b12dc4e..ecde7f2 100644 --- a/src/formatitko/context.py +++ b/src/formatitko/context.py @@ -58,8 +58,8 @@ class Context: if isinstance(module, ModuleType): module = module.__dict__ prefix = module_name+"." if module_name else "" - for name, func in module: - if isinstance(func, CommandCallable): + for name, func in module.items(): + if isinstance(func, Callable): self.set_command(prefix+name, func) def is_flag_set(self, flag: str): diff --git a/src/formatitko/formatitko.py b/src/formatitko/formatitko.py index 770984a..c989a4d 100755 --- a/src/formatitko/formatitko.py +++ b/src/formatitko/formatitko.py @@ -33,7 +33,7 @@ def main(): # just connect to an existing one. For formátíking many files in a row. # Use panflute to parse the input MD file - doc1 = import_md(open(args.input_filename, "r").read()) + #doc1 = import_md(open(args.input_filename, "r").read()) doc2 = import_md(open(args.input_filename, "r").read()) if args.debug: @@ -41,15 +41,15 @@ def main(): # The language metadatum is important, so it's read before transformation and # then attached to a group inside the Doc - language = doc1.get_metadata("lang", None, True) - context = Context(doc1, args.input_filename) + #language = doc1.get_metadata("lang", None, True) + #context = Context(doc1, args.input_filename) # Transform the document. This includes all the fancy formatting this software does. - doc1 = doc1.walk(transform, context) + #doc1 = doc1.walk(transform, context) # Now wrap the document contents in a group, which is able to pop its language # setting out to TeX - doc1.content = [BlockGroup(*doc1.content, context=context, metadata={"lang":language})] + #doc1.content = [BlockGroup(*doc1.content, context=context, metadata={"lang":language})] doc2 = TransformProcessor(args.input_filename).transform(doc2)