Skip to content

Commit

Permalink
Allow different headers in check
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarraff committed Jan 22, 2024
1 parent 87812d3 commit 35f2e45
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mark2confluence/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def publish(path: str)-> tuple:


def has_mark_headers(path: str) -> bool:
space_re = re.compile("<!--.?[Ss]pace:.*-->", re.MULTILINE)
space_re = re.compile("<!--.?(space|parent|title):.*-->", re.IGNORECASE)
with open(path, 'r+') as f:
data = f.read().split("\n")
for line in data:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- Parent: Football -->
<!-- Parent: New Team -->
<!-- Title: I have Mark Lenders -->

And you don't.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- Title: I have Mark Lenders -->

And you don't.
4 changes: 3 additions & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def test_load_env_prefixes():

def test_has_mark_headers():
resource_directory = f"{RESOURCE_DIR}/markdown/test_has_mark_headers"
assert main.has_mark_headers(f"{resource_directory}/with_mark_headers.md")
assert main.has_mark_headers(f"{resource_directory}/with_mark_space_header.md")
assert main.has_mark_headers(f"{resource_directory}/with_mark_parent_header.md")
assert main.has_mark_headers(f"{resource_directory}/with_mark_title_header.md")
assert not main.has_mark_headers(f"{resource_directory}/without_mark_headers.md")

def test_check_header_template():
Expand Down

0 comments on commit 35f2e45

Please sign in to comment.