Skip to content

Commit

Permalink
meh
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra committed Jan 22, 2025
1 parent 983dd8f commit 8ba15da
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 47 deletions.
8 changes: 6 additions & 2 deletions betty/jinja2/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@
upper_camel_case_to_lower_camel_case,
)
from betty.typing import internal
from betty.locale.localized import LocalizedStr

if TYPE_CHECKING:
from betty.locale.localized import Localized, LocalizedStr
from betty.locale.localized import Localized
from betty.ancestry.date import HasDate
from betty.date import Datey
from betty.locale.localizable import Localizable
Expand Down Expand Up @@ -132,13 +133,16 @@ def filter_localize(
@pass_context
def filter_html_lang(
context: Context,
localized: LocalizedStr,
localized: LocalizedStr | str,
) -> str | Markup:
"""
Optionally add the necessary HTML to indicate the localized string has a different locale than the surrounding HTML.
"""
from betty.jinja2 import context_localizer

if not isinstance(localized, LocalizedStr):
return localized

localizer = context_localizer(context)
result: str | Markup = localized
if localized.locale != localizer.locale:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@
</div>
{% include 'header.html.j2' %}
<div id="main-content"></div>
<div class="py-2" data-bs-theme="light-secondary">
<div class="container">
<div class="row">
<div class="align-items-center col col-12 col-lg-8 d-flex entity-page-intro flex-column-reverse flex-md-row">
<div class="flex-grow-1">
<h1>{{ page_title | html_lang }}</h1>
{% block page_summary %}{% endblock %}
</div>
{% if page_resource is has_file_references %}
{% set page_image_reference = page_resource.file_references | selectattr('file', 'public') | selectattr('file.media_type.type', 'eq', 'image') | first %}
{% if page_image_reference is defined %}
<img src="{{ page_image_reference | image_resize_cover((150, 150)) | static_url }}" class="rounded-circle entity-page-intro-image image" alt="{{ page_image_reference.file.label | localize }}">
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
{% block page_content %}{% endblock %}
{% include 'section/external-links.html.j2' %}
{% include 'section/references.html.j2' %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% extends 'entity/page-base.html.j2' %}
{% extends 'entity/page.html.j2' %}
{% block page_content %}
{% include 'entity/page-intro.html.j2' %}

{% include 'section/wikipedia.html.j2' %}

{% with facts = entity.facts %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% extends 'entity/page-base.html.j2' %}
{% extends 'entity/page.html.j2' %}
{% block page_content %}
{% include 'entity/page-intro.html.j2' %}

{% if entity.place is not none %}
{% with places = [entity.place] %}
{% include 'section/map.html.j2' %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends 'entity/page-base.html.j2' %}
{% extends 'entity/page.html.j2' %}
{% set page_title = entity.label | localize %}
{% block page_content %}
{% include 'entity/page-intro.html.j2' %}

{% if entity.media_type and entity.media_type.type == 'image' %}
<div class="py-2" data-bs-theme="dark">
<div class="container">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% extends 'entity/page-base.html.j2' %}
{% extends 'entity/page.html.j2' %}
{% block page_content %}
{% include 'entity/page-intro.html.j2' %}

{% include 'section/wikipedia.html.j2' %}

{% with places = entity.presences | select('public') | selectattr('event', 'public') | map(attribute='event.place') | reject('none') | unique | list %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% extends 'entity/page-base.html.j2' %}
{% extends 'entity/page.html.j2' %}
{% block page_content %}
{% include 'entity/page-intro.html.j2' %}

{% include 'section/wikipedia.html.j2' %}

{% set enclosees = entity.walk_enclosees | map(attribute='enclosee') | select('entity', 'place') | list %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% extends 'entity/page-base.html.j2' %}
{% extends 'entity/page.html.j2' %}
{% block page_content %}
{% include 'entity/page-intro.html.j2' %}

{% include 'section/wikipedia.html.j2' %}

{% include 'section/notes.html.j2' %}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,4 @@
page_resource | localized_url(absolute=true)
) %}
{% block page_content %}
<div class="container">
<div class="row">
<div class="col col-12 col-lg-8">
<h1>{{ page_title | html_lang }}</h1>
</div>
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'entity/page-base.html.j2' %}
{% block page_content %}
{% include 'entity/page-intro.html.j2' %}
{% block page_summary %}
{% include 'entity/summary--' + entity.plugin_id() + '.html.j2' ignore missing %}
{% endblock %}

0 comments on commit 8ba15da

Please sign in to comment.