Skip to content

Commit

Permalink
parser: Ensure we don't unquote keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Jan 29, 2025
1 parent 24160cd commit a1f522f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pydot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def quote_attr_if_necessary(s: str) -> str:
if not isinstance(s, str):
return s

if s.lower() in dot_keywords:
if s.lower() in DOT_KEYWORDS:
return make_quoted(s)

any_result = any_needs_quotes(s)
Expand Down
4 changes: 4 additions & 0 deletions src/pydot/dot_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

import pydot
from pydot.classes import AttributeDict, FrozenDict
from pydot.constants import DOT_KEYWORDS


__author__ = ["Michael Krause", "Ero Carrera"]
__license__ = "MIT"
Expand Down Expand Up @@ -425,6 +427,8 @@ def possibly_unquote(s: ParseResults) -> T.Union[str, ParseResults]:
return s
if any(qs.find(c) >= 0 for c in QUOTED_CHARS):
return s
if qs.lower() in DOT_KEYWORDS:
return s
if qs.isascii():
return qs
return s
Expand Down

0 comments on commit a1f522f

Please sign in to comment.