File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- import json
65from collections .abc import Iterator , Sequence
76from typing import Any
87
@@ -170,11 +169,14 @@ def _get_all_refs(self) -> set[str]:
170169 return refs
171170
172171 def _render (self ) -> Tag :
173- if isinstance (self .contents , Var ):
174- if isinstance (self .contents , (BooleanVar , ObjectVar )):
175- return Tagless (contents = f"{ self .contents .to_string ()!s} " )
176- return Tagless (contents = f"{ self .contents !s} " )
177- return Tagless (contents = f'"{ json .dumps (self .contents )} "' )
172+ contents = (
173+ Var .create (self .contents )
174+ if not isinstance (self .contents , Var )
175+ else self .contents
176+ )
177+ if isinstance (contents , (BooleanVar , ObjectVar )):
178+ return Tagless (contents = f"{ contents .to_string ()!s} " )
179+ return Tagless (contents = f"{ contents !s} " )
178180
179181 def _add_style_recursive (
180182 self , style : ComponentStyle , theme : Component | None = None
You can’t perform that action at this time.
0 commit comments