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

Fix search term highlighting and deploy <mark> tags #169

Merged
merged 4 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions home/service/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ def _generate_label_clear_ref(self) -> dict[str, dict[str, str]] | None:
if classifications:
classifications_clear_href = {}
for classification in classifications:
classifications_clear_href[
classification
] = self.form.encode_without_filter(
filter_name="classifications", filter_value=classification
classifications_clear_href[classification] = (
self.form.encode_without_filter(
filter_name="classifications", filter_value=classification
)
)
label_clear_href["classifications"] = classifications_clear_href

if where_to_access:
where_to_access_clear_href = {}
for access in where_to_access:
where_to_access_clear_href[
access
] = self.form.encode_without_filter(
filter_name="where_to_access", filter_value=access
where_to_access_clear_href[access] = (
self.form.encode_without_filter(
filter_name="where_to_access", filter_value=access
)
)
label_clear_href["availability"] = where_to_access_clear_href
else:
Expand Down Expand Up @@ -177,7 +177,7 @@ def _highlight_results(self):
for result in highlighted_results.page_results:
result.description = re.sub(
pattern,
r"**\1**",
r"<mark>\1</mark>",
result.description,
flags=re.IGNORECASE,
)
Expand Down
8 changes: 7 additions & 1 deletion scss/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ $govuk-global-styles: true;
display: none;
}

mark {
background-color: inherit;
color: inherit;
@include govuk-typography-weight-bold($important: false);
}

@import './glossary';
@import './details';
@import './details';
6 changes: 6 additions & 0 deletions static/assets/css/base.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/assets/css/base.css.map

Large diffs are not rendered by default.

Loading