diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-12-07 10:42:58 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-12-08 12:12:16 +0100 |
| commit | 298b607b38cf44f346d5fb98e6bb36c184e2b5fb (patch) | |
| tree | bfcd9e83c4cf7a33d8c479ef7652c9c8d3ae541f /tools/snippets_translate | |
| parent | e48f1f4ef9001d147aec682e5a04b169e46d0e4d (diff) | |
Documentation: Loosen snippet pattern
Some examples(queuedcustomtype, codeeditor) use '//![snippet]'.
Change-Id: If13fd12f8eff8a41a3b8e4f74a7bf3a03c8b39b3
Pick-to: 6.2
Task-number: PYSIDE-1721
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'tools/snippets_translate')
| -rw-r--r-- | tools/snippets_translate/main.py | 2 | ||||
| -rw-r--r-- | tools/snippets_translate/tests/test_snippets.py | 53 |
2 files changed, 54 insertions, 1 deletions
diff --git a/tools/snippets_translate/main.py b/tools/snippets_translate/main.py index a0a4663a0..4960049d6 100644 --- a/tools/snippets_translate/main.py +++ b/tools/snippets_translate/main.py @@ -73,7 +73,7 @@ log = logging.getLogger("snippets_translate") # Filter and paths configuration SKIP_END = (".pro", ".pri", ".cmake", ".qdoc", ".yaml", ".frag", ".qsb", ".vert", "CMakeLists.txt") SKIP_BEGIN = ("changes-", ".") -SNIPPET_PATTERN = re.compile(r"//! \[([^]]+)\]") +SNIPPET_PATTERN = re.compile(r"//! ?\[([^]]+)\]") class FileStatus(Enum): diff --git a/tools/snippets_translate/tests/test_snippets.py b/tools/snippets_translate/tests/test_snippets.py new file mode 100644 index 000000000..0a3f4f021 --- /dev/null +++ b/tools/snippets_translate/tests/test_snippets.py @@ -0,0 +1,53 @@ +############################################################################# +## +## Copyright (C) 2021 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qt for Python. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +from main import get_snippets + + +SNIPPETS = ["pretext", + "//![some name]", "line1", + "//! [some name] [some other name]", + "line2", + "//! [some other name]", + "posttext"] + + +def test_snippets(): + extracted = get_snippets(SNIPPETS) + assert len(extracted) == len(SNIPPETS) - 2 |
