Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#169 Upgrade Mistune to v3 #187

Merged
merged 57 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
85ef6ce
#169 Upgrade to Mistune v3.0.2
kalbfled Dec 3, 2024
f9948ba
squash 169
kalbfled Dec 3, 2024
cc911ff
squash 169
kalbfled Dec 4, 2024
e9a946e
squash 169
kalbfled Dec 5, 2024
1d628c6
squash 169
kalbfled Dec 5, 2024
d55a829
squash 169 - hatchet job
kalbfled Dec 5, 2024
17ffb8c
squash 169
kalbfled Dec 6, 2024
2718324
squash 169
kalbfled Dec 6, 2024
0ca3da4
squash 169
kalbfled Dec 6, 2024
5c162ae
squash 169
kalbfled Dec 6, 2024
3338880
squash 169
kalbfled Dec 9, 2024
1daa849
squash 169
kalbfled Dec 9, 2024
87295e1
squash 169
kalbfled Dec 9, 2024
3b79a9f
squash 169
kalbfled Dec 9, 2024
5a08937
squash 169
kalbfled Dec 9, 2024
770173b
squash 169 - h1
kalbfled Dec 9, 2024
a582894
squash 169 - h2
kalbfled Dec 9, 2024
9b413b1
squash 169 - h3
kalbfled Dec 9, 2024
a1e3fd2
squash 169 - p
kalbfled Dec 9, 2024
576be75
squash 169 - block code
kalbfled Dec 9, 2024
27f4849
squash 169 - block quote
kalbfled Dec 9, 2024
ad9bd00
squash 169 - ol
kalbfled Dec 10, 2024
426212d
squash 169 - hr
kalbfled Dec 10, 2024
b74fdd5
squash 169 - img
kalbfled Dec 10, 2024
9a8ae96
squash 169 - link - This broke template tests, but no new failure in …
kalbfled Dec 10, 2024
9d1e58b
squash 169 - link with title
kalbfled Dec 10, 2024
e41d301
squash 169 - autolink
kalbfled Dec 10, 2024
94cb59e
squash 169 - ul
kalbfled Dec 10, 2024
3718d59
squash 169 - codespan
kalbfled Dec 10, 2024
075bbd3
squash 169 - newlines
kalbfled Dec 10, 2024
180b010
squash 169 - escape urls
kalbfled Dec 10, 2024
c0e34f2
squash 169
kalbfled Dec 10, 2024
aafabb0
squash 169
kalbfled Dec 10, 2024
6a96b8d
squash 169
kalbfled Dec 11, 2024
017d760
squash 169
kalbfled Dec 11, 2024
ca6202a
squash 169
kalbfled Dec 11, 2024
a26a029
squash 169
kalbfled Dec 11, 2024
de3ec97
squash 169
kalbfled Dec 11, 2024
740fdce
squash 169 - action links partial
kalbfled Dec 12, 2024
bd3a76f
squash 169
kalbfled Dec 12, 2024
905ad1e
squash 169 - action links
kalbfled Dec 12, 2024
9530a88
squash 169
kalbfled Dec 12, 2024
c876c17
squash 169
kalbfled Dec 13, 2024
144a2a5
squash 169
kalbfled Dec 13, 2024
769dfb1
squash 169
kalbfled Dec 13, 2024
a38e2db
squash 169
kalbfled Dec 13, 2024
a8720dd
squash 169
kalbfled Dec 16, 2024
b8321e8
squash 169
kalbfled Dec 16, 2024
667f9c7
squash 169
kalbfled Dec 16, 2024
7f0f79d
squash 169 - all unit tests pass
kalbfled Dec 16, 2024
5d32ff9
squash 169 - clean up
kalbfled Dec 17, 2024
a24e001
squash 169 - clean up
kalbfled Dec 17, 2024
0c8eb46
squash 169 - clean up
kalbfled Dec 17, 2024
7a84fa2
squash 169 - clean up
kalbfled Dec 17, 2024
c004de9
squash 169 - bumped minor version
kalbfled Dec 17, 2024
36a7a90
squash 169
kalbfled Dec 17, 2024
c8a1215
squash 169 - corrected list css attribute value that caused unordered…
kalbfled Dec 17, 2024
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
11 changes: 5 additions & 6 deletions notifications_utils/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ def __init__(
markdown_lists=False,
redact_missing_personalisation=False,
preview_mode=False,
is_letter_template=False
):
self.content = content
self.values = values
self.markdown_lists = markdown_lists
self.preview_mode = preview_mode
self.is_letter_template = is_letter_template
if not with_brackets:
self.placeholder_tag = self.placeholder_tag_no_brackets
if preview_mode:
Expand All @@ -105,10 +103,10 @@ def __init__(
}[html]
self.redact_missing_personalisation = redact_missing_personalisation

def __str__(self):
def __str__(self) -> str:
if self.values:
return self.replaced
return self.formatted
return str(self.formatted)

def __repr__(self):
return "{}(\"{}\", {})".format(self.__class__.__name__, self.content, self.values) # TODO: more real
Expand Down Expand Up @@ -155,11 +153,12 @@ def replace_match(self, match):
elif replaced_value is not None:
return self.get_replacement(placeholder)

# TODO: investigate why this fallback is necessary and potentially remove to enable truly conditional placeholders
# TODO - Investigate why this fallback is necessary, and potentially remove
# it to enable truly conditional placeholders.
return self.format_match(match)

def is_okay_to_have_null_values(self, placeholder) -> bool:
return self.redact_missing_personalisation or placeholder.is_conditional() or self.is_letter_template
return self.redact_missing_personalisation or placeholder.is_conditional()

def get_replacement(self, placeholder):
replacement = self.values.get(placeholder.name)
Expand Down
Loading
Loading