Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Oct 25, 2023
1 parent 0b97e7c commit 42b29c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev168"
version = "0.0.0.dev169"
name = "RepoDynamics"
dependencies = [
"packaging >= 23.2, < 24",
Expand Down
18 changes: 10 additions & 8 deletions src/repodynamics/actions/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,8 @@ def _extract_entries_from_issue_body(self, body_elems: list[dict]):
def create_pattern(parts):
pattern_sections = []
for idx, part in enumerate(parts):
pattern_section = rf"### {re.escape(part['title'])}\n(?P<{part['id']}>.*?)"
pattern_content = f"(?P<{part['id']}>.*)" if part['id'] else "(?:.*)"
pattern_section = rf"### {re.escape(part['title'])}\n{pattern_content}"
if idx != 0:
pattern_section = f"\n{pattern_section}"
if part['optional']:
Expand All @@ -1068,13 +1069,14 @@ def create_pattern(parts):
return ''.join(pattern_sections)
parts = []
for elem in body_elems:
if elem.get("id"):
pre_process = elem.get("pre_process")
if not pre_process or FormGenerator._pre_process_existence(pre_process):
optional = False
else:
optional = True
parts.append({"id": elem["id"], "title": elem["attributes"]["label"], "optional": optional})
if elem["type"] == "markdown":
continue
pre_process = elem.get("pre_process")
if not pre_process or FormGenerator._pre_process_existence(pre_process):
optional = False
else:
optional = True
parts.append({"id": elem.get("id"), "title": elem["attributes"]["label"], "optional": optional})
pattern = create_pattern(parts)
compiled_pattern = re.compile(pattern, re.S)
# Search for the pattern in the markdown
Expand Down

0 comments on commit 42b29c6

Please sign in to comment.