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

basic-report:0.1.2 and clean-dhbw:0.2.1 #1825

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

Conversation

roland-KA
Copy link
Contributor

@roland-KA roland-KA commented Feb 23, 2025

I am submitting

  • a new package
  • an update for a package
  • Adapt for Typst 0.13
  • Make TOC entries clickable
  • [ x] ensured that my package is licensed such that users can use and distribute the contents of its template directory without restriction, after modifying them through normal use.

@typst-package-check typst-package-check bot added the update A package update. label Feb 23, 2025
@typst-package-check typst-package-check bot changed the title basic-report:0.1.2 basic-report:0.1.2 and clean-dhbw:0.2.1 Feb 23, 2025
let list = state.get()
if element not in list {
panic(element + " is not a key in the " + dict-type + " dictionary.")
return false
Copy link
Member

Choose a reason for hiding this comment

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

This won't work as you expect: return can't escape the context block, which always returns some content, so the whole context block will either evaluate to [] or to [#false] (showing false written in red in a monospace font).
Also, because you panic the return actually never runs.
The proper way of achieving what you want would be to rename the function assert-in-dict (if you want a more correct name), an remove both return statements. Then, the function would act as a "guard": no need to use it in conjunction with a if, the document would just stop compiling if the key is not present because of the panic, but if gets to evaluate the line after the call to this function you can be sure that it is here because it didn't panic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your help! I've updated the the code affected, so this should be solved.

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

Successfully merging this pull request may close these issues.

2 participants