Skip to content

Commit

Permalink
rework replacement logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mawieland committed Jun 23, 2023
1 parent 673c2b9 commit 10471c9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sphinx_needs_enterprise/extensions/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,13 @@ def replace_content(self, options, data):
if not replace_dict:
return data

for field, replacements in replace_dict.items():
for string, replacement in replacements.items():
for datum in data:
try:
for field, replacements in replace_dict.items(): # entries in service_config["replace_content"], low amount
for string, replacement in replacements.items(): # string to replace
for datum in data: # entries
if field in datum.keys():

datum[field].replace(string, replacement)
print(f"replacing {string} with {replacement} in {datum['id']}")
except KeyError:
print(f"cound not find")
continue
print(datum[field])

return data

0 comments on commit 10471c9

Please sign in to comment.