-
Notifications
You must be signed in to change notification settings - Fork 4
Flags :D #60
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
base: main
Are you sure you want to change the base?
Flags :D #60
Conversation
<section id="{{ category.id.path }}" class="{% if category.flag is not none %} | ||
{{ category.flag.css_classnames() }} | ||
{% endif %}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<section id="{{ category.id.path }}" class="{% if category.flag is not none %} | |
{{ category.flag.css_classnames() }} | |
{% endif %}"> | |
<section id="{{ category.id.path }}" class="{{ category.flag.css_classnames() if category.flag }}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this is also helpful because the current code adds extra newlines to the output, as you can see in the snapshots)
@@ -1,6 +1,9 @@ | |||
{% import "macros/formatting.html.jinja" as fmt -%} | |||
|
|||
<div id="{{ entry.id.path }}" class="entry"> | |||
<div id="{{ entry.id.path }}" class="entry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -3,7 +3,9 @@ | |||
{% set page_anchor_id = entry.id.path ~ "@" ~ page.anchor %} | |||
|
|||
{#- page content (not required because EmptyPage uses this template directly) #} | |||
<div id="{{ page_anchor_id }}"> | |||
<div id="{{ page_anchor_id }}" class="{% if entry.flag is not none %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
assert ( | ||
"," not in data | ||
) # not sure if there are other invalid characters or not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- what's this for?
- move the comment to the line above and it'll be formatted a bit less weirdly
- this should have some sort of useful error message, not just an empty assert (ie.
assert condition, "message goes here"
)
@model_validator(mode="before") | ||
@classmethod | ||
def parse_flag(cls, data: Any) -> Any: | ||
if isinstance(data, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd probably do a match
statement, but this works too
if data.startswith("|") or data.startswith("&"): # must be a list | ||
return { | ||
"flags": data[1:].split(","), | ||
"conjuctive": data.startswith("&"), | ||
} | ||
return {"flags": [data]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these could (and probably should) return instances of the class instead of dicts. for example: return cls(flags=[data])
@@ -184,7 +184,8 @@ | |||
title="Permalink" | |||
><i class="bi bi-link-45deg"></i></a></h2> | |||
<p>The practitioners of this art would cast their so-called <span style="color: #b38ef3">Hexes</span> by drawing strange patterns in the air with a <a href="GITHUB_PAGES_URL/v/latest/main/en_us#items/staff"><span style="color: #b0b">Staff</span></a> -- or craft <a href="GITHUB_PAGES_URL/v/latest/main/en_us#items/hexcasting"><span style="color: #b0b">powerful magical items</span></a> to do the casting for them. How might I do the same?</p> | |||
<div id="baz" class="entry"> | |||
<div id="baz" class="entry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this is what i mentioned above)
@SamsTheNerd are you still interested in getting this merged? |
didn't bother adding the test flags into the nox stuff, not sure if that'll effect the snapshots ?