From 20781ae2516beef2a4c7359387b1cb5da19fd6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 16 Jan 2025 15:05:28 +0100 Subject: [PATCH] feat(checks): detect missing space after rst ref --- weblate/checks/markup.py | 2 +- weblate/checks/tests/test_markup_checks.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/weblate/checks/markup.py b/weblate/checks/markup.py index 8975bb835397..5b1ada071794 100644 --- a/weblate/checks/markup.py +++ b/weblate/checks/markup.py @@ -64,7 +64,7 @@ ) RST_REF_MATCH = re.compile( - r"(?:(?<=\s)|^)((:[a-z:]+:)(?:`([^<`]+)`|`[^<`]+<([^<` ]+)>`))" + r"(?:(?<=\W)|^)((:[a-z:]+:)(?:`([^<`]+)`|`[^<`]+<([^<` ]+)>`))(?=\W|$)" ) # These should be present in translation if present in source, but might be translated diff --git a/weblate/checks/tests/test_markup_checks.py b/weblate/checks/tests/test_markup_checks.py index e1d78c594257..fbb985d4066d 100644 --- a/weblate/checks/tests/test_markup_checks.py +++ b/weblate/checks/tests/test_markup_checks.py @@ -458,6 +458,14 @@ def test_ref_space(self) -> None: "rst-text", ), ) + self.do_test( + True, + ( + ":ref:`Searching` now supports", + ":ref:`Searching`agora suporta", + "rst-text", + ), + ) def test_translatable(self) -> None: self.do_test(