Skip to content

Commit 85fe599

Browse files
authored
Merge pull request #208 from reportportal/develop
Release
2 parents 76e8f18 + 91f10c0 commit 85fe599

File tree

8 files changed

+364
-159
lines changed

8 files changed

+364
-159
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Added
5+
- `RP_FLATTEN_KEYWORDS` configuration variable, by @HardNorth
6+
- `--flatten-keywords` argument support, by @HardNorth
7+
8+
## [5.6.0]
49
### Changed
510
- Client version updated on [5.6.0](https://github.com/reportportal/client-Python/releases/tag/5.6.0), by @HardNorth
611
- Test end message now posts to the Test description, by @HardNorth

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ NOT REQUIRED:
9595
Also, you can specify a full path to your certificate as the value.
9696
--variable RP_REMOVE_KEYWORDS:"True"
9797
- Default value is "False", remove keywords from reporting, passed with '--remove-keywords' Robot's argument.
98+
--variable RP_FLATTEN_KEYWORDS:"True"
99+
- Default value is "False", flatten keywords on reporting, passed with '--flatten-keywords' Robot's argument.
98100
```
99101

100102
### Logging

robotframework_reportportal/helpers.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,6 @@
2020
from typing import Iterable, Optional, Tuple
2121

2222

23-
def replace_patterns(text: str, patterns: Iterable[Tuple[re.Pattern, str]]) -> str:
24-
"""Replace given patterns in the text."""
25-
result = text
26-
for p, repl in patterns:
27-
result = p.sub(repl, result)
28-
return result
29-
30-
31-
BARE_LINK_PATTERN = re.compile(r"\[\s*([^]|]+)]")
32-
NAMED_LINK_PATTERN = re.compile(r"\[\s*([^]|]+)\|\s*([^]]+)]")
33-
34-
ROBOT_MARKUP_REPLACEMENT_PATTERS = [
35-
(BARE_LINK_PATTERN, r"<\1>"),
36-
(NAMED_LINK_PATTERN, r"[\2](\1)"),
37-
]
38-
39-
PATTERN_MATCHES_EMPTY_STRING: re.Pattern = re.compile("^$")
40-
41-
42-
def robot_markup_to_markdown(text: str) -> str:
43-
"""Convert Robot Framework's text markup to Markdown format."""
44-
return replace_patterns(text, ROBOT_MARKUP_REPLACEMENT_PATTERS)
45-
46-
4723
def translate_glob_to_regex(pattern: Optional[str]) -> Optional[re.Pattern]:
4824
"""Translate glob string pattern to regex Pattern.
4925
@@ -72,6 +48,30 @@ def match_pattern(pattern: Optional[re.Pattern], line: Optional[str]) -> bool:
7248
return pattern.fullmatch(line) is not None
7349

7450

51+
def replace_patterns(text: str, patterns: Iterable[Tuple[re.Pattern, str]]) -> str:
52+
"""Replace given patterns in the text."""
53+
result = text
54+
for p, repl in patterns:
55+
result = p.sub(repl, result)
56+
return result
57+
58+
59+
BARE_LINK_PATTERN = re.compile(r"\[\s*([^]|]+)]")
60+
NAMED_LINK_PATTERN = re.compile(r"\[\s*([^]|]+)\|\s*([^]]+)]")
61+
62+
ROBOT_MARKUP_REPLACEMENT_PATTERS = [
63+
(BARE_LINK_PATTERN, r"<\1>"),
64+
(NAMED_LINK_PATTERN, r"[\2](\1)"),
65+
]
66+
67+
PATTERN_MATCHES_EMPTY_STRING: re.Pattern = re.compile("^$")
68+
69+
70+
def robot_markup_to_markdown(text: str) -> str:
71+
"""Convert Robot Framework's text markup to Markdown format."""
72+
return replace_patterns(text, ROBOT_MARKUP_REPLACEMENT_PATTERS)
73+
74+
7575
def _unescape(binary_string: str, stop_at: int = -1):
7676
result = bytearray()
7777
join_list = list()

0 commit comments

Comments
 (0)