Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 8 additions & 0 deletions docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,16 @@ BeeWare is supported by users like you! Every little bit helps: [click here to c

### Upcoming events

{% if upcoming_events(files) == None %}

Nothing at the moment...

{% else %}

{{ upcoming_events(files) }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, this will invoke the macro twice. That's not a huge problem, but it's one we can avoid with {% set %}

Suggested change
{% if upcoming_events(files) == None %}
Nothing at the moment...
{% else %}
{{ upcoming_events(files) }}
{% set events = upcoming_events(files) %}
{% if events %}
{{ events }}
{% else %}
Nothing at the moment...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't commit this directly because I think there still needs to be whitespace around the string for translation to not pull the Jinja into the translation string.


{% endif %}

### Documentation

<div class="index-docs" markdown="1">
Expand Down
18 changes: 16 additions & 2 deletions docs/en/stylesheets/beeware.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ md-path__list > .md-path__item > .md-path__link {
margin-right: 6.7%;
}

/* This forces all main content EXCEPT the index page to be 45rem wide */
.md-sidebar--primary:is([hidden]) ~ .md-content:not(:has(.md-content__inner .index-page)) {
/* This forces all main content EXCEPT the index and blog pages to be 45rem wide */
/* The blog page includes the blog left sidebar in the width, and needs to be ignored */
/* Docs page has its own width limits, and is ignored here. */
.md-sidebar--primary:is([hidden]) ~ .md-content:not(:has(.index-page, .md-sidebar--post)) .md-content__inner:not(:has(.docs-page)),
.md-post__content,
.md-content--post > .md-content__inner {
max-width: 45rem;
}

Expand Down Expand Up @@ -339,6 +343,11 @@ a.index-main-keep {
min-width: 15rem;
}

/* The right sidebar when not on blog pages */
.md-sidebar--secondary:has(+ :not(.md-content--post)) {
margin-right: 5.5%;
}

h2#sidebar {
margin-top: 0rem;
}
Expand Down Expand Up @@ -537,6 +546,10 @@ h1 .news {
width: 13rem;
}

.md-content--post > .md-content__inner {
margin-top: 1.8rem;
}

.md-post__content h2:first-of-type {
display: none;
}
Expand All @@ -553,6 +566,7 @@ h1 .news {
.md-sidebar--primary:is([hidden]) ~ .md-content.md-content--post {
margin-left: 0;
margin-right: 0;
max-width: fit-content;
}

@media screen and (min-width: 76.25em) {
Expand Down
6 changes: 3 additions & 3 deletions docs/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def upcoming_events(files):
):
metadata = get_metadata(file_data.content_string)

if metadata["event"]["date"] < datetime.date.today():
if metadata["event"]["date"] > datetime.date.today():
if metadata["event"]["date"] == metadata["event"]["end_date"]:
event_date = metadata["event"]["date"].strftime("%B %d, %Y")
else:
Expand All @@ -282,14 +282,14 @@ def upcoming_events(files):
metadata["event"]["date"],
(
f"- [{metadata['event']['name']}"
f": {event_date}]({file_data.src_path})",
f": {event_date}]({file_data.src_path})"
),
)
)

if events:
return "\n".join(item[1] for item in sorted(events)[:5])
return "Nothing at the moment..."
return None

@env.macro
def latest_news(files):
Expand Down