From 02a730ce48841aa163fb4dd2f4319973c03d6c01 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 23 Apr 2024 16:16:39 +0800 Subject: [PATCH] Fix the bug for support of left/right single quotation marks --- pygmt/helpers/utils.py | 3 ++- pygmt/tests/test_text.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pygmt/helpers/utils.py b/pygmt/helpers/utils.py index 1732dfb4e3f..66be427d937 100644 --- a/pygmt/helpers/utils.py +++ b/pygmt/helpers/utils.py @@ -305,10 +305,11 @@ def non_ascii_to_octal(argstr): c: "\\" + format(i, "o") for c, i in zip( "•…™—–fiž" # \03x. \030 is undefined + "’‘" # \047 and \140 "š" # \177 "Œ†‡Ł⁄‹Š›œŸŽł‰„“”" # \20x-\21x "ı`´ˆ˜¯˘˙¨‚˚¸'˝˛ˇ", # \22x-\23x - [*range(25, 32), *range(127, 160)], + [*range(25, 32), 39, 96, *range(127, 160)], strict=True, ) } diff --git a/pygmt/tests/test_text.py b/pygmt/tests/test_text.py index 9d52f2629af..ab07e964954 100644 --- a/pygmt/tests/test_text.py +++ b/pygmt/tests/test_text.py @@ -430,5 +430,5 @@ def test_text_quotation_marks(): """ fig = Figure() fig.basemap(projection="X4c/2c", region=[0, 4, 0, 2], frame=0) - fig.text(x=2, y=1, text="\\234 \\140 ' \" \\216 \\217", font="20p") + fig.text(x=2, y=1, text='\\234 ‘ ’ " “ ”', font="20p") # noqa: RUF001 return fig