Skip to content

Commit

Permalink
[improve] Allow symbol along with str and content in some places
Browse files Browse the repository at this point in the history
  • Loading branch information
Mc-Zen committed Jan 15, 2025
1 parent dd7eaaf commit f888d58
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/process-args.typ
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if labels == none {  return () }
let type = type(labels)
if type == dictionary { labels = (labels,) } 
else if type in (content, str) { labels = ((content: labels),) } 
else if type in (symbol, content, str) { labels = ((content: labels),) } 
else if type == dictionary { labels = ((content: labels),) } 
let processed-labels = ()
for label in labels {
Expand Down
2 changes: 1 addition & 1 deletion src/quantum-circuit.typ
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
dy: annotation.at("dy", default: 0pt),
draw-params: draw-params
)
} else if type(annotation) in (content, str) {
} else if type(annotation) in (symbol, content, str) {
layer-below-circuit += place(annotation)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/verifications.typ
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

#let verify-annotation-content(annotation-content) = {
let content-type = type(annotation-content)
assert(content-type in (content, str, dictionary), message: "`annotate`: Unsupported callback return type `" + str(content-type) + "` (can be `dictionary` or `content`")
assert(content-type in (symbol, content, str, dictionary), message: "`annotate`: Unsupported callback return type `" + str(content-type) + "` (can be `dictionary` or `content`")

if content-type == dictionary {
assert("content" in annotation-content, message: "`annotate`: Missing field `content` in annotation. If the callback returns a dictionary, it must contain the key `content` and may specify coordinates with `dx` and `dy`.")
Expand Down

0 comments on commit f888d58

Please sign in to comment.