From 0e6f41fd570a3933f003c6439dd4f0ac1ab7e2f0 Mon Sep 17 00:00:00 2001 From: phil65 Date: Sat, 4 Nov 2023 18:14:49 +0100 Subject: [PATCH] chore: cleanup --- mknodes/jinja/nodeenvironment.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/mknodes/jinja/nodeenvironment.py b/mknodes/jinja/nodeenvironment.py index 4d60eac3..5cc4cbc5 100644 --- a/mknodes/jinja/nodeenvironment.py +++ b/mknodes/jinja/nodeenvironment.py @@ -46,15 +46,6 @@ def __init__(self, node: mk.MkNode, **kwargs: Any): paths = self.get_extra_paths() self.add_template_path(*paths) - @classmethod - def get_nodes_from_string(cls, text: str, context=None) -> list[mk.MkNode]: - import mknodes as mk - - node = mk.MkNode(context=context) - env = cls(node) - env.render_string(text) - return env.rendered_nodes - def setup_environment(self): """Set up the environment by adding node/context specific filters / globals. @@ -137,7 +128,7 @@ def render_template( self.rendered_children = [i for i in self.rendered_nodes if i.parent == self.node] return result - def render_string(self, markdown: str, variables: dict | None = None): + def render_string(self, markdown: str, variables: dict | None = None) -> str: """Render a template string. Rendered nodes can be collected from `rendered_nodes` attribute after this call. @@ -166,5 +157,3 @@ def render_string(self, markdown: str, variables: dict | None = None): # text = env.render_string(r"{{ 50 | MkProgressBar }}") # print(env.rendered_nodes) # env.render_string(r"{{test('hallo')}}") - # nodes = NodeEnvironment.get_nodes_from_string(r"{{ 'test' | MkHeader }}") - # print(nodes)