From 36879c2d81c1fb34707588d6cbb1c1836eb43701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=A2=81=E9=B9=8F=E5=A0=83?= Date: Fri, 18 Apr 2025 08:12:07 +0000 Subject: [PATCH] Escape double quotes in graphviz labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张梁鹏堃 --- Escape-double-quotes-in-graphviz-labels.patch | 38 +++++++++++++++++++ python-treelib.spec | 8 +++- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Escape-double-quotes-in-graphviz-labels.patch diff --git a/Escape-double-quotes-in-graphviz-labels.patch b/Escape-double-quotes-in-graphviz-labels.patch new file mode 100644 index 0000000..8c6ebe4 --- /dev/null +++ b/Escape-double-quotes-in-graphviz-labels.patch @@ -0,0 +1,38 @@ +From 37ca44107dce240f45ccf33e8fb59b5c6702abb9 Mon Sep 17 00:00:00 2001 +From: Nathanael Demacon <7271496+quantumsheep@users.noreply.github.com> +Date: Sat, 1 Mar 2025 16:26:24 +0100 +Subject: [PATCH] Escape double quotes in graphviz labels (#235) + +* escape double quotes in graphviz labels + +Signed-off-by: Nathanael DEMACON + +* rename the variable label + +Signed-off-by: Nathanael DEMACON + +--------- + +Signed-off-by: Nathanael DEMACON +Co-authored-by: Nathanael DEMACON +--- + treelib/tree.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/treelib/tree.py b/treelib/tree.py +index 1cc9ac8..7bc4e7e 100644 +--- a/treelib/tree.py ++++ b/treelib/tree.py +@@ -1097,7 +1097,8 @@ class Tree(object): + sorting=sorting, + ): + nid = self[n].identifier +- state = '"{0}" [label="{1}", shape={2}]'.format(nid, self[n].tag, shape) ++ label = str(self[n].tag).translate(str.maketrans({'"': r"\""})) ++ state = '"{0}" [label="{1}", shape={2}]'.format(nid, label, shape) + nodes.append(state) + + for c in self.children(nid): +-- +2.33.0 + diff --git a/python-treelib.spec b/python-treelib.spec index a8f7ccb..f809d9f 100644 --- a/python-treelib.spec +++ b/python-treelib.spec @@ -1,11 +1,12 @@ %global _empty_manifest_terminate_build 0 Name: python-treelib Version: 1.7.0 -Release: 1 +Release: 2 Summary: A Python 2/3 implementation of tree structure. License: Apache-2.0 URL: https://github.com/caesar0301/treelib Source0: https://files.pythonhosted.org/packages/d8/ec/962387a2bd7ece011f47cfa08f06f832fc9fd41b31f4f0007b8b7948eb93/treelib-1.7.0.tar.gz +Patch6000: Escape-double-quotes-in-graphviz-labels.patch BuildArch: noarch @@ -29,7 +30,7 @@ Provides: python3-treelib-doc This is a simple tree data structure implementation in python. %prep -%autosetup -n treelib-%{version} +%autosetup -n treelib-%{version} -p1 %build %py3_build @@ -69,6 +70,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Fri Apr 18 2025 zhangliangpengkun - 1.7.0-2 +- DESC:Escape double quotes in graphviz labels + * Tue Nov 05 2024 xiaozai - 1.7.0-1 - Update package to version 1.7.0 - Remove deprecated plugins -- Gitee