Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Nov 4, 2023
1 parent 3bac1e6 commit 0e6f41f
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions mknodes/jinja/nodeenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)

0 comments on commit 0e6f41f

Please sign in to comment.