Skip to content

Commit

Permalink
vega: Only escape field.
Browse files Browse the repository at this point in the history
Unnecesary escaping for `title` and labels was added in #81.
  • Loading branch information
daavoo committed Sep 15, 2022
1 parent b4dbe1c commit 8b65f06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dvc_render/vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_filled_template(
f"Template '{self.template.name}' "
f"is not using '{anchor}' anchor"
)
else:
elif name in {"x", "y"}:
value = self.template.escape_special_characters(value)
content = self.template.fill_anchor(content, name, value)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@ def test_escape_special_characters():
assert filled["data"]["values"][0] == datapoints[0]
# field and title yes
assert filled["encoding"]["x"]["field"] == "foo\\.bar\\[0\\]"
assert filled["encoding"]["x"]["title"] == "foo\\.bar\\[0\\]"
assert filled["encoding"]["x"]["title"] == "foo.bar[0]"
assert filled["encoding"]["y"]["field"] == "foo\\.bar\\[1\\]"
assert filled["encoding"]["y"]["title"] == "foo\\.bar\\[1\\]"
assert filled["encoding"]["y"]["title"] == "foo.bar[1]"

0 comments on commit 8b65f06

Please sign in to comment.