Skip to content

plenty of pretty patchi pages#53

Merged
object-Object merged 11 commits intohexdoc-dev:mainfrom
SamsTheNerd:main
Dec 30, 2023
Merged

plenty of pretty patchi pages#53
object-Object merged 11 commits intohexdoc-dev:mainfrom
SamsTheNerd:main

Conversation

@SamsTheNerd
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/hexdoc/_export/resources/assets/hexdoc/lang/en_us.flatten.json5 Outdated
<span class="collapse-recipe-show">{{ _('hexdoc.multiblock.show') }}</span>
<span class="collapse-recipe-hide">{{ _('hexdoc.multiblock.hide') }}</span>
</summary>
{% for entry in page.multiblock.bill_of_materials %}
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.

i think jinja supports this

Suggested change
{% for entry in page.multiblock.bill_of_materials %}
{% for item, count in page.multiblock.bill_of_materials %}

Comment thread src/hexdoc/_templates/pages/patchouli/multiblock.html.jinja Outdated
Comment thread src/hexdoc/_templates/index.css.jinja Outdated
Comment thread src/hexdoc/_templates/index.css.jinja
Comment thread src/hexdoc/_templates/index.css.jinja Outdated
Comment thread src/hexdoc/_templates/index.css.jinja Outdated
for layer in self.pattern:
for row in layer:
for item in row:
if item in self.mapping:
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.

the only cases where this would be false are (air), _ (any block), or an invalid page. imo we should ignore air, handle "any block" somehow, and raise otherwise if it's not found

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.

also 0 to mark the center or whatever it is ? I didn't know about the _ any block though.

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.

aha true! ...actually i can probably deal with this one if you want, many edge cases apparently

Comment on lines +90 to +93
bom_list = list[tuple[ItemWithTexture | TagWithTexture, int]]()
for item_key, count in bom.items():
bom_list.append((self.mapping[item_key], count))
return bom_list
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.

maybe something like this? (untested)

Suggested change
bom_list = list[tuple[ItemWithTexture | TagWithTexture, int]]()
for item_key, count in bom.items():
bom_list.append((self.mapping[item_key], count))
return bom_list
return sorted(
(self.mapping[item], count) for item, count in bom.items(),
key=lambda v: (v[1], v[0].name),
)

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.

so... I don't like how duplicated everything is, but I'm planning on refactoring the recipe rendering anyway, so I guess it's ok for now.

@object-Object object-Object mentioned this pull request Dec 23, 2023
10 tasks
@object-Object object-Object merged commit d94f90c into hexdoc-dev:main Dec 30, 2023
@object-Object
Copy link
Copy Markdown
Member

thanks!

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