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

Flags :D #60

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Flags :D #60

wants to merge 3 commits into from

Conversation

SamsTheNerd
Copy link
Contributor

didn't bother adding the test flags into the nox stuff, not sure if that'll effect the snapshots ?

Comment on lines +3 to +5
<section id="{{ category.id.path }}" class="{% if category.flag is not none %}
{{ category.flag.css_classnames() }}
{% endif %}">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<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 }}">

Copy link
Member

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
Copy link
Member

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 %}
Copy link
Member

Choose a reason for hiding this comment

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

same as above

Comment on lines +16 to +18
assert (
"," not in data
) # not sure if there are other invalid characters or not
Copy link
Member

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):
Copy link
Member

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

Comment on lines +40 to +45
if data.startswith("|") or data.startswith("&"): # must be a list
return {
"flags": data[1:].split(","),
"conjuctive": data.startswith("&"),
}
return {"flags": [data]}
Copy link
Member

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
Copy link
Member

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)

@object-Object
Copy link
Member

@SamsTheNerd are you still interested in getting this merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants