Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 17 additions & 5 deletions scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,22 @@ def _find_xml_elements(tree: Any) -> List[ElTree.Element]:
return cast(List[ElTree.Element], elements)


def _replace_element_text(el: ElTree.Element, replacement_values: List[Tuple[str, str]], modified: bool) -> bool:
"""Replace text and tail text in an XML element."""
if el.text:
new_text = get_replacement_value_from_dict(el.text, replacement_values)
if new_text != el.text:
el.text = new_text
modified = True
for child in el:
if child.tail:
new_tail = get_replacement_value_from_dict(child.tail, replacement_values)
if new_tail != child.tail:
child.tail = new_tail
modified = True
return modified


def replace_text_in_xml_file(filename: str, replacement_values: List[Tuple[str, str]]) -> None:
"""Replace text in XML file."""
logging.debug(f" --- starting xml_replace for {filename}")
Expand All @@ -1308,11 +1324,7 @@ def replace_text_in_xml_file(filename: str, replacement_values: List[Tuple[str,

modified = False
for el in elements_to_check:
if el.text:
new_text = get_replacement_value_from_dict(el.text, replacement_values)
if new_text != el.text:
el.text = new_text
modified = True
modified = _replace_element_text(el, replacement_values, modified)

if modified:
try:
Expand Down
2 changes: 1 addition & 1 deletion source/webapp-cards-3.0-ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1368,4 +1368,4 @@ paragraphs:
text: "Видео с презентации, OWASP® EU Tour 2013 London, 3 июня 2013"
-
id: "T03950"
text: "Смотри веб-сайт проекта для получения дополнительной информации и материалов презентаций."
text: "Смотри веб-сайт проекта для получения дополнительной информации и материалов."
Loading